use of eidolons.ability.effects.oneshot.rule.WatchActionEffect 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));
}
}
Aggregations