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));
}
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);
}
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);
}
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;
}
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);
}
Aggregations