Search in sources :

Example 56 with PARAMETER

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

the class ContentManager method getValue.

public static VALUE getValue(String valueName, boolean extensiveSearch) {
    if (StringMaster.isEmpty(valueName)) {
        return null;
    }
    if (LOWER_CASE_CACHED)
        valueName = valueName.toLowerCase();
    VALUE v = propCache.get(valueName);
    if (v != null) {
        if (!checkExcluded(v)) {
            return v;
        }
    }
    v = paramCache.get(valueName);
    if (v != null) {
        if (!checkExcluded(v)) {
            return v;
        }
    }
    v = getPROP(valueName, true);
    if (v == null) {
        v = getPARAM(valueName, true);
    }
    if (v == null) {
        if (extensiveSearch) {
            v = getPROP(valueName, false);
            if (v == null) {
                v = getPARAM(valueName, false);
            }
            PROPERTY prop = findPROP(valueName);
            PARAMETER param = findPARAM(valueName);
            if (prop != null && param != null) {
                v = StringMaster.compareSimilar(prop.toString(), valueName) >= StringMaster.compareSimilar(param.toString(), valueName) ? prop : param;
            } else if (prop != null) {
                v = prop;
            } else {
                v = param;
            }
        // //compare length difference?
        // //cache key to value
        }
        if (v == null) {
            LogMaster.log(LogMaster.CORE_DEBUG, "VALUE NOT FOUND: " + valueName);
        }
    }
    return v;
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) PARAMETER(main.content.values.parameters.PARAMETER)

Example 57 with PARAMETER

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

the class ContentManager method getPercentageParam.

// TODO refactor?
// public static PARAMETER getParameterVersion(PARAMETER param, String versionId) {
// Map<PARAMETER, PARAMETER> cache = getCache(versionId);
// }
public static PARAMETER getPercentageParam(PARAMETER param) {
    if (param.isDynamic() && param.name().startsWith(StringMaster.CURRENT)) {
        param = getBaseParameterFromCurrent(param);
    }
    PARAMETER percParam = percCache.get(param);
    if (percParam != null) {
        return percParam;
    }
    if (param.name().startsWith(StringMaster.CURRENT))
        return param;
    percParam = getPARAM(param.getName() + StringMaster.PERCENTAGE);
    percCache.put(param, percParam);
    return percParam;
}
Also used : PARAMETER(main.content.values.parameters.PARAMETER)

Example 58 with PARAMETER

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

the class ContentManager method initUnitParams.

private static void initUnitParams() {
    unitParameters = new ArrayList<>(getParamList().size());
    for (PARAMETER p : getParamList()) {
        if (p.getEntityType().equals(DC_TYPE.UNITS.getName())) {
            unitParameters.add(p);
            continue;
        }
        if (Arrays.asList(p.getEntityTypes()).contains((DC_TYPE.UNITS.getName()))) {
            unitParameters.add(p);
        }
    }
    filteredUnitParameters = new ArrayList<>(unitParameters.size());
    for (PARAMETER p : unitParameters) {
        if (!p.isDynamic()) {
            if (!p.isLowPriority()) {
                filteredUnitParameters.add(p);
            }
        }
    }
}
Also used : PARAMETER(main.content.values.parameters.PARAMETER)

Example 59 with PARAMETER

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

the class PriorityManagerImpl method getModePriority.

@Override
public int getModePriority(Unit unit, STD_MODES mode) {
    PARAMETER p = ContentManager.getPARAM(mode.getParameter());
    if (p == null) {
        return 0;
    }
    Integer percentage = unit.getIntParam(ContentManager.getPercentageParam(new Param(ContentManager.getBaseParameterFromCurrent(p)))) / MathMaster.MULTIPLIER;
    // how important/good it is for
    int base = 100 - percentage;
    // this unit
    // how important/good is it now
    int paramModifier = getParamAnalyzer().getParamPriority(p, unit);
    int dangerModifier = 100;
    switch(mode) {
        case MEDITATION:
            if (ParamAnalyzer.isEssenceIgnore(unit))
                return 0;
            base = getSituationAnalyzer().getCastingPriority(unit);
        case CONCENTRATION:
        case RESTING:
            dangerModifier = getSituationAnalyzer().getMeleeDangerFactor(unit, false, true);
            dangerModifier -= getSituationAnalyzer().getRangedDangerFactor(unit);
            addMultiplier(base, "param percentage missing");
            base = base * getRestorationPriorityMod(unit) / 100;
            break;
        default:
            return 0;
    }
    // addMultiplier(base, "param percentage missing");
    // ++ Life factor?
    int timeModifier = 100 + getSituationAnalyzer().getTimeModifier() - getUnit().getParamPercentage(PARAMS.N_OF_ACTIONS);
    addMultiplier(timeModifier, "time");
    applyMultiplier(paramModifier, "param Modifier");
    applyMultiplier(dangerModifier, "danger factor");
    return base;
// modifier * (DEFAULT_PRIORITY - percentage) / factor;
}
Also used : Param(main.content.values.parameters.Param) PARAMETER(main.content.values.parameters.PARAMETER)

Example 60 with PARAMETER

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

the class EffectFinder method initParamModEffects.

public static void initParamModEffects(Effects modEffects, Map<PARAMETER, String> map, Ref ref) {
    for (PARAMETER param : map.keySet()) {
        String amount = map.get(param);
        MOD code = MOD.MODIFY_BY_CONST;
        if (!amount.contains(StringMaster.BASE_CHAR)) {
            if (amount.contains(StringMaster.MOD)) {
                code = MOD.MODIFY_BY_PERCENT;
                amount = amount.replace(StringMaster.MOD, "");
            }
            if (amount.contains(StringMaster.SET)) {
                code = MOD.SET;
                amount = amount.replace(StringMaster.SET, "");
            }
        }
        if (ref.getId(KEYS.INFO) == null) {
            ref.setID(KEYS.INFO, ref.getId(KEYS.SKILL));
        }
        amount = TextParser.parse(amount, ref, TextParser.INFO_PARSING_CODE);
        modEffects.add(new ModifyValueEffect(param, code, amount));
    }
}
Also used : MOD(main.ability.effects.Effect.MOD) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) 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