Search in sources :

Example 1 with BuffType

use of main.entity.type.BuffType in project Eidolons by IDemiurge.

the class AddBuffEffect method getBuffTypeLazily.

public BuffType getBuffTypeLazily() {
    if (buffType != null) {
        return buffType;
    }
    this.buffType = (BuffType) DataManager.getType(getBuffTypeName(), DC_TYPE.BUFFS);
    if (buffType == null) {
        if (getBuffTypeName() == null) {
            return new BuffType();
        }
        boolean invisible = getBuffTypeName().contains(StringMaster.INVISIBLE_BUFF_CODE);
        if (TextParser.checkHasRefs(getBuffTypeName())) {
            ref.setID(KEYS.INFO, ref.getId(KEYS.ABILITY));
            String parsedName = TextParser.parse(getBuffTypeName(), ref, TextParser.BUFF_PARSING_CODE);
            setBuffTypeName(parsedName);
        }
        buffType = new BuffType(DataManager.getType(dummyBuffType, DC_TYPE.BUFFS));
        boolean empty = StringMaster.isEmpty(getBuffTypeName());
        if (!empty) {
            empty = StringMaster.isEmpty(getBuffTypeName().trim());
        }
        if (!empty) {
            empty = EMPTY_BUFF_NAME.equals(getBuffTypeName().trim());
        }
        if (empty) {
            setBuffTypeName(getActive().getName());
        }
        buffType.setProperty(G_PROPS.NAME, buffTypeName);
        Obj spell = ref.getObj(KEYS.SPELL);
        if (spell != null) {
            buffType.setProperty(G_PROPS.BUFF_TYPE, GenericEnums.BUFF_TYPE.SPELL.toString());
            if (spell.checkBool(GenericEnums.STD_BOOLS.NON_DISPELABLE)) {
                buffType.addProperty(G_PROPS.STD_BOOLS, GenericEnums.STD_BOOLS.NON_DISPELABLE.toString());
            }
            buffType.setImage(spell.getProperty(G_PROPS.IMAGE));
        }
        buffType.setImage(getActive().getProperty(G_PROPS.IMAGE));
        if (invisible) {
            buffType.addProperty(G_PROPS.STD_BOOLS, GenericEnums.STD_BOOLS.INVISIBLE_BUFF.toString());
        }
    // DataManager.addType(buffType); //what for?
    }
    return buffType;
}
Also used : BuffObj(main.entity.obj.BuffObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) BuffType(main.entity.type.BuffType)

Example 2 with BuffType

use of main.entity.type.BuffType in project Eidolons by IDemiurge.

the class RaiseEffect method getRevenantBuff.

private AddBuffEffect getRevenantBuff() {
    Effects effect = new Effects();
    for (String s : StringMaster.open(getModifiedParam())) {
        String varPart = VariableManager.getVarPart(s);
        String valueName = s.replace(varPart, "");
        String formula = StringMaster.cropParenthesises(varPart) + "*" + // MAX?
        getParamModFormula(valueName);
        effect.add(new ModifyValueEffect(valueName, MOD.MODIFY_BY_CONST, formula));
    }
    BuffType buffType = new BuffType(DataManager.getType(BUFF_NAME));
    buffType.setName(BUFF_NAME + corpse.getName());
    AddBuffEffect e = new AddBuffEffect(buffType, effect);
    return e;
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) BuffType(main.entity.type.BuffType) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects)

Example 3 with BuffType

use of main.entity.type.BuffType 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 4 with BuffType

use of main.entity.type.BuffType in project Eidolons by IDemiurge.

the class EnchantItemEffect method applyThis.

@Override
public boolean applyThis() {
    // TODO select spell to use!
    // perhaps it is better to invoke spell with a special effect!
    // Ref REF = ref.getCopy();
    // this should be an effect - for other things too like traps
    // add spell filter!!!
    // if (selectSpell)
    // game.getManager().infoSelect(ref.getSourceObj());
    spell = (DC_SpellObj) ref.getTargetObj();
    Effects effects = EffectFinder.getEffectsFromSpell(spell);
    effects.add(new AnimationEffect(spell));
    effects.add(new SoundEffect(SOUNDS.IMPACT, ref.getTargetObj()));
    // TODO why was only that 1st spell in SB filtered in???
    if (!new TemplateSelectiveTargeting((weapon) ? SELECTIVE_TARGETING_TEMPLATES.MY_WEAPON : SELECTIVE_TARGETING_TEMPLATES.MY_ARMOR).select(ref)) {
        return false;
    }
    // new ModifyPropertyEffect(G_PROPS.PASSIVES, MOD_PROP_TYPE.ADD,
    // passive)
    // .apply(ref);
    // 
    KEYS key;
    if (!weapon) {
        key = KEYS.ARMOR;
    } else {
        if (ref.getTargetObj() == ref.getObj(KEYS.WEAPON)) {
            key = KEYS.WEAPON;
        } else {
            key = KEYS.OFFHAND;
        }
    }
    int cost = Enchanter.calculateSpellEnergyCost(spell);
    if (case_type == null) {
        case_type = (weapon) ? SPECIAL_EFFECTS_CASE.ON_ATTACK : SPECIAL_EFFECTS_CASE.ON_HIT;
    }
    // another layer of customTargetEffect if ON SELF or so ! Some may even
    // be Zone-targeted!
    BuffType t = new BuffType(new Ref(ref.getGame(), ref.getSource()));
    t.setImage(ref.getActive().getProperty(G_PROPS.IMAGE, false));
    t.setName(buffName + " " + StringMaster.wrapInParenthesis(spell.getName()));
    t.setParam(G_PARAMS.DURATION, ref.getActive().getIntParam(G_PARAMS.DURATION, false));
    new AddBuffEffect(t, new AddSpecialEffects(case_type, new EnergyCostEffect(cost, key, effects))).apply(ref);
    ModifyValueEffect addEnergyEffect = new ModifyValueEffect(PARAMS.C_ENERGY, MOD.MODIFY_BY_CONST, energy);
    addEnergyEffect.setValueOverMax(true);
    addEnergyEffect.apply(ref);
    return true;
}
Also used : SoundEffect(eidolons.ability.effects.special.media.SoundEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Ref(main.entity.Ref) AddSpecialEffects(eidolons.ability.AddSpecialEffects) KEYS(main.entity.Ref.KEYS) BuffType(main.entity.type.BuffType) EnergyCostEffect(eidolons.ability.effects.containers.EnergyCostEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) AnimationEffect(eidolons.ability.effects.special.media.AnimationEffect) Effects(main.ability.effects.Effects) AddSpecialEffects(eidolons.ability.AddSpecialEffects)

Aggregations

BuffType (main.entity.type.BuffType)4 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)3 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)2 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)2 Effects (main.ability.effects.Effects)2 Ref (main.entity.Ref)2 BuffObj (main.entity.obj.BuffObj)2 Obj (main.entity.obj.Obj)2 AddSpecialEffects (eidolons.ability.AddSpecialEffects)1 EnergyCostEffect (eidolons.ability.effects.containers.EnergyCostEffect)1 AnimationEffect (eidolons.ability.effects.special.media.AnimationEffect)1 SoundEffect (eidolons.ability.effects.special.media.SoundEffect)1 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)1 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)1 Unit (eidolons.entity.obj.unit.Unit)1 Effect (main.ability.effects.Effect)1 KEYS (main.entity.Ref.KEYS)1