Search in sources :

Example 11 with ActiveObj

use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.

the class DC_GameManager method checkSelectedObj.

private void checkSelectedObj(Obj obj) {
    boolean selectionObj = selectingSet.contains(obj);
    if (!selectionObj) {
        if (C_OBJ_TYPE.BF_OBJ.equals(obj.getOBJ_TYPE_ENUM())) {
            selectionObj = selectingSet.contains(getGame().getCellByCoordinate(obj.getCoordinates()));
        }
    }
    if (!selectionObj) {
        // if (MessageManager.confirm(CANCEL_SELECTING)) {
        ActiveObj activatingAction = getActivatingAction();
        if (activatingAction != null) {
            activatingAction.playCancelSound();
        }
        selectingStopped(true);
        return;
    }
    DC_SoundMaster.playStandardSound(STD_SOUNDS.CLICK_TARGET_SELECTED);
    try {
        selectingStopped(false);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    } finally {
        WaitMaster.receiveInput(WAIT_OPERATIONS.SELECT_BF_OBJ, obj.getId());
    }
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ActiveObj(main.entity.obj.ActiveObj)

Example 12 with ActiveObj

use of main.entity.obj.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 13 with ActiveObj

use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.

the class TargetingMaster method findTargeting.

public static Targeting findTargeting(ActiveObj active, Class<SelectiveTargeting> CLASS) {
    Targeting t = active.getTargeting();
    if (checkTargeting(CLASS, t)) {
        return t;
    }
    t = findTargetingInAbils(active, CLASS);
    if (t != null) {
        return t;
    }
    for (ActiveObj a : active.getActives()) {
        if (// 2 layers maximum, i hope
        active instanceof DC_ActiveObj) {
            t = findTargeting(a, CLASS);
        }
        if (t != null) {
            return t;
        } else {
            for (ActiveObj a2 : a.getActives()) {
                t = findTargetingInAbils(a2, CLASS);
                if (t != null) {
                    return t;
                }
            }
        }
    }
    return null;
}
Also used : ActiveObj(main.entity.obj.ActiveObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Targeting(main.elements.targeting.Targeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 14 with ActiveObj

use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.

the class DC_ActionManager method newAction.

@Override
public DC_UnitAction newAction(String typeName, Entity entity) {
    Map<String, ActiveObj> map = actionsCache.get(entity);
    if (map == null) {
        map = new HashMap<>();
        actionsCache.put(entity, map);
    }
    if (map.get(typeName) != null) {
        return (DC_UnitAction) map.get(typeName);
    }
    ActionType type = (ActionType) DataManager.getType(typeName, DC_TYPE.ACTIONS);
    if (type == null) {
        LogMaster.log(1, "no such active: " + typeName);
        return null;
    }
    Ref ref = Ref.getCopy(entity.getRef());
    return newAction(type, ref, entity.getOwner(), game);
}
Also used : Ref(main.entity.Ref) ActiveObj(main.entity.obj.ActiveObj) ActionType(main.entity.type.ActionType)

Example 15 with ActiveObj

use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.

the class DC_ActionManager method resetActions.

@Override
public void resetActions(Entity entity) {
    if (!(entity instanceof Unit)) {
        return;
    }
    Unit unit = (Unit) entity;
    DequeImpl<ActiveObj> actives;
    // #1: reset prop with ids if nothing is changed
    // if (ListMaster.isNotEmpty(actives) && entity.isActivesReady()) {
    // entity.setProperty(ACTIVES, StringMaster
    // .constructContainer(StringMaster.convertToIdList(actives)));
    // return;
    // }
    actives = new DequeImpl<>();
    // #2: reset the list if prop has been modified (via Add/Remove effects
    // ++ items). They should set ActivesReady to false for that.
    // or upon init
    unit.setActionMap(new HashMap<>());
    // if (!unit.isStandardActionsAdded())
    if (!unit.isBfObj()) {
        actives.addAll(getStandardActions(unit));
    }
    String activesProp = entity.getProperty(ACTIVES);
    for (String typeName : StringMaster.open(activesProp)) {
        ObjType type = DataManager.getType(typeName, DC_TYPE.ACTIONS);
        DC_UnitAction action;
        if (type == null) {
            try {
                action = (DC_UnitAction) game.getObjectById(Integer.valueOf(typeName));
            } catch (Exception e) {
                continue;
            }
        } else {
            action = getOrCreateAction(typeName, entity);
        }
        // idList.add(action.getId() + "");
        actives.add(action);
    }
    // list = new DequeImpl<>(items);
    actives.removeIf(activeObj -> !isActionAvailable(activeObj, ExplorationMaster.isExplorationOn()));
    try {
        addSpecialActions(unit, actives);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    if (ExplorationMaster.isExplorationOn())
        try {
            actives.removeIf(activeObj -> unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().isActivationDisabledByExploration((DC_ActiveObj) activeObj));
            List<DC_ActiveObj> actions = unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().getExplorationActions(unit);
            actives.addAll(actions);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    unit.setActives(new ArrayList<>(actives));
    if (!unit.isBfObj()) {
        addHiddenActions(unit, unit.getActives());
    }
    try {
        constructActionMaps(unit);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    // entity.setProperty(ACTIVES, StringMaster
    // .constructContainer(StringMaster.convertToIdList(actives)));
    entity.setActivesReady(true);
    for (ActiveObj a : actives) {
        if (activesProp.contains(a.getName())) {
            activesProp += a.getName() + ";";
        }
    }
    entity.setProperty(ACTIVES, activesProp);
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Active(main.entity.obj.Active) Trap(eidolons.game.module.dungeoncrawl.objects.Trap) ActionManager(main.game.logic.generic.ActionManager) Entrance(eidolons.game.module.dungeoncrawl.dungeon.Entrance) ActionEnums(main.content.enums.entity.ActionEnums) Ref(main.entity.Ref) VariableManager(main.data.ability.construct.VariableManager) ExtraAttacksRule(eidolons.game.battlecraft.rules.combat.attack.extra_attack.ExtraAttacksRule) ACTION_TYPE(main.content.enums.entity.ActionEnums.ACTION_TYPE) Player(main.game.logic.battle.player.Player) Weaver(main.system.threading.Weaver) DC_TYPE(main.content.DC_TYPE) GenericEnums(main.content.enums.GenericEnums) DungeonLevelMaster(eidolons.game.module.dungeoncrawl.dungeon.DungeonLevelMaster) ItemEnums(main.content.enums.entity.ItemEnums) ContentManager(main.content.ContentManager) DC_Game(eidolons.game.core.game.DC_Game) ExplorationMaster(eidolons.game.module.dungeoncrawl.explore.ExplorationMaster) ActionType(main.entity.type.ActionType) PARAMETER(main.content.values.parameters.PARAMETER) UnitAnalyzer(eidolons.game.battlecraft.rules.UnitAnalyzer) DualAttackMaster(eidolons.game.battlecraft.rules.combat.attack.dual.DualAttackMaster) java.util(java.util) ActiveObj(main.entity.obj.ActiveObj) MicroGame(main.game.core.game.MicroGame) DequeImpl(main.system.datatypes.DequeImpl) PARAMS(eidolons.content.PARAMS) StringMaster(main.system.auxiliary.StringMaster) DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) STD_ACTION_MODES(main.content.CONTENT_CONSTS2.STD_ACTION_MODES) FleeRule(eidolons.game.battlecraft.rules.mechanics.FleeRule) FEATURE(eidolons.game.battlecraft.rules.RuleMaster.FEATURE) G_PROPS(main.content.values.properties.G_PROPS) ActionGenerator(eidolons.ability.ActionGenerator) LogMaster(main.system.auxiliary.log.LogMaster) ObjType(main.entity.type.ObjType) ListMaster(main.system.auxiliary.data.ListMaster) PROPS(eidolons.content.PROPS) Obj(main.entity.obj.Obj) KEYS(main.entity.Ref.KEYS) TrapMaster(eidolons.game.module.dungeoncrawl.objects.TrapMaster) Entity(main.entity.Entity) ACTION_TYPE_GROUPS(main.content.enums.entity.ActionEnums.ACTION_TYPE_GROUPS) DataManager(main.data.DataManager) RuleMaster(eidolons.game.battlecraft.rules.RuleMaster) Unit(eidolons.entity.obj.unit.Unit) UnitEnums(main.content.enums.entity.UnitEnums) EnumMaster(main.system.auxiliary.EnumMaster) ActiveObj(main.entity.obj.ActiveObj) ObjType(main.entity.type.ObjType) Unit(eidolons.entity.obj.unit.Unit)

Aggregations

ActiveObj (main.entity.obj.ActiveObj)18 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)7 ArrayList (java.util.ArrayList)4 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)4 Unit (eidolons.entity.obj.unit.Unit)3 Targeting (main.elements.targeting.Targeting)3 Ref (main.entity.Ref)3 Active (main.entity.obj.Active)3 DC_Effect (eidolons.ability.effects.DC_Effect)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 RayEffect (eidolons.ability.effects.containers.customtarget.RayEffect)2 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)2 ZoneEffect (eidolons.ability.effects.containers.customtarget.ZoneEffect)2 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)2 TemplateAutoTargeting (eidolons.ability.targeting.TemplateAutoTargeting)2 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)2 STD_ACTION_MODES (main.content.CONTENT_CONSTS2.STD_ACTION_MODES)2 FixedTargeting (main.elements.targeting.FixedTargeting)2 ActionType (main.entity.type.ActionType)2 ActionGenerator (eidolons.ability.ActionGenerator)1