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