Fixexd bug with poison killing players. Possibly fixed bug with double

death messages relating to poison.
This commit is contained in:
sigonasr2 2016-12-13 18:45:21 -06:00
parent f1cc45e9e5
commit cee9753b7f
2 changed files with 12 additions and 6 deletions

Binary file not shown.

View File

@ -1252,6 +1252,9 @@ public class CustomDamage {
GenericFunctions.updateNoDamageTickMap(target, damager); GenericFunctions.updateNoDamageTickMap(target, damager);
return true; return true;
} }
if (LowEnoughToResistPoison(target,reason)) {
return true;
}
if (isFlagSet(flags,IGNOREDODGE) || !PassesIframeCheck(target,damager)) { if (isFlagSet(flags,IGNOREDODGE) || !PassesIframeCheck(target,damager)) {
@ -1287,6 +1290,15 @@ public class CustomDamage {
return true; return true;
} }
private static boolean LowEnoughToResistPoison(LivingEntity target, String reason) {
TwosideKeeper.log("Target health: "+target.getHealth(), 5);
if (reason!=null && reason.equalsIgnoreCase("POISON") && target.getHealth()<=2) {
return true;
} else {
return false;
}
}
public static boolean CanResistExplosionsWithExperienceSet(Entity damager, LivingEntity target, String reason) { public static boolean CanResistExplosionsWithExperienceSet(Entity damager, LivingEntity target, String reason) {
return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 2) && return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 2) &&
((reason!=null && (reason.equalsIgnoreCase("explosion") || reason.equalsIgnoreCase("entity_explosion"))) ((reason!=null && (reason.equalsIgnoreCase("explosion") || reason.equalsIgnoreCase("entity_explosion")))
@ -2466,12 +2478,6 @@ public class CustomDamage {
if (damage<0) { if (damage<0) {
damage=0; damage=0;
} }
if (reason.equalsIgnoreCase("POISON")) {
if (damage>=target.getHealth()) {
damage=0;
target.setHealth(Math.min(target.getHealth(),1));
}
}
return Math.min(damage, TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER-1); return Math.min(damage, TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER-1);
} }