use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class WatchRule method updateWatchStatus.
public void updateWatchStatus(Unit watcher) {
List<DC_Obj> list = getWatchersMap().get(watcher);
boolean invalid = false;
if (list != null) {
if (!checkValidWatcher(watcher)) {
invalid = true;
removeWatcher(watcher);
} else {
for (DC_Obj watched : list) {
if (!checkValidWatchTarget(watched)) {
breakWatch(watcher, watched);
break;
} else if (!checkValidWatchPairTarget(watcher, watched)) {
breakWatch(watcher, watched);
break;
}
}
}
}
BuffObj buff = watcher.getBuff("Watching", false);
if (buff != null) {
watcher.getGame().getManager().buffRemoved(buff);
}
if (!invalid) {
if (watcher.getMode().equals(STD_MODES.ALERT)) {
Ref ref = watcher.getRef().getCopy();
try {
SpectrumEffect spectrumEffect = new SpectrumEffect(new OwnershipCondition(true, "match", "source"), new WatchActionEffect(true));
spectrumEffect.setRangeFormula(StringMaster.getValueRef(KEYS.SOURCE, PARAMS.SIGHT_RANGE));
// for now...
spectrumEffect.setApplyThrough(false);
spectrumEffect.apply(ref);
watcher.getBuff(STD_MODES.ALERT.getBuffName(), false).setOnDispelEffects(new RemoveBuffEffect("Watching ", false));
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
list = getWatchersMap().get(watcher);
if (ListMaster.isNotEmpty(list)) // TODO alert???
{
getWatchBuffEffect(watcher, list).apply(Ref.getSelfTargetingRefCopy(watcher));
}
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class DC_BuffRule method apply.
public boolean apply(Obj obj) {
target = (Unit) obj;
Ref ref = obj.getRef().getCopy();
ref.setMatch(obj.getId());
ref.setTarget(obj.getId());
ref.setBasis(obj.getId());
if (!check(obj)) {
return false;
}
// checkLogged(obj);
for (String buffName : getBuffNames()) {
BuffObj buff = obj.getBuff(buffName);
if (buff != null) {
// logged = false;
buff.kill();
}
}
if (getBuffConditions().preCheck(ref)) {
if (checkBuffLevel(ref)) {
if (checkLogged(obj)) {
log(obj);
}
apply(ref);
}
}
return true;
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class DC_PagedBuffPanel method getPageData.
@Override
protected List<List<BuffObj>> getPageData() {
if (obj == null) {
return new ArrayList<>();
}
DequeImpl<BuffObj> buffs = obj.getBuffs();
if (buffs == null) {
return new ArrayList<>();
}
List<BuffObj> list = new ArrayList<>();
for (BuffObj buff : buffs) {
if (buff.isVisible()) {
list.add(buff);
}
}
Collections.sort(list, getComparator());
return splitList(list);
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class UpkeepRule method enactUpkeepFail.
public void enactUpkeepFail(UPKEEP_FAIL_ACTION ufa, Ref ref) {
Obj targetObj = ref.getTargetObj();
if (targetObj instanceof BuffObj) {
BuffObj buffObj = (BuffObj) targetObj;
ref.setTarget(buffObj.getBasis().getId());
new RemoveBuffEffect(targetObj.getName()).apply(ref);
ref.getGame().getLogManager().log(targetObj.getName() + " " + BUFF_DISPELLED_STRING);
return;
}
ref.getGame().getLogManager().log(targetObj.getName() + " " + ufa.getLogString());
// TODO enemy string should be different!
Effect e = getFailEffects(ufa);
e.apply(ref);
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class DC_Game method exit.
public void exit(boolean mainMenu) throws InterruptedException {
// TODO review this! only for arcade-game, btw!
stop();
// dungeonMaster.setDungeon(null);
getManager().setSelectedInfoObj(null);
WaitRule.reset();
for (Obj obj : getObjects(DC_TYPE.BUFFS)) {
BuffObj buff = (BuffObj) obj;
if (buff.isDispelable() || !buff.isPermanent()) {
buff.kill();
}
}
state.reset();
logManager.clear();
for (Obj obj : getUnits()) {
if (!obj.getOriginalOwner().isMe()) {
obj.kill(obj, false, true);
}
if (!mainMenu && obj.getOwner().isMe()) {
continue;
}
state.removeObject(obj.getId());
}
if (mainMenu) {
getMaster().clear();
}
for (Obj obj : getCells()) {
obj.kill(obj, false, true);
state.removeObject(obj.getId());
}
}
Aggregations