use of eidolons.ability.effects.oneshot.rule.DurabilityReductionEffect in project Eidolons by IDemiurge.
the class DurabilityRule method physicalDamage.
public static int physicalDamage(int damage, int blocked, DAMAGE_TYPE damage_type, DC_HeroSlotItem armor, DC_WeaponObj weapon, boolean simulation) {
int self_damage_mod = armor.getIntParam(DC_ContentManager.getArmorSelfDamageParamForDmgType(damage_type));
if (!RuleMaster.isRuleOn(RULE.DURABILITY))
self_damage_mod = 0;
else if (self_damage_mod == 0)
self_damage_mod = 100;
// new EnumMaster<ENUM>().retrieveEnumConst(ENUM.class, )
MATERIAL m1 = armor.getMaterial();
MATERIAL m2 = weapon.getMaterial();
int armor_vs_weapon = m1.getHardness() - m2.getHardness();
int armor_amount = blocked * self_damage_mod / 100;
armor_amount = MathMaster.addFactor(armor_amount, armor_vs_weapon);
DurabilityReductionEffect durabilityReductionEffect = new DurabilityReductionEffect(false, armor_amount);
durabilityReductionEffect.setSimulation(simulation);
Ref ref = Ref.getSelfTargetingRefCopy(armor);
ref.setID(KEYS.WEAPON, weapon.getId());
if (armor_amount > 0)
durabilityReductionEffect.apply(ref);
self_damage_mod = weapon.getIntParam(DC_ContentManager.getArmorSelfDamageParamForDmgType(damage_type));
int weapon_amount = blocked * self_damage_mod / 100;
weapon_amount = MathMaster.addFactor(weapon_amount, armor_vs_weapon);
durabilityReductionEffect = new DurabilityReductionEffect(true, weapon_amount);
durabilityReductionEffect.setSimulation(simulation);
durabilityReductionEffect.apply(Ref.getSelfTargetingRefCopy(weapon));
return durabilityReductionEffect.getDurabilityLost();
}
use of eidolons.ability.effects.oneshot.rule.DurabilityReductionEffect in project Eidolons by IDemiurge.
the class DurabilityRule method getAttackItemDurabilityReductionEffects.
public static Effects getAttackItemDurabilityReductionEffects(int amount) {
String source_ref = "{EVENT_SOURCE}";
String target_ref = "{EVENT_TARGET}";
return new Effects(new ConditionalEffect(new OrConditions(new ItemCondition(source_ref, ItemEnums.ITEM_SLOT.MAIN_HAND.getProp().getName()), new ItemCondition(source_ref, ItemEnums.ITEM_SLOT.OFF_HAND.getProp().getName())), new DurabilityReductionEffect(true, amount)), new ConditionalEffect(new ItemCondition(target_ref, ItemEnums.ITEM_SLOT.ARMOR.getProp().getName()), new DurabilityReductionEffect(false, amount)));
}
use of eidolons.ability.effects.oneshot.rule.DurabilityReductionEffect in project Eidolons by IDemiurge.
the class DurabilityRule method spellDamage.
public static int spellDamage(int damage, int blocked, DAMAGE_TYPE damage_type, DC_HeroSlotItem armor, boolean simulation) {
int self_damage_mod = armor.getIntParam(DC_ContentManager.getArmorSelfDamageParamForDmgType(damage_type));
// special cases may apply for Damage
int amount = blocked * self_damage_mod / 100;
DurabilityReductionEffect durabilityReductionEffect = new DurabilityReductionEffect(null, amount);
durabilityReductionEffect.setSimulation(simulation);
durabilityReductionEffect.apply(Ref.getSelfTargetingRefCopy(armor));
return durabilityReductionEffect.getDurabilityLost();
}
Aggregations