Search in sources :

Example 61 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class EncounterMaster method getWaveSequence.

private static Map<Wave, Integer> getWaveSequence(Encounter e) {
    Map<Wave, Integer> waves = new XLinkedMap<>();
    int i = 0;
    for (String typeName : StringMaster.open(e.getTypeNames())) {
        ObjType waveType = DataManager.getType(typeName, DC_TYPE.ENCOUNTERS);
        Wave wave = new Wave(waveType, DC_Game.game, new Ref(), DC_Game.game.getPlayer(false));
        // TODO is the field ready for coordinates?
        wave.initUnitMap();
        int j = i;
        // + DC_Game.game.getBattleMaster().getBattleConstructor().getRoundsToFight(
        // waveType);
        Integer round = RandomWizard.getRandomIntBetween(i, j);
        i += round;
        waves.put(wave, round);
    }
    return waves;
}
Also used : Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref) MacroRef(eidolons.game.module.adventure.MacroRef) ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap)

Example 62 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class PatrolMaster method getWaitAction.

private static Action getWaitAction(Patrol patrol, UnitAI ai) {
    Unit unit = ai.getUnit();
    Unit blocker = getBlockingUnit(patrol, ai);
    if (blocker == null) {
        return null;
    }
    Ref ref = new Ref(unit);
    ref.setTarget(blocker.getId());
    new Action(ai.getUnit().getAction("Wait"), ref);
    return null;
}
Also used : Ref(main.entity.Ref) Action(eidolons.game.battlecraft.ai.elements.actions.Action) Unit(eidolons.entity.obj.unit.Unit)

Example 63 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class SimulationManager method createUnit.

public static void createUnit(ObjType type) {
    if (unitMap.containsKey(type)) {
        return;
    }
    Unit unit = new Unit(type, 0, 0, DC_Player.NEUTRAL, getGame(), new Ref(getGame()));
    getGame().getState().addObject(unit);
    try {
        resetUnit(unit);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    unitMap.put(type, unit);
}
Also used : Ref(main.entity.Ref) Unit(eidolons.entity.obj.unit.Unit)

Example 64 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class InterruptEffect method applyThis.

@Override
public boolean applyThis() {
    // }
    if (ref.getEvent() == null) {
        return false;
    }
    Ref REF = ref.getEvent().getRef();
    Interruptable i = REF.getEffect();
    // if (OBJ_REF != null) {
    i = (Interruptable) REF.getObj(KEYS.ACTIVE);
    // }
    if (i == null) {
        return false;
    }
    i.setInterrupted(true);
    return true;
}
Also used : Ref(main.entity.Ref) Interruptable(main.ability.Interruptable)

Example 65 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class EffectImpl method apply.

@Override
public boolean apply(Ref ref) {
    setRef(ref);
    // for logging
    boolean active = getLayer() != BUFF_RULE && ref.getObj(KEYS.ACTIVE) != null && (!(ref.getObj(KEYS.ABILITY) instanceof PassiveAbilityObj));
    if ((ref.getGroup() == null && targetGroup == null) || isIgnoreGroupTargeting()) {
        // single-target effect
        return apply();
    } else {
        // multi-target effect, applies to each target
        GroupImpl group = ref.getGroup();
        if (group == null) {
            group = targetGroup;
        } else if (targetGroup == null) {
            // group.setIgnoreGroupTargeting(true);// TODO later instead?
            targetGroup = group;
        }
        if (group.isIgnoreGroupTargeting()) {
            return apply();
        }
        List<Integer> groupIds = group.getObjectIds();
        boolean result = true;
        for (Integer id : groupIds) {
            if (isInterrupted()) {
                break;
            }
            Ref REF = this.ref.getCopy();
            // REF.setGroup(new GroupImpl(targetGroup));
            REF.getGroup().setIgnoreGroupTargeting(true);
            REF.setTarget(id);
            if (construct != null) {
                result &= getCopy().apply(REF);
            } else {
                // this.ref.setTarget(id);
                setIgnoreGroupTargeting(true);
                result &= apply(REF);
                setIgnoreGroupTargeting(false);
            }
        }
        // game.getManager().refreshAll();
        return result;
    }
}
Also used : Ref(main.entity.Ref) PassiveAbilityObj(main.ability.PassiveAbilityObj) GroupImpl(main.entity.group.GroupImpl)

Aggregations

Ref (main.entity.Ref)155 Unit (eidolons.entity.obj.unit.Unit)28 ObjType (main.entity.type.ObjType)23 Event (main.game.logic.event.Event)16 ArrayList (java.util.ArrayList)15 Obj (main.entity.obj.Obj)15 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)13 Coordinates (main.game.bf.Coordinates)13 Conditions (main.elements.conditions.Conditions)12 Formula (main.system.math.Formula)11 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)10 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)9 PARAMETER (main.content.values.parameters.PARAMETER)9 DC_SpellObj (eidolons.entity.active.DC_SpellObj)8 Effects (main.ability.effects.Effects)8 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)7 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)7 Effect (main.ability.effects.Effect)7 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)5 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)5