use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class ActivesConstructor method setAnimForEffects.
public static void setAnimForEffects(DC_ActiveObj entity) {
List<ActiveObj> list = new ArrayList<>(entity.getActives());
for (Active active : list) {
for (Ability abil : ((AbilityObj) active).getAbilities().getAbils()) {
for (Effect effect : abil.getEffects().getEffects()) {
if (effect instanceof EffectImpl) {
EffectImpl effect2 = (EffectImpl) effect;
effect2.setAnimationActive(entity);
}
}
}
}
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class SneakCondition method checkSneak.
public boolean checkSneak(Ref ref) {
if (!(ref.getObj(key) instanceof Unit)) {
return false;
}
Unit attacked = (Unit) ref.getObj(key);
if (attacked.isBfObj()) {
return false;
}
if (attacked.checkPassive(UnitEnums.STANDARD_PASSIVES.SNEAK_IMMUNE)) {
return false;
}
if (attacked.checkStatus(UnitEnums.STATUS.IMMOBILE)) {
return true;
}
if (attacked.checkStatus(UnitEnums.STATUS.CHARMED)) {
return true;
}
Unit attacker = (Unit) ref.getSourceObj();
DC_ActiveObj action = (DC_ActiveObj) ref.getObj(KEYS.ACTIVE);
if (!attacker.checkInSightForUnit(attacked)) {
if (// TODO wake up?
attacked.getMode().equals(STD_MODES.ALERT)) {
return false;
}
if (!action.isRanged()) {
if (attacker.getActivePlayerVisionStatus() == PLAYER_VISION.UNKNOWN || !VisionManager.checkVisible(attacker)) {
return true;
} else {
// TODO allow sneak in front for specialists
return FacingMaster.getSingleFacing(attacked, attacker) == UnitEnums.FACING_SINGLE.BEHIND;
}
}
}
return false;
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class DC_EffectManager method checkResistanceAlreadyChecked.
private boolean checkResistanceAlreadyChecked(Effect effect) {
try {
DC_ActiveObj spell = (DC_ActiveObj) effect.getRef().getActive();
boolean resistanceChecked = spell.isResistanceChecked();
spell.setResistanceChecked(true);
return resistanceChecked;
} catch (Exception ignored) {
}
return false;
}
use of eidolons.entity.active.DC_ActiveObj 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 eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class ExtraAttacksRule method getCounterAttacks.
public static List<DC_ActiveObj> getCounterAttacks(DC_ActiveObj triggeringAction, Unit unit) {
List<DC_ActiveObj> list = new ArrayList<>();
if (unit.getActionMap().get(ActionEnums.ACTION_TYPE.STANDARD_ATTACK) == null) {
return list;
}
for (DC_UnitAction a : unit.getActionMap().get(ActionEnums.ACTION_TYPE.STANDARD_ATTACK)) {
// offhand?
if (a.isMelee() && !a.isAttackGeneric()) // auto-atk range?
{
list.add(a);
}
}
SortMaster.sortEntitiesByExpression(list, action -> FutureBuilder.precalculateDamage((DC_ActiveObj) action, triggeringAction.getOwnerObj(), true) * (action.getIntParam(PARAMS.COUNTER_MOD) + action.getIntParam(PARAMS.COUNTER_ATTACK_MOD)));
return list;
}
Aggregations