Search in sources :

Example 81 with Ref

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

the class DcHelper method object.

public BattleFieldObject object(String name, int x, int y, DC_Player owner, DC_TYPE TYPE) {
    ObjType type = DataManager.getType(name, TYPE);
    assertTrue(type != null);
    return (BattleFieldObject) game.getManager().getObjCreator().createUnit(type, x, y, owner, new Ref(game));
}
Also used : Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) BattleFieldObject(eidolons.entity.obj.BattleFieldObject)

Example 82 with Ref

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

the class AbilityObj method setRef.

@Override
public void setRef(Ref ref) {
    Ref REF = ref.getCopy();
    super.setRef(REF);
    this.ref.setID(KEYS.ABILITY, id);
}
Also used : Ref(main.entity.Ref)

Example 83 with Ref

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

the class CustomTargetEffect method applyThis.

@Override
public boolean applyThis() {
    Ref REF = ref.getCopy();
    Integer first_target = null;
    if (REF.getTargetObj() != null) {
        first_target = REF.getTarget();
    }
    if (!t.select(REF)) {
        return false;
    }
    if (first_target != null) {
        REF.setID(KEYS.CUSTOM_TARGET, first_target);
        REF.setTarget(REF.getTarget());
    }
    return effect.apply(REF);
}
Also used : Ref(main.entity.Ref)

Example 84 with Ref

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

the class AbilityConstructor method newAbility.

public static ActiveObj newAbility(String abilTypeName, Entity entity, boolean passive) {
    TextParser.setAbilityParsing(true);
    if (!passive) {
        TextParser.setActiveParsing(true);
    }
    Ref ref = entity.getRef().getCopy();
    ref.setID(KEYS.INFO, entity.getId());
    try {
        if (passive) {
            abilTypeName = TextParser.parse(abilTypeName, ref, TextParser.ABILITY_PARSING_CODE, TextParser.VARIABLE_PARSING_CODE);
        } else {
            abilTypeName = TextParser.parse(abilTypeName, ref, TextParser.ACTIVE_PARSING_CODE, TextParser.VARIABLE_PARSING_CODE, TextParser.ABILITY_PARSING_CODE);
        }
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    } finally {
        TextParser.setAbilityParsing(false);
        TextParser.setActiveParsing(false);
    }
    // TODO
    AbilityType type = null;
    try {
        type = getNewAbilityType(abilTypeName);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
        LogMaster.log(1, "Failed to create new ability: " + abilTypeName);
    }
    if (type == null) {
        return null;
    }
    // if (type.getAbilities() == null)
    construct(type);
    Map<String, AbilityObj> map = getAbilCache().get(entity.getId());
    if (map == null) {
        map = new HashMap<>();
        getAbilCache().put(entity.getId(), map);
    }
    AbilityObj ability = map.get(abilTypeName);
    if (ability == null) {
        if (passive) {
            ability = new PassiveAbilityObj(type, entity.getRef(), entity.getOwner(), entity.getGame());
        } else {
            ability = new ActiveAbilityObj(type, entity.getRef(), entity.getOwner(), entity.getGame());
        }
        entity.getGame().getState().addObject(ability);
        map.put(abilTypeName, ability);
    }
    return ability;
}
Also used : Ref(main.entity.Ref)

Example 85 with Ref

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

the class ConditionImpl method check.

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

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