Search in sources :

Example 41 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class CostCondition method check.

@Override
public boolean check(Ref ref) {
    Unit hero = (Unit) ref.getTargetObj();
    DC_ActiveObj action;
    if (spell) {
        action = hero.getSpell(actionName);
    } else {
        action = hero.getAction(actionName);
    }
    if (action == null) {
        return false;
    }
    boolean canBeActivated = action.canBeActivated(ref, true);
    if (!canBeActivated) {
        return false;
    }
    return canBeActivated;
}
Also used : Unit(eidolons.entity.obj.unit.Unit) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 42 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class SpellRadialManager method createNodeBranch.

private static RadialValueContainer createNodeBranch(RADIAL_ITEM object, Unit source, DC_Obj target) {
    RadialValueContainer valueContainer;
    if (object instanceof EntityNode) {
        final DC_ActiveObj action = (DC_ActiveObj) object.getContents();
        valueContainer = RadialManager.configureActionNode(target, action);
        ActionCostTooltip tooltip = new ActionCostTooltip(action);
        tooltip.setRadial(true);
        tooltip.setUserObject(new ActionCostSourceImpl(action));
        valueContainer.addListener(tooltip.getController());
    } else {
        valueContainer = new SpellRadialContainer(TextureCache.getOrCreateSizedRegion(UiMaster.getIconSize(), object.getTexturePath()), null);
        valueContainer.setChildNodes(object.getItems(source).stream().map(el -> createNodeBranch(el, source, target)).collect(Collectors.toList()));
        String tooltip = StringMaster.getWellFormattedString(object.getContents().toString());
        addSimpleTooltip(valueContainer, tooltip);
    }
    return valueContainer;
}
Also used : ActionCostTooltip(eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ActionCostSourceImpl(eidolons.libgdx.gui.panels.dc.actionpanel.datasource.ActionCostSourceImpl)

Example 43 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ActivesConstructor method constructActive.

public static void constructActive(TARGETING_MODE mode, DC_ActiveObj entity) {
    if (mode == AbilityEnums.TARGETING_MODE.MULTI) {
        addMultiTargetingMods(entity);
        return;
    }
    if (entity.checkBool(GenericEnums.STD_BOOLS.MULTI_TARGETING)) {
        // constructMultiAbilities(entity);
        return;
    }
    if (entity.getActives() == null) {
        return;
    }
    List<ActiveObj> list = new ArrayList<>(entity.getActives());
    Effects effects = new Effects();
    for (Active active : list) {
        for (Ability abil : ((AbilityObj) active).getAbilities().getAbils()) {
            for (Effect effect : abil.getEffects().getEffects()) {
                // anything?
                if (effect instanceof DC_Effect) {
                    DC_Effect effect2 = (DC_Effect) effect;
                    effect2.setAnimationActive(entity);
                }
                effects.add(effect);
            }
        }
    }
    // TODO what if the effects should have different targetings like in
    // damage+light?
    String saveRoll = entity.getProperty(PROPS.ROLL_TYPES_TO_SAVE);
    if (!StringMaster.isEmpty(saveRoll)) {
        wrapInSaveRollEffect(effects, saveRoll);
    }
    String wrap = entity.getProperty(PROPS.EFFECTS_WRAP);
    Effect wrappedEffect;
    if (StringMaster.isEmpty(wrap)) {
        wrappedEffect = wrapEffects(mode, effects, entity);
    } else {
        EFFECTS_WRAP WRAP = new EnumMaster<EFFECTS_WRAP>().retrieveEnumConst(EFFECTS_WRAP.class, wrap);
        wrappedEffect = wrapEffects(WRAP, effects, entity);
    }
    Targeting targeting = getTargeting(mode, entity);
    if (targeting == null) {
        try {
            targeting = entity.getActives().get(0).getActives().get(0).getTargeting();
        } catch (Exception e) {
        // targeting = getDefaultSingleTargeting(entity);TODO necessary?
        }
    }
    if (targeting != null)
        entity.setTargeting(targeting);
    Abilities abilities = new Abilities();
    abilities.add(new ActiveAbility(null, wrappedEffect));
    entity.setAbilities(abilities);
// TODO wrapping in RollEffect - each single effect or the resulting
// wrapped Effects?
}
Also used : FixedTargeting(main.elements.targeting.FixedTargeting) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Targeting(main.elements.targeting.Targeting) MultiTargeting(main.elements.targeting.MultiTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) DC_Effect(eidolons.ability.effects.DC_Effect) ArrayList(java.util.ArrayList) Effects(main.ability.effects.Effects) Active(main.entity.obj.Active) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ActiveObj(main.entity.obj.ActiveObj) EFFECTS_WRAP(main.content.enums.entity.AbilityEnums.EFFECTS_WRAP) DC_Effect(eidolons.ability.effects.DC_Effect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) Effect(main.ability.effects.Effect) RayEffect(eidolons.ability.effects.containers.customtarget.RayEffect) WaveEffect(eidolons.ability.effects.containers.customtarget.WaveEffect) ZoneEffect(eidolons.ability.effects.containers.customtarget.ZoneEffect)

Example 44 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class AttackEffect method applyThis.

@Override
public boolean applyThis() {
    // new Attack(target, source).execute(effects); => to State's history!
    attack = null;
    Unit attacker = (Unit) ref.getSourceObj();
    DC_ActiveObj activeObj = (DC_ActiveObj) getActiveObj();
    if (!activeObj.isExtraAttackMode()) {
        if (!activeObj.isThrow()) {
            if (!activeObj.isRanged()) {
                LogMaster.log(1, "*** MELEE ATTACK BY " + activeObj.getOwnerObj().getNameAndCoordinate() + " on " + ref.getTargetObj().getNameAndCoordinate());
                if (PositionMaster.getDistance(activeObj.getOwnerObj(), ref.getTargetObj()) > 1) {
                    LogMaster.log(1, "*** RANGE BUG ");
                // AI_Manager.logFullInfo();
                }
            }
        }
    }
    if (!offhand) {
        if (StringMaster.compare(ref.getObj(KEYS.ACTIVE).getProperty(G_PROPS.ACTION_TAGS), ActionEnums.ACTION_TAGS.OFF_HAND + "")) {
            offhand = true;
        }
    }
    if (weapon != null) {
        ref.setID(KEYS.WEAPON, weapon.getId());
    } else if (ref.getSourceObj() instanceof Unit) {
        Integer id = null;
        try {
            id = (!offhand) ? attacker.getMainWeapon().getId() : attacker.getOffhandWeapon().getId();
        } catch (Exception ignored) {
        }
        if (id != null) {
            ref.setValue(KEYS.WEAPON, "" + id);
        }
    }
    getAttack().setDoubleStrike(attacker.hasDoubleStrike());
    try {
        return ((DC_Game) getGame()).getAttackMaster().attack(// UNIT_TAKES_DAMAGE
        getAttack());
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
        return false;
    }
// there
}
Also used : Unit(eidolons.entity.obj.unit.Unit) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 45 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class AutoAttackEffect method pickAttack.

private DC_ActiveObj pickAttack() {
    List<DC_ActiveObj> subActions = new ArrayList<>();
    for (DC_ActiveObj attack : getActiveObj().getSubActions()) {
        if (attack.canBeActivated(ref, true)) {
            if (attack.canBeTargeted(target)) {
                subActions.add(attack);
            }
        }
    }
    if (subActions.size() == 1) {
        return subActions.get(0);
    }
    if (!getGame().isOffline()) {
        if (!getUnit().isMine()) {
        // String name = WaitingThread.waitOrGetInput(HOST_CLIENT_CODES.CUSTOM_PICK);
        // return new ListMaster<DC_ActiveObj>().findType(name, subActions);
        }
    }
    if (getUnit().isAiControlled() || isPickAutomaticallyOn()) {
        return pickAutomatically(subActions);
    }
    DC_ActiveObj pick = null;
    if (manual)
        try {
            pick = pickManually(subActions);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    if (pick == null)
        pick = pickAutomatically(subActions);
    if (pick != null) {
        return pick;
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Aggregations

DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)73 Unit (eidolons.entity.obj.unit.Unit)22 ArrayList (java.util.ArrayList)17 Obj (main.entity.obj.Obj)15 DC_UnitAction (eidolons.entity.active.DC_UnitAction)12 DC_Obj (eidolons.entity.obj.DC_Obj)12 Ref (main.entity.Ref)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)7 ActiveObj (main.entity.obj.ActiveObj)7 Effect (main.ability.effects.Effect)5 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)5 Targeting (main.elements.targeting.Targeting)5 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)4 DC_SpellObj (eidolons.entity.active.DC_SpellObj)4 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)4 FixedTargeting (main.elements.targeting.FixedTargeting)4 Coordinates (main.game.bf.Coordinates)4 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)3 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)3