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())));
}
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())));
}
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);
}
}
}
}
}
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));
}
}
}
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));
}
}
}
Aggregations