use of de.Keyle.MyPet.api.skill.skills.LightningInfo 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));
}
}
}
Aggregations