blob: 3883f146542b282c8e07287c30e7f7f8167dba58 (
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
|
package fyresmodjam.blessings.standard;
import fyresmodjam.blessings.Blessing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent;
public class NinjaBlessing extends Blessing {
@Override
public String name() {
return "Ninja";
}
@Override
public String description() {
return "- Go invisible while sneaking\n- Attacks on enemies with full health deal 2x damage";
}
@Override
public void commonTick(ServerTickEvent stev, EntityPlayer player) {
if (player.isSneaking()) {
// TODO figure out potions
// PotionEffect e = player.getActivePotionEffect(
// Potion.invisibility);
// if (e == null || player.getActivePotionEffect(
// Potion.invisibility)
// .getDuration() < 10) {
// player.addPotionEffect(new PotionEffect(
// Potion.invisibility.id, 10,
// 1, false));
// }
}
}
@Override
public float onOutgoingDamage(LivingHurtEvent event,
float damageMultiplier) {
boolean atMaxHealth = event.getEntityLiving()
.getHealth() == event.getEntityLiving()
.getMaxHealth();
if (event.getEntityLiving() != null
&& event.getSource().getTrueSource()
.isSneaking()
&& atMaxHealth) {
return damageMultiplier + 1.0F;
}
return damageMultiplier;
}
}
|