Search in sources :

Example 1 with Attachment

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

the class StateCloner method cloneAttachments.

private void cloneAttachments(DC_GameState state, DC_GameState clone) {
    state.getAttachments().forEach(attachment -> {
        Attachment a = cloneAttachment(attachment);
        clone.getAttachments().add(a);
        Obj basis = a.getBasis();
        if (basis != null) {
            MapMaster.addToListMap(clone.getAttachmentsMap(), basis, a);
        }
    });
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) DC_SpellObj(eidolons.entity.active.DC_SpellObj) Obj(main.entity.obj.Obj) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) PassiveAbilityObj(main.ability.PassiveAbilityObj) Attachment(main.entity.obj.Attachment)

Example 2 with Attachment

use of main.entity.obj.Attachment 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 3 with Attachment

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

the class DeathMaster method unitDies.

public void unitDies(DC_ActiveObj activeObj, Obj _killed, Obj _killer, boolean leaveCorpse, boolean quietly) {
    if (_killed.isDead())
        return;
    String message = null;
    if (_killed == _killer) {
        // + _killed.getInfoString();
        message = _killed + " dies ";
    } else
        message = _killed + " killed by " + _killer + " with " + activeObj;
    SpecialLogger.getInstance().appendSpecialLog(SPECIAL_LOG.MAIN, message);
    _killed.setDead(true);
    BattleFieldObject killed = (BattleFieldObject) _killed;
    BattleFieldObject killer = (BattleFieldObject) _killer;
    Ref ref = Ref.getCopy(killed.getRef());
    ref.setSource(killer.getId());
    ref.setTarget(killed.getId());
    for (AbilityObj abil : killed.getPassives()) {
        abil.kill();
    }
    if (killed.getBuffs() != null) {
        for (Attachment attach : killed.getBuffs()) {
            if (!attach.isRetainAfterDeath()) {
                getState().getAttachmentsMap().get(killed).remove(attach);
                attach.remove();
            }
        }
    }
    if (!leaveCorpse) {
    // leave a *ghost*?
    // destroy items?
    } else {
        if (killed instanceof Unit) {
            try {
                getGame().getDroppedItemManager().dropDead((Unit) killed);
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
        try {
            getGame().getGraveyardManager().unitDies(killed);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    // getGame().getBattleField().remove(killed); // TODO GRAVEYARD
    if (!quietly) {
        Ref REF = Ref.getCopy(killer.getRef());
        REF.setTarget(killed.getId());
        REF.setSource(killer.getId());
        if (activeObj != null)
            REF.setObj(KEYS.ACTIVE, activeObj);
        if (killed instanceof Unit) {
            getGame().getRules().getMoraleKillingRule().unitDied((Unit) killed, killer.getRef().getAnimationActive());
        }
        LogEntryNode node = game.getLogManager().newLogEntryNode(ENTRY_TYPE.DEATH, killed);
        if (killer.getRef().getAnimationActive() != null) {
            ANIM animation = killer.getRef().getAnimationActive().getAnimation();
            if (animation != null) {
                animation.addPhase(new AnimPhase(PHASE_TYPE.DEATH, killer, killed));
                node.setLinkedAnimation(animation);
            }
        }
        DC_SoundMaster.playEffectSound(SOUNDS.DEATH, killed);
        game.getLogManager().logDeath(killed, killer);
        getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_KILLED, REF));
        game.getLogManager().doneLogEntryNode();
    } else {
        GuiEventManager.trigger(GuiEventType.DESTROY_UNIT_MODEL, killed);
    }
// refreshAll();
}
Also used : AbilityObj(main.ability.AbilityObj) Ref(main.entity.Ref) AnimPhase(main.system.graphics.AnimPhase) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Event(main.game.logic.event.Event) Attachment(main.entity.obj.Attachment) Unit(eidolons.entity.obj.unit.Unit) LogEntryNode(main.system.text.LogEntryNode) ANIM(main.system.graphics.ANIM)

Example 4 with Attachment

use of main.entity.obj.Attachment 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 5 with Attachment

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

the class DispelEffect method applyThis.

@Override
public boolean applyThis() {
    for (Attachment attachment : game.getState().getAttachmentsMap().get(ref.getTargetObj())) {
        if (!(attachment instanceof BuffObj)) {
            continue;
        }
        BuffObj buff = (BuffObj) attachment;
        if (!buff.isDispelable()) {
            continue;
        }
        if (!friendlyFire) {
            if (buff.getOwner().isMe()) {
                continue;
            }
        }
        if (positiveOnly) {
        // if (buff.getBuffType() ==)
        }
        boolean result = true;
        // Ref REF = Ref.getCopy(ref);
        // REF.setTarget(buff.getId());
        // REF.setID(KEYS.SUMMONER, buff.getOwnerObj()); // is it owner or
        // // basis? ;)
        // 
        // Roll roll = new Roll(ROLL_TYPES.DISPEL, chance.getInt(ref));
        // result = RollMaster.roll(roll);
        // TODO ROLL!
        Integer amount = durationMod.getInt(ref);
        buff.modifyDuration(amount);
    }
    return true;
}
Also used : Attachment(main.entity.obj.Attachment) BuffObj(main.entity.obj.BuffObj)

Aggregations

Attachment (main.entity.obj.Attachment)6 BuffObj (main.entity.obj.BuffObj)4 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)3 Effect (main.ability.effects.Effect)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)1 DC_HeroSlotItem (eidolons.entity.item.DC_HeroSlotItem)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 DC_FeatObj (eidolons.entity.obj.attach.DC_FeatObj)1 Unit (eidolons.entity.obj.unit.Unit)1 AbilityObj (main.ability.AbilityObj)1 PassiveAbilityObj (main.ability.PassiveAbilityObj)1 Ref (main.entity.Ref)1 Obj (main.entity.obj.Obj)1 Event (main.game.logic.event.Event)1 ANIM (main.system.graphics.ANIM)1 AnimPhase (main.system.graphics.AnimPhase)1