Search in sources :

Example 1 with DC_BuffObj

use of eidolons.entity.obj.attach.DC_BuffObj in project Eidolons by IDemiurge.

the class EffectAnimation method drawBuff.

private boolean drawBuff(AnimPhase phase) {
    // TODO boolean source,
    for (Object arg : phase.getArgs()) {
        if ((arg instanceof DC_BuffObj)) {
            DC_BuffObj buff = (DC_BuffObj) arg;
            Image image = buff.getIcon().getImage();
            int y = 0;
            drawOnTargetCenterX(image, y);
            y += image.getHeight(null);
            Color c = getDefaultTextColor();
            if (buff.isNegative() != null) {
                c = getColorForModifier(buff.isNegative() ? -1 : 1);
            }
            y += drawTextOnTarget(buff.getName(), MigMaster.getCenteredTextPosition(buff.getName(), font, w), y, c);
        }
        if (arg instanceof Map) {
        // drawParamMap(phase);
        // drawTextColumn(map, onSource);
        }
    }
    for (Object arg : phase.getArgs()) {
    }
    return true;
}
Also used : DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) Map(java.util.Map)

Example 2 with DC_BuffObj

use of eidolons.entity.obj.attach.DC_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 3 with DC_BuffObj

use of eidolons.entity.obj.attach.DC_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)

Aggregations

DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)3 BuffObj (main.entity.obj.BuffObj)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 Unit (eidolons.entity.obj.unit.Unit)1 Map (java.util.Map)1 Effect (main.ability.effects.Effect)1 Ref (main.entity.Ref)1 Attachment (main.entity.obj.Attachment)1 Obj (main.entity.obj.Obj)1 BuffType (main.entity.type.BuffType)1