use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class ActionCostSourceImpl method getActionCostList.
public static List<ValueContainer> getActionCostList(DC_ActiveObj el) {
List<ValueContainer> costsList = new ArrayList<>();
for (int i = 0, costsLength = RESOURCE_COSTS.length; i < costsLength; i++) {
PARAMETER cost = RESOURCE_COSTS[i];
final double param = el.getParamDouble(cost);
String text = String.format(Locale.US, "%.1f", param);
if (cost == PARAMS.AP_COST) {
if (DC_Engine.isAtbMode()) {
text = MathMaster.round((float) (param * AtbController.ATB_MOD)) + "%";
}
}
if (param > 0) {
final String iconPath = ImageManager.getValueIconPath(COSTS_ICON_PARAMS[i]);
costsList.add(new ValueContainer(getOrCreateR(iconPath), text));
}
}
final double reqRes = el.getParamDouble(MIN_REQ_RES_FOR_USE.getLeft());
if (reqRes > 0) {
final String iconPath = ImageManager.getValueIconPath(MIN_REQ_RES_FOR_USE.getRight());
costsList.add(new ValueContainer(getOrCreateR(iconPath), String.format(Locale.US, "> %.1f", reqRes)));
}
return costsList;
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class EntityResetter method toBase.
public void toBase() {
getPropCache().clear();
// TODO [OPTIMIZED] no need to clear
getEntity().getIntegerMap(false).clear();
// type's map?
if (getEntity().getModifierMaps() != null) {
// remember? For interesting spells or log
getEntity().getModifierMaps().clear();
}
// info...
if (!getType().checkProperty(G_PROPS.DISPLAYED_NAME)) {
getEntity().setProperty(G_PROPS.DISPLAYED_NAME, getName(), true);
}
if (this.getEntity().getOwner() != getEntity().getOriginalOwner()) {
LogMaster.log(LogMaster.CORE_DEBUG, getName() + ": original owner restored!");
}
getEntity().setOwner(getEntity().getOriginalOwner());
HashSet<PARAMETER> params = new HashSet<>(getEntity().getParamMap().keySet());
params.addAll(getType().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);
getEntity().getValueCache().put(p, value);
if (!value.equals(baseValue)) {
String amount = getType().getParam(p);
if (getEntity().isTypeLinked()) {
getType().getParamMap().put(p, value);
}
getEntity().getParamMap().put(p, amount);
if (game.isStarted() && !game.isSimulation()) {
if (p.isDynamic()) {
getEntity().fireParamEvent(p, amount, CONSTRUCTED_EVENT_TYPE.PARAM_MODIFIED);
}
}
}
}
HashSet<PROPERTY> props = new HashSet<>(getEntity().getPropMap().keySet());
props.addAll(getType().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(getRef());
if ((baseValue) == null) {
baseValue = getType().getProperty(p);
}
}
String value = getProperty(p);
getEntity().getValueCache().put(p, value);
if (!value.equals(baseValue)) {
if (getEntity().isTypeLinked()) {
getType().getPropMap().put(p, value);
}
getEntity().getPropMap().put(p, baseValue);
} else {
// TODO ???
if (getEntity().isTypeLinked()) {
getType().getPropMap().put(p, value);
}
getEntity().getPropMap().put(p, baseValue);
}
}
resetStatus();
getEntity().setDirty(false);
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class BarPanel method initBars.
public void initBars() {
panel = new G_Panel("flowy");
int i = 0;
for (PARAMETER v : vals) {
ValueBar valueBar = new ValueBar(v, colors.get(i)) {
public void refresh() {
super.refresh();
c_val = max_val;
max_val = 100;
percentage = c_val * MathMaster.MULTIPLIER / max_val;
}
protected PARAMETER getPercentageParameter(PARAMETER param) {
return null;
}
};
bars.put(v, valueBar);
panel.add(valueBar, "w " + getWidth() + ",h " + getHeight());
i++;
}
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class FormulaBuilder method initParamTab.
private void initParamTab() {
Collection<PARAMETER> data = ContentManager.getParamList();
G_List<PARAMETER> c = new G_List<>(data);
G_Panel panel = new G_Panel();
panel.add(c, "pos 0 0");
String title = PARAMS;
tabs.addTab(c, title, null);
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class Obj method cloneMaps.
@Override
public void cloneMaps(DataModel type) {
this.propMap = clonePropMap(type.getPropMap().getMap());
// values?
for (PARAMETER p : type.getParamMap().getMap().keySet()) {
if (!p.isDynamic()) {
paramMap.remove(p);
}
}
for (PARAMETER p : type.getParamMap().getMap().keySet()) {
paramMap.put(p, type.getParamMap().getMap().get(p));
}
setDirty(true);
}
Aggregations