Search in sources :

Example 11 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class HeroObjectModifyingEffect method applyThis.

/**
 * Modstring format: valueName(value);valueName2(value2);... Use [mod],
 * [set], [remove] to change the default ADD function of modstring
 */
public boolean applyThis() {
    if (ref.getTargetObj().isDead() || ref.getSourceObj().isDead()) {
        removeEffects();
        return false;
    }
    if (game.isSimulation()) {
        if (!checkApplyInSimulation()) {
            return true;
        }
    }
    // what if the group has changed? perhaps there should be a map...
    if (prop) {
        if (propMap == null) {
            propMap = new RandomWizard<PROPERTY>().constructStringWeightMap(modString, PROPERTY.class);
        } else {
            LogMaster.log(1, "prop map " + propMap.toString());
        }
    } else if (// TODO support PROPERTY?
    map == null) {
        map = new RandomWizard<PARAMETER>().constructStringWeightMap(modString, PARAMETER.class);
    } else {
        LogMaster.log(0, "map " + map.toString());
    }
    List<? extends Obj> list = getObjectsToModify();
    LogMaster.log(0, "list " + list.toString());
    LogMaster.log(0, "effects " + effects.toString());
    for (Obj obj : list) {
        if (obj == null) {
            continue;
        }
        if (obj.isDead()) {
            // TODO clean up for owner is dead!
            continue;
        }
        Effect effect = effects.get(obj);
        if (effect != null) {
            // if (isPermanent() && isApplied())
            // continue;
            effect.applyThis();
            applied = true;
            continue;
        }
        Ref REF = ref.getCopy();
        REF.setTarget(obj.getId());
        // map = new MapMaster<PARAMETER, String>().constructVarMap(
        // modString, PARAMETER.class);
        Effects modEffects = new Effects();
        if (map != null) {
            EffectFinder.initParamModEffects(modEffects, map, ref);
        } else if (propMap != null) {
            EffectFinder.initPropModEffects(modEffects, propMap, ref);
        }
        applied = true;
        for (Effect e : modEffects.getEffects()) {
            e.resetOriginalFormula();
            e.appendFormulaByMod(getFormula().toString());
        }
        if (buff) {
            AddBuffEffect buffEffect = new AddBuffEffect(buffName, modEffects);
            // TODO LAYER?
            buffEffect.setForcedLayer(getModEffectLayer());
            modEffects.setForcedLayer(getModEffectLayer());
            if (isPermanent()) {
                buffEffect.setDuration(ContentManager.INFINITE_VALUE);
            }
            if (!game.isSimulation()) {
                effects.put(obj, buffEffect);
            }
            buffEffect.apply(REF);
        } else {
            if (!game.isSimulation()) {
                effects.put(obj, modEffects);
            }
            modEffects.apply(REF);
        }
    }
    return true;
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Ref(main.entity.Ref) RandomWizard(main.system.auxiliary.RandomWizard) PROPERTY(main.content.values.properties.PROPERTY) Obj(main.entity.obj.Obj) DC_Effect(eidolons.ability.effects.DC_Effect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Effect(main.ability.effects.Effect) Effects(main.ability.effects.Effects) PARAMETER(main.content.values.parameters.PARAMETER)

Example 12 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class TossItemEffect method roll.

private boolean roll(Unit source, Unit unit, DC_HeroItemObj item) {
    String fail = "5*1.5*sqrt" + StringMaster.wrapInParenthesis("" + (1 + PositionMaster.getDistance(unit, source)));
    // account for range
    if (item instanceof DC_QuickItemObj) {
        DC_QuickItemObj quickItemObj = (DC_QuickItemObj) item;
    }
    Ref REF = ref.getCopy();
    REF.setTarget(source.getId());
    boolean result = RollMaster.roll(GenericEnums.ROLL_TYPES.ACCURACY, "-", fail, ref, "@, missing the " + item.getName() + " toss", item.getName() + " toss");
    fail = "5";
    if (!result) {
        fail += "*2";
    }
    REF.setTarget(unit.getId());
    result = !RollMaster.roll(GenericEnums.ROLL_TYPES.REFLEX, "-", fail, ref, "@, dropping the tossed " + item.getName(), item.getName() + " toss");
    return result;
}
Also used : Ref(main.entity.Ref) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj)

Example 13 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class UnconsciousBuffEffect method getEffects.

private static Effect getEffects() {
    Effects effects = EffectFinder.initParamModEffects(PARAM_MOD_EFFECTS_STRING, new Ref());
    effects.add(new AddStatusEffect(UnitEnums.STATUS.PRONE));
    effects.add(new AddStatusEffect(UnitEnums.STATUS.IMMOBILE));
    effects.add(new AddStatusEffect(UnitEnums.STATUS.UNCONSCIOUS));
    return effects;
}
Also used : Ref(main.entity.Ref) Effects(main.ability.effects.Effects) AddStatusEffect(main.ability.effects.common.AddStatusEffect)

Example 14 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class CampEffect method applyThis.

@Override
public boolean applyThis() {
    /*
        restore fully, dispel all timed buffs, apply bonus
         */
    List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
    if (allies.isEmpty())
        getGame().getMetaMaster().getPartyManager().getParty().addMember(getGame().getMetaMaster().getPartyManager().getParty().getLeader());
    // mystery fix
    for (Unit sub : new LinkedList<>(allies)) {
        DC_HeroItemObj item = sub.getItemFromInventory("Food");
        if (item != null) {
            sub.removeFromInventory(item);
            continue;
        }
        DC_QuickItemObj qitem = sub.getQuickItem("Food");
        if (item != null) {
            sub.removeQuickItem(qitem);
            continue;
        }
        allies.remove(sub);
        continue;
    // remove
    }
    if (allies.isEmpty()) {
        FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.REQUIREMENT, "You need food supplies to camp!", ref.getSourceObj());
        return false;
    }
    Effects restorationEffects = new Effects();
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_ENDURANCE, MOD.SET_TO_PERCENTAGE, "125", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.SET_TO_PERCENTAGE, "70", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_ESSENCE, MOD.SET_TO_PERCENTAGE, "100", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_STAMINA, MOD.SET_TO_PERCENTAGE, "125", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_TOUGHNESS, MOD.SET_TO_PERCENTAGE, "100", true));
    for (Unit sub : allies) {
        Ref REF = sub.getRef().getTargetingRef(sub);
        restorationEffects.apply(REF);
    }
    float time = 20;
    getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
    // applyRested();
    for (Unit sub : allies) {
    }
    return true;
}
Also used : Ref(main.entity.Ref) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Effects(main.ability.effects.Effects) Unit(eidolons.entity.obj.unit.Unit) LinkedList(java.util.LinkedList)

Example 15 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class RestEffect method applyThis.

@Override
public boolean applyThis() {
    // whole party!
    /*
        add regen and wait()
        interrupt?
         remove buff?
         or rely on reset() ?

         block actions
         add shader
         */
    List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
    for (Unit sub : allies) {
        Ref REF = sub.getRef().getTargetingRef(sub);
        new ModeEffect(STD_MODES.SLEEPING).apply(REF);
    }
    float time = 120;
    // (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.WAIT_COMPLETE);
    Boolean result = getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
    if (result) {
        // applyRested();
        for (Unit sub : allies) {
            sub.removeBuff("Sleeping");
            Ref REF = sub.getRef().getTargetingRef(sub);
            getRestedBuffEffect().apply(REF);
            new ModifyValueEffect(PARAMS.C_MORALE, MOD.MODIFY_BY_PERCENT, "15").apply(REF);
        }
    }
    return true;
}
Also used : Ref(main.entity.Ref) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Unit(eidolons.entity.obj.unit.Unit) ModeEffect(eidolons.ability.effects.oneshot.mechanic.ModeEffect)

Aggregations

Ref (main.entity.Ref)155 Unit (eidolons.entity.obj.unit.Unit)28 ObjType (main.entity.type.ObjType)23 Event (main.game.logic.event.Event)16 ArrayList (java.util.ArrayList)15 Obj (main.entity.obj.Obj)15 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)13 Coordinates (main.game.bf.Coordinates)13 Conditions (main.elements.conditions.Conditions)12 Formula (main.system.math.Formula)11 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)10 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)9 PARAMETER (main.content.values.parameters.PARAMETER)9 DC_SpellObj (eidolons.entity.active.DC_SpellObj)8 Effects (main.ability.effects.Effects)8 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)7 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)7 Effect (main.ability.effects.Effect)7 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)5 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)5