Search in sources :

Example 81 with PARAMETER

use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.

the class Entity method toBase.

public void toBase() {
    setBeingReset(true);
    // TODO DRY!
    if (getMaster() != null) {
        if (getResetter() != null) {
            getResetter().toBase();
            setBeingReset(false);
            return;
        }
    }
    getPropCache().clear();
    // TODO [OPTIMIZED] no need to clear
    getIntegerMap(false).clear();
    // type's map?
    if (modifierMaps != null) {
        // remember? For interesting spells or log
        modifierMaps.clear();
    }
    // info...
    if (!type.checkProperty(G_PROPS.DISPLAYED_NAME)) {
        setProperty(G_PROPS.DISPLAYED_NAME, getName(), true);
    }
    if (this.owner != getOriginalOwner()) {
        LogMaster.log(LogMaster.CORE_DEBUG, getName() + ": original owner restored!");
    }
    this.owner = getOriginalOwner();
    HashSet<PARAMETER> params = new HashSet<>(getParamMap().keySet());
    params.addAll(type.getParamMap().keySet());
    for (PARAMETER p : params) {
        if (p == null) {
            continue;
        }
        if (p.isDynamic()) {
            if (p.isWriteToType()) {
                getType().setParam(p, getParam(p), true);
            }
            continue;
        }
        String baseValue = getType().getParam(p);
        String value = getParam(p);
        getValueCache().put(p, value);
        if (!value.equals(baseValue)) {
            String amount = getType().getParam(p);
            putParameter(p, amount);
            if (game.isStarted() && !game.isSimulation()) {
                if (p.isDynamic()) {
                    fireParamEvent(p, amount, CONSTRUCTED_EVENT_TYPE.PARAM_MODIFIED);
                }
            }
        }
    }
    HashSet<PROPERTY> props = new HashSet<>(getPropMap().keySet());
    props.addAll(type.getPropMap().keySet());
    for (PROPERTY p : props) {
        if (p.isDynamic()) {
            if (p.isWriteToType()) {
                getType().setProperty(p, getProperty(p));
            }
            continue;
        }
        String baseValue = getType().getProperty(p);
        if (TextParser.isRef(baseValue)) {
            baseValue = new Property(baseValue).getStr(ref);
            if ((baseValue) == null) {
                baseValue = getType().getProperty(p);
            }
        }
        String value = getProperty(p);
        getValueCache().put(p, value);
        if (!value.equals(baseValue)) {
            putProperty(p, baseValue);
        } else {
            putProperty(p, baseValue);
        }
    }
    // resetStatus();
    setDirty(false);
    setBeingReset(false);
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) Property(main.system.math.Property) PARAMETER(main.content.values.parameters.PARAMETER)

Example 82 with PARAMETER

use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.

the class ModeEffect method addEndTurnEffect.

private void addEndTurnEffect() {
    Condition condition = new StringComparison(prop, mode.toString(), true);
    if (mode == STD_MODES.DIVINATION) {
        Effect effect = new DivinationEffect();
        addBuffEffect.addEffect(new DelayedEffect(effect, condition));
        return;
    }
    String formula = mode.getFormula();
    if (ref.getActive() instanceof DC_ActiveObj) {
        DC_ActiveObj activeObj = (DC_ActiveObj) ref.getActive();
        if (activeObj.getParam(PARAMS.FORMULA).contains(StringMaster.MOD)) {
            formula = StringMaster.wrapInParenthesis(formula) + "*" + activeObj.getParam(PARAMS.FORMULA) + "/100";
        } else if (activeObj.getIntParam(PARAMS.FORMULA) != 0) {
            formula += "+" + activeObj.getIntParam(PARAMS.FORMULA);
        }
    }
    ModifyValueEffect effect = new ModifyValueEffect(mode.getParameter(), MOD.MODIFY_BY_CONST, new Formula("min(0, " + formula + ")"));
    PARAMETER param = ContentManager.getPARAM(mode.getParameter());
    effect.setParam(param);
    effect.setMaxParam(ContentManager.getBaseParameterFromCurrent(param));
    Formula appendedByModifier = new Formula(formula).getAppendedByModifier(timeModifier);
    effect.setFormula(appendedByModifier);
    addBuffEffect.addEffect(new DelayedEffect(effect, condition));
// new DelayedEffect(effect, condition).apply(ref);
}
Also used : Condition(main.elements.conditions.Condition) RefCondition(main.elements.conditions.RefCondition) Formula(main.system.math.Formula) StringComparison(main.elements.conditions.StringComparison) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) SetCustomModeEffect(eidolons.ability.effects.continuous.SetCustomModeEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect) PeriodicEffect(main.ability.effects.periodic.PeriodicEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 83 with PARAMETER

use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.

the class HeroTextComp method refresh.

@Override
public void refresh() {
    if (getMouseListeners().length == 0) {
        addMouseListener(this);
    }
    if (hero == null) {
        return;
    }
    List<String> lines = new ArrayList<>();
    for (VALUE V : VALUES) {
        String value = hero.getValue(V);
        if (V instanceof PARAMETER) {
            value = V.getName() + " " + value;
        }
        lines.add(value);
    }
    setTextLines(lines);
}
Also used : ArrayList(java.util.ArrayList) VALUE(main.content.VALUE) PARAMETER(main.content.values.parameters.PARAMETER)

Example 84 with PARAMETER

use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.

the class UpkeepRule method checkCanUpkeep.

private boolean checkCanUpkeep(Unit unit, Obj payObj) {
    if (unit.isDead()) // if (payObj.checkBool(DISPEL_ON_DEATH)) //only those with upkeep,
    // never fear!
    {
        return false;
    }
    for (PARAMETER p : ValuePages.UPKEEP_PARAMETERS) {
        PARAMETER payParamFromUpkeep = DC_ContentManager.getPayParamFromUpkeep(p);
        Integer amount = new Formula(payObj.getParam(p)).getAppendedByModifier(StringMaster.getValueRef(KEYS.SUMMONER, PARAMS.UPKEEP_MOD)).getInt(unit.getRef());
        if (amount <= 0) {
            continue;
        }
        String param = amount + "";
        if (!unit.checkParam(payParamFromUpkeep, param)) {
            return false;
        }
    }
    return true;
}
Also used : Formula(main.system.math.Formula) PARAMETER(main.content.values.parameters.PARAMETER)

Example 85 with PARAMETER

use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.

the class IntegrityRule method getIntegrityBonusInfo.

public static List<String> getIntegrityBonusInfo(Unit hero) {
    List<String> list = new ArrayList<>();
    int integrity = hero.getIntParam(PARAMS.INTEGRITY);
    int amount = getMasteryScoresBonus(integrity, hero);
    String string = " " + amount;
    if (amount > 0) {
        string = "+" + string;
    }
    if (integrity == 0) {
        list.add("No effect on Mastery Scores");
    } else {
        list.add(string + "% to all Mastery Scores");
    }
    String focusString = "";
    for (PARAMETER param : getIntegrityModifiedParameters()) {
        amount = getBonus(param, integrity, hero);
        string = amount + "% to " + param.getName();
        if (amount > 0) {
            string = "+" + string;
        }
        if (amount == 0) {
            list.add("No effect on " + param.getName());
        } else {
            if (param.getName().contains("Focus")) {
                if (focusString.isEmpty()) {
                    // w/o last
                    focusString += string;
                } else {
                    focusString += ", " + param.getName();
                }
            } else {
                list.add(string);
            }
        }
    }
    list.add(focusString);
    return list;
}
Also used : ArrayList(java.util.ArrayList) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

PARAMETER (main.content.values.parameters.PARAMETER)136 PROPERTY (main.content.values.properties.PROPERTY)22 ObjType (main.entity.type.ObjType)13 ArrayList (java.util.ArrayList)12 Formula (main.system.math.Formula)12 Ref (main.entity.Ref)9 VALUE (main.content.VALUE)7 Obj (main.entity.obj.Obj)7 PARAMS (eidolons.content.PARAMS)6 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)5 Cost (main.elements.costs.Cost)5 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)4 G_Panel (main.swing.generic.components.G_Panel)4 Node (org.w3c.dom.Node)4 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)3 HashMap (java.util.HashMap)3 DAMAGE_TYPE (main.content.enums.GenericEnums.DAMAGE_TYPE)3 Costs (main.elements.costs.Costs)3 Entity (main.entity.Entity)3 GraphicComponent (main.swing.generic.components.misc.GraphicComponent)3