Search in sources :

Example 86 with Ref

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

the class Conditions method check.

@Override
public boolean check(Entity match) {
    Ref ref = match.getRef().getCopy();
    ref.setMatch(match.getId());
    return check(ref);
}
Also used : Ref(main.entity.Ref)

Example 87 with Ref

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

the class Requirements method preCheck.

public boolean preCheck(Ref ref) {
    reasons.clear();
    Ref REF = ref.getCopy();
    REF.setValue(KEYS.PAYEE, REF.getSource() + "");
    setReason(null);
    for (String r : reqMap.keySet()) {
        if (!reqMap.get(r).preCheck(REF)) {
            reasons.add(r);
            if (getReason() == null) {
                setReason(r);
            }
            if (!isFullCheck()) {
                return false;
            }
        }
    }
    return getReason() == null;
}
Also used : Ref(main.entity.Ref)

Example 88 with Ref

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

the class Game method initType.

public void initType(ObjType type) {
    if (type.isInitialized() && type.getGame() != null) {
        if (type.getOBJ_TYPE_ENUM() == DC_TYPE.CHARS || type.getOBJ_TYPE_ENUM() == DC_TYPE.PARTY) {
            LogMaster.log(0, type + " already initialized for " + type.getGame() + " with id: " + type.getId());
        }
        type.setGame(this);
        return;
    }
    type.setId(idManager.getNewTypeId());
    getState().getTypeMap().put(type.getId(), type);
    type.setGame(this);
    type.setRef(new Ref(this, type.getId()));
    state.getTypeMap().put(type.getId(), type);
    type.setInitialized(true);
}
Also used : Ref(main.entity.Ref)

Example 89 with Ref

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

the class HeroObjectModifyingEffect method getObjectsToModify.

protected List<Obj> getObjectsToModify() {
    if (objName != null) {
        return getObjectsByName(objName);
    } else {
        // TODO simple condition format - prop,
        Ref REF = ref.getCopy();
        // value"
        initFilterConditions();
        Unit hero = (Unit) ref.getSourceObj();
        if (type != null) {
            List<Integer> list;
            try {
                list = getIdList(hero);
            } catch (Exception e) {
                LogMaster.log(1, "Group obj effect failed to getOrCreate targets: " + this);
                return new ArrayList<>();
            }
            List<Obj> objList = new ArrayList<>();
            for (Integer id : list) {
                objList.add(game.getObjectById(id));
            }
            return objList;
        }
        new AutoTargeting(conditions).select(REF);
        return REF.getGroup().getObjects();
    }
}
Also used : AutoTargeting(main.elements.targeting.AutoTargeting) Ref(main.entity.Ref) Obj(main.entity.obj.Obj) ArrayList(java.util.ArrayList) Unit(eidolons.entity.obj.unit.Unit)

Example 90 with Ref

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

the class WaitEffect method applyThis.

@Override
public boolean applyThis() {
    if (ref.getTargetObj() == ref.getSourceObj()) {
        ref.getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_WAITS, game));
        return true;
    }
    Ref REF = Ref.getCopy(ref);
    REF.setValue(KEYS.TARGET2, ref.getTarget() + "");
    REF.setTarget(ref.getSource());
    boolean result = new AddBuffEffect(getRetainConditions(), getBuffName(), getEffects(REF)).apply(REF);
    if (!result) {
        return false;
    }
    try {
        WaitRule.addWaitingUnit((Unit) ref.getSourceObj(), (Unit) ref.getTargetObj());
    } catch (Exception e) {
        return false;
    }
    return result;
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Ref(main.entity.Ref) Event(main.game.logic.event.Event)

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