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;
}
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;
}
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);
}
}
}
}
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;
}
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));
}
}
Aggregations