From a12875f304fdfa07eecc4f7bbad3baaa9124e51d Mon Sep 17 00:00:00 2001 From: Ammon Lauritzen Date: Tue, 23 Feb 2016 16:20:40 -0600 Subject: [PATCH] Looking over effects of difficulty settings --- src/main/java/fairies/entity/EntityFairy.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/java/fairies/entity/EntityFairy.java b/src/main/java/fairies/entity/EntityFairy.java index ba4051c..22763d8 100644 --- a/src/main/java/fairies/entity/EntityFairy.java +++ b/src/main/java/fairies/entity/EntityFairy.java @@ -696,7 +696,8 @@ public class EntityFairy extends EntityAnimal { } } - if (worldObj.difficultySetting.getDifficultyId() <= 0 + // fairies run away from players in peaceful + if (worldObj.difficultySetting == EnumDifficulty.PEACEFUL && entityToAttack != null && entityToAttack instanceof EntityPlayer) { setEntityFear(entityToAttack); @@ -2410,6 +2411,7 @@ public class EntityFairy extends EntityAnimal { } } } else { + // faction members can be tamed in peaceful if (( getFaction() == 0 || worldObj.difficultySetting == EnumDifficulty.PEACEFUL ) && !( ( queen() || posted() ) && tamed() ) && !crying() @@ -2908,15 +2910,6 @@ public class EntityFairy extends EntityAnimal { } public void applyPoison(EntityLiving entityliving) { - int effect = rand.nextInt(3); - if (effect == 0) { - effect = Potion.poison.id; - } else if (effect == 1) { - effect = Potion.weakness.id; - } else { - effect = Potion.blindness.id; - } - byte duration = 0; switch (worldObj.difficultySetting) { case NORMAL: @@ -2925,12 +2918,23 @@ public class EntityFairy extends EntityAnimal { case HARD: duration = 15; break; + case PEACEFUL: + case EASY: default: + // no poison in peaceful or normal + return; } - if (duration > 0) { - ( entityliving ).addPotionEffect( - new PotionEffect(effect, duration * 20, 0)); + + int effect = rand.nextInt(3); + if (effect == 0) { + effect = Potion.poison.id; + } else if (effect == 1) { + effect = Potion.weakness.id; + } else { + effect = Potion.blindness.id; } + + entityliving.addPotionEffect(new PotionEffect(effect, duration * 20, 0)); healTime = 100 + rand.nextInt(100); setTarget((Entity) null);