use of de.Keyle.MyPet.api.skill.skills.HealInfo in project MyPet by xXKeyleXx.
the class Heal method upgrade.
public void upgrade(SkillInfo upgrade, boolean quiet) {
if (upgrade instanceof HealInfo) {
boolean valuesEdit = false;
if (upgrade.getProperties().getCompoundData().containsKey("hp")) {
int hp = upgrade.getProperties().getAs("hp", TagInt.class).getIntData();
upgrade.getProperties().getCompoundData().remove("hp");
TagDouble TagDouble = new TagDouble(hp);
upgrade.getProperties().getCompoundData().put("hp_double", TagDouble);
}
if (upgrade.getProperties().getCompoundData().containsKey("hp_double")) {
if (!upgrade.getProperties().getCompoundData().containsKey("addset_hp") || upgrade.getProperties().getAs("addset_hp", TagString.class).getStringData().equals("add")) {
increaseHpBy += upgrade.getProperties().getAs("hp_double", TagDouble.class).getDoubleData();
} else {
increaseHpBy = upgrade.getProperties().getAs("hp_double", TagDouble.class).getDoubleData();
}
valuesEdit = true;
}
if (upgrade.getProperties().getCompoundData().containsKey("time")) {
if (!upgrade.getProperties().getCompoundData().containsKey("addset_time") || upgrade.getProperties().getAs("addset_time", TagString.class).getStringData().equals("add")) {
regenTime -= upgrade.getProperties().getAs("time", TagInt.class).getIntData();
} else {
regenTime = upgrade.getProperties().getAs("time", TagInt.class).getIntData();
}
if (regenTime < 1) {
regenTime = 1;
}
timeCounter = regenTime;
valuesEdit = true;
}
if (!quiet && valuesEdit) {
myPet.getOwner().sendMessage(Util.formatText(Translation.getString("Message.Skill.HpRegeneration.Upgrade", myPet.getOwner().getLanguage()), myPet.getPetName(), increaseHpBy, regenTime));
}
}
}