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