Search in sources :

Example 1 with HealInfo

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));
        }
    }
}
Also used : HealInfo(de.Keyle.MyPet.api.skill.skills.HealInfo) TagInt(de.keyle.knbt.TagInt) TagString(de.keyle.knbt.TagString) TagDouble(de.keyle.knbt.TagDouble)

Aggregations

HealInfo (de.Keyle.MyPet.api.skill.skills.HealInfo)1 TagDouble (de.keyle.knbt.TagDouble)1 TagInt (de.keyle.knbt.TagInt)1 TagString (de.keyle.knbt.TagString)1