Search in sources :

Example 6 with BuffObj

use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.

the class BuffMaster method atbTimeElapsed.

public void atbTimeElapsed(Float time) {
    for (Obj sub : getBuffs()) {
        BuffObj buff = ((BuffObj) sub);
        if (buff.isDead())
            continue;
        buff.timeElapsed(time);
    }
}
Also used : DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) BuffObj(main.entity.obj.BuffObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) BuffObj(main.entity.obj.BuffObj)

Example 7 with BuffObj

use of main.entity.obj.BuffObj 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;
}
Also used : Ref(main.entity.Ref) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) BuffObj(main.entity.obj.BuffObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) BuffType(main.entity.type.BuffType) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Effect(main.ability.effects.Effect) Unit(eidolons.entity.obj.unit.Unit) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj)

Example 8 with BuffObj

use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.

the class BuffMaster method addAttachment.

public void addAttachment(Attachment attachment, Obj basis) {
    List<Attachment> list = getState().getAttachmentsMap().get(basis);
    if (list == null) {
        list = new ArrayList<>();
        getState().getAttachmentsMap().put(basis, list);
    }
    if (attachment instanceof BuffObj) {
        basis.addBuff((BuffObj) attachment);
    }
    getState().addAttachment(attachment);
    list.add(attachment);
    if (// e.g. auras
    attachment.isTransient()) {
        return;
    }
    for (Effect e : attachment.getEffects()) {
        // e.apply(basis.getRef()); // how to add retain conditions?
        // else
        // if (!(e instanceof AttachmentEffect))
        getState().addEffect(e);
    }
}
Also used : Attachment(main.entity.obj.Attachment) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Effect(main.ability.effects.Effect) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) BuffObj(main.entity.obj.BuffObj)

Example 9 with BuffObj

use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.

the class DC_BuffPanel method getData.

@Override
public Collection<DC_BuffObj> getData() {
    if (obj == null) {
        return getEmptyData();
    }
    DequeImpl<BuffObj> attachments = obj.getBuffs();
    if (attachments == null) {
        return getEmptyData();
    }
    if (attachments.isEmpty()) {
        return getEmptyData();
    }
    data = new ArrayList<>();
    for (Attachment attachment : attachments) {
        if (attachment instanceof DC_BuffObj) {
            data.add((DC_BuffObj) attachment);
        }
    }
    return data;
}
Also used : Attachment(main.entity.obj.Attachment) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) BuffObj(main.entity.obj.BuffObj) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj)

Example 10 with BuffObj

use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.

the class DC_PagedBuffPanel method createPageComponent.

@Override
protected G_Component createPageComponent(List<BuffObj> list) {
    List<SmallItem> compList = new ArrayList<>();
    for (BuffObj buff : list) {
        if (buff == null) {
            compList.add(new SmallItem());
        } else {
            compList.add(new SmallItem(buff));
        }
    }
    BuffPage buffPage = new BuffPage(compList, getItemSize(), PAGE_SIZE);
    buffPage.getList().setCellRenderer(buffPage);
    return buffPage;
}
Also used : ArrayList(java.util.ArrayList) 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