summaryrefslogtreecommitdiff
path: root/src/main/java/fyresmodjam/blessings/Blessing.java
blob: 4c5e6a132f98127b367bb019cb496a77dc279500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package fyresmodjam.blessings;

import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent;

/**
 * Represents a blessing bestowed to a player.
 * 
 * @author bjculkin
 */
public abstract class Blessing {
	private static int nextOrdinal = 0;
	
	public final int ordinal;
	
	protected Blessing() {
		ordinal = nextOrdinal++;
	}

	public boolean hasCustomName() {
		return false;
	}
	
	public String customName() {
		return "Blessing of the " + name();
	}
	
	/**
	 * Get the name of this blessing.
	 * 
	 * @return The name of this blessing.
	 */
	public abstract String name();

	/**
	 * Get the description of this blessing.
	 * 
	 * @return The description of this blessing.
	 */
	public abstract String description();

	/**
	 * Modify the player's break speed.
	 * 
	 * @param pebsev
	 *                The break speed event.
	 */
	public void checkBreakSpeed(PlayerEvent.BreakSpeed pebsev) {
		return;
	}

	/**
	 * Correct inappropriate blessings for mobs.
	 * 
	 * @param ent
	 *                The mob to correct for.
	 */
	public void correctBlessing(Entity ent) {
		return;
	}

	/**
	 * Do something on every tick.
	 * 
	 * @param stev
	 *                The tick event
	 */
	public void commonTick(ServerTickEvent stev, EntityPlayer play) {
		return;
	}
	
	/**
	 * Handle adjusting the damage multiplier for mob knowledge.
	 * 
	 * @param lhev
	 * 	The event being dealt with.
	 * 
	 * @param pickedDamageBonus
	 * 	The base damage bonus for mob knowledge.
	 * 
	 * @return
	 * 	The new damage bonus for mob knowledge
	 */
	public float adjustMobKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) {
		return pickedDamageBonus;
	}
	
	/**
	 * Handle adjusting the damage multiplier for weapon knowledge.
	 * 
	 * @param lhev
	 * 	The event being dealt with.
	 * 
	 * @param pickedDamageBonus
	 * 	The base damage bonus for weapon knowledge.
	 * 
	 * @return
	 * 	The new damage bonus for weapon knowledge
	 */
	public float adjustWeaponKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) {
		return pickedDamageBonus;
	}
	
	public float onIncomingDamage(LivingHurtEvent lhev, float damageMultiplier) {
		return damageMultiplier;
	}
	
	public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) {
		return damageMultiplier;
	}
	
	public void onMobKill(LivingDeathEvent event) {
		return;
	}
}