use of main.entity.obj.Obj 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.obj.Obj in project Eidolons by IDemiurge.
the class PartyEffect method getObjectsToModify.
@Override
protected List<Obj> getObjectsToModify() {
Party party = (Party) ref.getSourceObj().getRef().getObj(KEYS.PARTY);
List<Unit> list = party.getMembers();
initFilterConditions();
FilterMaster.filter(list, conditions);
List<Obj> objList = new ArrayList<>();
for (Unit j : list) {
objList.add(j);
}
return objList;
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class WatchActionEffect method applyThis.
@Override
public boolean applyThis() {
Obj sourceObj = ref.getSourceObj();
List<DC_Obj> list = WatchRule.getWatchersMap().get(sourceObj);
if (list == null) {
list = new ArrayList<>();
WatchRule.getWatchersMap().put((Unit) sourceObj, list);
} else if (!alert) {
if (list.contains(ref.getTargetObj())) {
list.remove(ref.getTargetObj());
if (RandomWizard.random()) {
DC_SoundMaster.playStandardSound(STD_SOUNDS.BACK);
} else {
DC_SoundMaster.playStandardSound(STD_SOUNDS.CLOSE);
}
LogMaster.log(1, sourceObj.getName() + " no longer watching " + ref.getTargetObj().getNameIfKnown());
return true;
} else if (!list.isEmpty()) {
if (RandomWizard.random()) {
DC_SoundMaster.playStandardSound(STD_SOUNDS.DIS__BLOCKED);
} else {
DC_SoundMaster.playStandardSound(STD_SOUNDS.CLICK_ERROR);
}
// if (maxUnitsWatched<=1)
return false;
}
}
list.add((DC_Obj) ref.getTargetObj());
if (!alert) {
if (// (sourceObj.isMine())
RandomWizard.random()) {
DC_SoundMaster.playStandardSound(STD_SOUNDS.DIS__KNIFE);
} else {
DC_SoundMaster.playStandardSound(STD_SOUNDS.NOTE);
}
}
return true;
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class BuffMaster method createBuff.
public BuffObj createBuff(BuffType type, Obj active, Player player, Ref ref, Effect effect, double duration, Condition retainCondition) {
ref = Ref.getCopy(ref);
if (type.getName().equals(BuffObj.DUMMY_BUFF_TYPE)) {
try {
String name = ref.getObj(KEYS.ACTIVE.name()).getName() + "'s buff";
String img = ref.getObj(KEYS.ACTIVE.name()).getProperty(G_PROPS.IMAGE);
type = new BuffType(type);
type.setProperty(G_PROPS.NAME, name);
type.setProperty(G_PROPS.IMAGE, img);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
Obj basis = game.getObjectById(ref.getBasis());
if (basis == null) {
return null;
}
DC_BuffObj buff = (DC_BuffObj) basis.getBuff(type.getName());
if (buff != null) {
if (!type.checkBool(GenericEnums.STD_BOOLS.STACKING) && !active.checkBool(GenericEnums.STD_BOOLS.STACKING)) {
basis.removeBuff(type.getName());
// TODO duration or do nothing
} else {
if (buff.isMaxStacks()) {
return buff;
}
buff.modifyParameter(PARAMS.BUFF_STACKS, 1);
}
} else {
// preCheck cache
}
buff = new DC_BuffObj(type, player, getGame(), ref, effect, duration, retainCondition);
buff.setActive(active);
// be careful!
buff.applyEffect();
buffCreated(buff, basis);
if (type.checkBool(GenericEnums.STD_BOOLS.APPLY_THRU) || active.checkBool(GenericEnums.STD_BOOLS.APPLY_THRU)) {
buff.setAppliedThrough(true);
if (basis instanceof Unit) {
Ref REF = ref.getCopy();
Obj cell = game.getCellByCoordinate(basis.getCoordinates());
if (!cell.hasBuff(buff.getName())) {
REF.setBasis(cell.getId());
REF.setTarget(cell.getId());
// copy buff
Effect copy = effect.getCopy();
if (copy == null) {
LogMaster.error("APPLY THRU ERROR: " + effect + " HAS NO CONSTRUCT");
} else {
createBuff(type, active, player, REF, copy, duration, retainCondition).setAppliedThrough(true);
}
}
}
}
return buff;
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class DC_Game method reinit.
public void reinit(boolean restart) {
master = new DC_GameMaster(this);
List<Obj> cachedObjects = new ArrayList<>();
if (!restart)
for (Obj sub : getState().getObjects().values()) {
if (sub == null)
continue;
if (sub instanceof Unit)
continue;
if (sub.getRef() == null)
continue;
if (sub.getRef().getSourceObj() == null)
continue;
if (sub.getRef().getSourceObj().isMine()) {
cachedObjects.add(sub);
}
}
this.setState(new DC_GameState(this));
this.setManager(new DC_GameManager(this.getState(), this));
this.getManager().init();
for (Obj sub : cachedObjects) {
getState().addObject(sub);
}
visionMaster.reinit();
}
Aggregations