blob: 88f467a22ee031e21479bea4e36f44ccd180116e (
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
|
package fyresmodjam.blessings.marks;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
public class FalseLifeMark extends Mark {
@Override
public String name() {
return "False Life";
}
@Override
public String description() {
return "BENEFIT - Rally from a fatal injury\nDRAWBACK - Lose permanent health to do so";
}
@Override
public float onIncomingDamage(LivingHurtEvent event,
float damageMultiplier) {
float totalAmount = Math.max(0.5f,
event.getAmount() * damageMultiplier);
if (totalAmount > event.getEntityLiving().getMaxHealth()) {
event.setCanceled(true);
event.getEntityLiving().getEntityAttribute(
SharedMonsterAttributes.MAX_HEALTH)
.setBaseValue(event.getEntityLiving()
.getMaxHealth()
/ 0.75f);
event.getEntityLiving().setHealth(
event.getEntityLiving().getMaxHealth());
// TODO figure out potions
/*
event.getEntityLiving()
.addPotionEffect(new PotionEffect(
Potion.moveSpeed.id,
30, 1));
event.getEntityLiving()
.addPotionEffect(new PotionEffect(
Potion.resistance.id,
20, 1));
event.getEntityLiving()
.addPotionEffect(new PotionEffect(
Potion.damageBoost.id,
20, 1));
*/
return 0;
}
return damageMultiplier;
}
}
|