Search in sources :

Example 1 with BuffObj

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));
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Ref(main.entity.Ref) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) BuffObj(main.entity.obj.BuffObj) SpectrumEffect(eidolons.ability.effects.common.SpectrumEffect) WatchActionEffect(eidolons.ability.effects.oneshot.rule.WatchActionEffect)

Example 2 with BuffObj

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;
}
Also used : Ref(main.entity.Ref) BuffObj(main.entity.obj.BuffObj)

Example 3 with BuffObj

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);
}
Also used : ArrayList(java.util.ArrayList) BuffObj(main.entity.obj.BuffObj)

Example 4 with BuffObj

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);
}
Also used : RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) Effect(main.ability.effects.Effect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) BuffObj(main.entity.obj.BuffObj)

Example 5 with BuffObj

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());
    }
}
Also used : DC_HeroAttachedObj(eidolons.entity.obj.attach.DC_HeroAttachedObj) MicroObj(main.entity.obj.MicroObj) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) BuffObj(main.entity.obj.BuffObj)

Aggregations

BuffObj (main.entity.obj.BuffObj)16 Obj (main.entity.obj.Obj)5 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)4 Effect (main.ability.effects.Effect)4 Attachment (main.entity.obj.Attachment)4 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)3 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)3 ArrayList (java.util.ArrayList)3 Ref (main.entity.Ref)3 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)2 DC_Obj (eidolons.entity.obj.DC_Obj)2 SpectrumEffect (eidolons.ability.effects.common.SpectrumEffect)1 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)1 WatchActionEffect (eidolons.ability.effects.oneshot.rule.WatchActionEffect)1 ImmobilizeEffect (eidolons.ability.effects.oneshot.status.ImmobilizeEffect)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_HeroSlotItem (eidolons.entity.item.DC_HeroSlotItem)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 DC_HeroAttachedObj (eidolons.entity.obj.attach.DC_HeroAttachedObj)1 Unit (eidolons.entity.obj.unit.Unit)1