use of main.entity.Ref in project Eidolons by IDemiurge.
the class DC_EffectManager method checkNotResisted.
@Override
public boolean checkNotResisted(Effect effect) {
if (effect.isIrresistible()) {
return true;
}
if (!checkEffectType(effect)) {
return true;
}
Ref ref = effect.getRef();
try {
if (!checkTargeting(effect)) {
return true;
}
if (effect instanceof ReducedEffect) {
DC_ActiveObj spell = (DC_ActiveObj) ref.getActive();
if (spell == null) {
return true;
}
if (spell.getResistanceType() != SpellEnums.RESISTANCE_TYPE.IRRESISTIBLE) {
if (spell.getResistanceType() != SpellEnums.RESISTANCE_TYPE.CHANCE_TO_BLOCK) {
int mod = ResistanceRule.getResistanceMod(ref);
((ReducedEffect) effect).setResistanceMod(mod);
return true;
}
}
}
if (checkResistanceAlreadyChecked(effect)) {
return true;
}
return ResistanceRule.checkNotResisted(ref);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
return true;
}
}
use of main.entity.Ref 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 main.entity.Ref in project Eidolons by IDemiurge.
the class ForceRule method isForceEnabled.
private static boolean isForceEnabled(DC_ActiveObj action) {
if (action.isAttackAny()) {
return true;
}
if (action.isSpell()) {
Ref ref = action.getRef();
// TODO won't be initialized here yet!!!
DC_SpellObj spell = (DC_SpellObj) action;
if (spell.isDamageSpell()) {
if (spell.isMissile()) {
if (spell.getResistanceType() == RESISTANCE_TYPE.REDUCE_DAMAGE) {
if (!DamageCalculator.isPeriodic(ref)) {
if (!ref.isTriggered()) {
return true;
}
}
}
}
}
}
return false;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class ForceRule method applyDamage.
public static void applyDamage(int force, DC_ActiveObj attack, BattleFieldObject source, BattleFieldObject target) {
int damage = getDamage(force, target, target, target);
// attack.modifyParameter(PARAMS.BASE_DAMAGE, damage);
// if (target.getShield()!=null )
Ref ref = attack.getRef().getCopy();
ref.setTarget(target.getId());
new DealDamageEffect(new Formula(damage + ""), GenericEnums.DAMAGE_TYPE.BLUDGEONING).apply(ref);
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class ForceRule method getDamageObject.
public static Damage getDamageObject(DC_ActiveObj action, BattleFieldObject attacker, BattleFieldObject attacked) {
int amount = getDamage(action, attacker, attacked);
if (amount <= 0) {
return null;
}
DAMAGE_TYPE type = getForceDamageType(action);
return DamageFactory.getGenericDamage(type, amount, new Ref(attacker, attacked));
}
Aggregations