Search in sources :

Example 6 with TagDouble

use of de.keyle.knbt.TagDouble in project MyPet by xXKeyleXx.

the class Ranged method save.

@Override
public void save(TagCompound tagCompound) {
    tagCompound.getCompoundData().put("projectile", new TagString(((String) projectileComboBox.getSelectedItem()).replace(" ", "")));
    tagCompound.getCompoundData().put("addset_damage", new TagString(addDamageRadioButton.isSelected() ? "add" : "set"));
    tagCompound.getCompoundData().put("damage_double", new TagDouble(Double.parseDouble(damageInput.getText())));
    tagCompound.getCompoundData().put("addset_rateoffire", new TagString(addRateOfFireRadioButton.isSelected() ? "add" : "set"));
    tagCompound.getCompoundData().put("rateoffire", new TagInt(Integer.parseInt(rateOfFireInput.getText())));
}
Also used : TagInt(de.keyle.knbt.TagInt) TagString(de.keyle.knbt.TagString) TagString(de.keyle.knbt.TagString) TagDouble(de.keyle.knbt.TagDouble)

Example 7 with TagDouble

use of de.keyle.knbt.TagDouble in project MyPet by xXKeyleXx.

the class Stomp method save.

@Override
public void save(TagCompound tagCompound) {
    tagCompound.getCompoundData().put("addset_chance", new TagString(addChanceRadioButton.isSelected() ? "add" : "set"));
    tagCompound.getCompoundData().put("chance", new TagInt(Integer.parseInt(chanceInput.getText())));
    tagCompound.getCompoundData().put("addset_damage", new TagString(addDamageRadioButton.isSelected() ? "add" : "set"));
    tagCompound.getCompoundData().put("damage", new TagDouble(Double.parseDouble(damageInput.getText())));
}
Also used : TagInt(de.keyle.knbt.TagInt) TagString(de.keyle.knbt.TagString) TagDouble(de.keyle.knbt.TagDouble)

Example 8 with TagDouble

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

Example 9 with TagDouble

use of de.keyle.knbt.TagDouble in project MyPet by xXKeyleXx.

the class Lightning method upgrade.

public void upgrade(SkillInfo upgrade, boolean quiet) {
    if (upgrade instanceof LightningInfo) {
        boolean valuesEdit = false;
        if (upgrade.getProperties().getCompoundData().containsKey("chance")) {
            if (!upgrade.getProperties().getCompoundData().containsKey("addset_chance") || upgrade.getProperties().getAs("addset_chance", TagString.class).getStringData().equals("add")) {
                chance += upgrade.getProperties().getAs("chance", TagInt.class).getIntData();
            } else {
                chance = upgrade.getProperties().getAs("chance", TagInt.class).getIntData();
            }
            valuesEdit = true;
        }
        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();
            }
            valuesEdit = true;
        }
        chance = Math.min(chance, 100);
        if (!quiet && valuesEdit) {
            myPet.getOwner().sendMessage(Util.formatText(Translation.getString("Message.Skill.Lightning.Upgrade", myPet.getOwner().getLanguage()), myPet.getPetName(), chance, damage));
        }
    }
}
Also used : TagInt(de.keyle.knbt.TagInt) LightningInfo(de.Keyle.MyPet.api.skill.skills.LightningInfo) TagString(de.keyle.knbt.TagString) TagDouble(de.keyle.knbt.TagDouble)

Example 10 with TagDouble

use of de.keyle.knbt.TagDouble 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

TagDouble (de.keyle.knbt.TagDouble)17 TagString (de.keyle.knbt.TagString)17 TagInt (de.keyle.knbt.TagInt)14 DamageInfo (de.Keyle.MyPet.api.skill.skills.DamageInfo)1 HealInfo (de.Keyle.MyPet.api.skill.skills.HealInfo)1 LifeInfo (de.Keyle.MyPet.api.skill.skills.LifeInfo)1 LightningInfo (de.Keyle.MyPet.api.skill.skills.LightningInfo)1 RangedInfo (de.Keyle.MyPet.api.skill.skills.RangedInfo)1 TagByte (de.keyle.knbt.TagByte)1