use of de.Keyle.MyPet.api.skill.skills.DamageInfo in project MyPet by xXKeyleXx.
the class Damage method upgrade.
public void upgrade(SkillInfo upgrade, boolean quiet) {
if (upgrade instanceof DamageInfo) {
boolean isPassive = damage <= 0;
if (upgrade.getProperties().getCompoundData().containsKey("damage")) {
int damage = upgrade.getProperties().getAs("damage", TagInt.class).getIntData();
upgrade.getProperties().getCompoundData().remove("damage");
TagDouble TagDouble = new TagDouble(damage);
upgrade.getProperties().getCompoundData().put("damage_double", TagDouble);
}
if (upgrade.getProperties().getCompoundData().containsKey("damage_double")) {
if (!upgrade.getProperties().getCompoundData().containsKey("addset_damage") || upgrade.getProperties().getAs("addset_damage", TagString.class).getStringData().equals("add")) {
damage += upgrade.getProperties().getAs("damage_double", TagDouble.class).getDoubleData();
} else {
damage = upgrade.getProperties().getAs("damage_double", TagDouble.class).getDoubleData();
}
if (!quiet) {
myPet.getOwner().sendMessage(Util.formatText(Translation.getString("Message.Skill.Damage.Upgrade", myPet.getOwner().getLanguage()), myPet.getPetName(), damage));
}
}
if (isPassive != (damage <= 0)) {
if (myPet.getStatus() == PetState.Here) {
getMyPet().getEntity().get().getHandle().getPathfinder().clearGoals();
getMyPet().getEntity().get().getHandle().getTargetSelector().clearGoals();
getMyPet().getEntity().get().getHandle().setPathfinder();
if (damage == 0) {
getMyPet().getEntity().get().setTarget(null);
}
}
}
}
}
Aggregations