Search in sources :

Example 1 with ENTRY_TYPE

use of main.system.text.EntryNodeMaster.ENTRY_TYPE in project Eidolons by IDemiurge.

the class DC_AttackMaster method attack.

private Boolean attack(Attack attack, Ref ref, boolean free, boolean canCounter, Effect onHit, Effect onKill, boolean offhand, boolean counter) {
    ENTRY_TYPE type = ENTRY_TYPE.ATTACK;
    boolean extraAttack = true;
    if (attack.getAction().isCounterMode()) {
        type = ENTRY_TYPE.COUNTER_ATTACK;
    } else if (attack.getAction().isInstantMode()) {
        type = ENTRY_TYPE.INSTANT_ATTACK;
    } else if (attack.getAction().isAttackOfOpportunityMode()) {
        type = ENTRY_TYPE.ATTACK_OF_OPPORTUNITY;
    } else {
        extraAttack = false;
    }
    // LogEntryNode entry = game.getLogManager().newLogEntryNode(type,
    // attack.getAttacker().getName(), attack.getAttackedUnit().getName(), attack.getAction());
    Boolean result = null;
    if (!extraAttack) {
        Unit guard = (Unit) GuardRule.checkTargetChanged(attack.getAction());
        if (guard != null) {
            game.getLogManager().log(guard.getNameIfKnown() + " intercepts " + attack.toLogString());
            ref.setTarget(guard.getId());
            attack.setRef(ref);
            attack.setAttacked(guard);
        }
    }
    attack.setSneak(SneakRule.checkSneak(ref));
    try {
        main.system.auxiliary.log.LogMaster.log(1, attack.getAttacker() + " attacks " + attack.getAttacked() + " with " + attack.getAction());
        result = attackNow(attack, ref, free, canCounter, onHit, onKill, offhand, counter);
        boolean countered = false;
        if (result == null) {
            // first strike
            main.system.auxiliary.log.LogMaster.log(1, "Counter attack with first strike against " + attack.getAction());
            ActiveObj action = counterRule.tryCounter(attack, false);
            if (action != null) {
                AttackEffect effect = EffectMaster.getAttackEffect(action);
                waitForAttackAnimation(effect.getAttack());
            }
            attackNow(attack, ref, free, false, onHit, onKill, offhand, counter);
            countered = true;
            result = true;
        }
        if ((!countered) || attack.getAttacker().hasDoubleCounter()) {
            if (canCounter) {
                if (!counter) {
                    counterRule.tryCounter(attack);
                }
            }
        }
    } catch (Exception e) {
        result = false;
        main.system.ExceptionMaster.printStackTrace(e);
    } finally {
        if (!extraAttack) {
            game.getLogManager().doneLogEntryNode(ENTRY_TYPE.ACTION);
        }
        game.getLogManager().doneLogEntryNode(type);
    }
    return result;
}
Also used : ActiveObj(main.entity.obj.ActiveObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) AttackEffect(eidolons.ability.effects.oneshot.attack.AttackEffect) Unit(eidolons.entity.obj.unit.Unit) ENTRY_TYPE(main.system.text.EntryNodeMaster.ENTRY_TYPE)

Example 2 with ENTRY_TYPE

use of main.system.text.EntryNodeMaster.ENTRY_TYPE in project Eidolons by IDemiurge.

the class ActiveLogger method log.

public ENTRY_TYPE log() {
    // TODO *player's* detection, not AI's!
    String string = getOwnerObj().getNameIfKnown() + " is activating " + getEntity().getDisplayedName();
    LogMaster.gameInfo(StringMaster.getStringXTimes(80 - string.length(), ">") + string);
    boolean logAction = getOwnerObj().getVisibilityLevel() == VISIBILITY_LEVEL.CLEAR_SIGHT && !getMaster().getChecker().isAttackAny();
    entry = null;
    ENTRY_TYPE entryType = ENTRY_TYPE.ACTION;
    if (getMaster().getChecker().getActionGroup() == ActionEnums.ACTION_TYPE_GROUPS.MOVE) {
        entryType = ENTRY_TYPE.MOVE;
        logAction = true;
    }
    if (!getMaster().getChecker().isAttackAny()) {
        entry = game.getLogManager().newLogEntryNode(entryType, getOwnerObj(), this);
    }
    if (logAction) {
        game.getLogManager().log(">> " + string);
    } else if (VisionManager.checkVisible(getOwnerObj(), false) && !getMaster().getChecker().isAttackAny()) {
        String text = " performs an action... ";
        game.getLogManager().log(">> " + getOwnerObj().getNameIfKnown() + text);
    }
    return entryType;
}
Also used : ENTRY_TYPE(main.system.text.EntryNodeMaster.ENTRY_TYPE)

Aggregations

ENTRY_TYPE (main.system.text.EntryNodeMaster.ENTRY_TYPE)2 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 Unit (eidolons.entity.obj.unit.Unit)1 ActiveObj (main.entity.obj.ActiveObj)1