use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class ExplorationTimeMaster method processModeEffect.
// restore focus/morale
private void processModeEffect(Unit unit, MODE mode) {
if (mode.getParameter() == null)
return;
float last = unit.getAI().getExplorationTimeOfModeEffect();
float delta = time - last;
if (delta < 2)
return;
PARAMETER param = (ContentManager.getPARAM(mode.getParameter()));
PARAMETER base = ContentManager.getBaseParameterFromCurrent(param);
int value = getParamRestoration(delta, base, 1);
int max = base == PARAMS.FOCUS ? unit.getIntParam(PARAMS.STARTING_FOCUS) * 3 / 2 : unit.getIntParam(base);
if (base == PARAMS.FOCUS)
max += unit.getIntParam(PARAMS.FOCUS_RETAINMENT) * max / 100;
int min = 0;
if (unit.getGame().isDebugMode())
if (base != PARAMS.FOCUS) {
min = unit.getIntParam(base);
}
// max = unit.getIntParam(PARAMS.BASE_FOCUS);//*3/2;
// // unit.getIntParam(PARAMS.FOCUS_RETAINMENT) ;
value = MathMaster.getMinMax(value, min, max);
if (value > 0) {
unit.modifyParameter(param, value, max, true);
unit.resetPercentage(param);
unit.getAI().setExplorationTimeOfModeEffect(time);
guiDirtyFlag = true;
}
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class ExplorationTimeMaster method processRegen.
private void processRegen(Unit unit) {
// TODO
float last = unit.getAI().getExplorationTimeOfRegenEffects();
float delta = time - last;
for (PARAMETER param : DC_ContentManager.REGEN_PARAMS) {
int value = getParamRestoration(delta, param, unit.getParamFloat(ContentManager.getRegenParam(param)));
if (value > 0) {
unit.modifyParameter(ContentManager.getCurrentParam(param), value, unit.getIntParam(param), true);
unit.getAI().setExplorationTimeOfRegenEffects(time);
}
}
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class TableMouseListener method handleMouseClick.
public void handleMouseClick(MouseEvent e, boolean altDown) {
int row = table.getSelectedRow();
int column = table.getColumn(EditViewPanel.NAME).getModelIndex();
Object valueAt = table.getValueAt(row, column);
VALUE val = ContentManager.getValue(valueAt.toString());
String value;
ObjType selectedType = (second) ? ArcaneVault.getPreviousSelectedType() : ArcaneVault.getSelectedType();
if (val != null) {
value = selectedType.getValue(val);
} else {
value = table.getValueAt(row, 1).toString();
}
if (altHandler != null) {
if (altHandler.checkClickProcessed(e, selectedType, val, value)) {
return;
}
}
// table.setRowSelectionInterval(row, row);
if (altDown || e.isControlDown()) // SwingUtilities.isRightMouseButton(e)
{
if (val instanceof PARAMETER && (val != PARAMS.FORMULA)) {
new NumberEditor().launch(table, row, column, value);
return;
}
textEditor.launch(table, row, column, value, getEditorByValueName(valueAt) == null);
return;
}
EDITOR editor = getEditorByValueName(valueAt);
// TODO lazy editor init!
if (editor instanceof ListEditor) {
((ListEditor) editor).setBASE_TYPE(selectedType.getOBJ_TYPE_ENUM());
((ListEditor) editor).setEntity(selectedType);
}
if (editor != null) {
try {
editor.launch(table, row, column, value);
} catch (NullPointerException ex) {
main.system.ExceptionMaster.printStackTrace(ex);
handleMouseClick(e, true);
} catch (Exception ex) {
main.system.ExceptionMaster.printStackTrace(ex);
}
} else {
// decorators
launchDefault(table, row, column, value);
}
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class ContentManager method init.
public static void init(ArrayList<PROPERTY> propz, ArrayList<PARAMETER> paramz) {
props = propz;
params = paramz;
sparams = new ArrayList<>(params.size());
sprops = new ArrayList<>(props.size());
propCache = new HashMap<>(props.size() * 3 / 2);
for (PROPERTY p : props) {
String name = p.getName();
sprops.add(name);
if (LOWER_CASE_CACHED)
name = name.toLowerCase();
propCache.put(name, p);
}
paramCache = new HashMap<>(params.size() * 3 / 2);
for (PARAMETER p : params) {
String name = p.getName();
sparams.add(name);
if (LOWER_CASE_CACHED)
name = name.toLowerCase();
paramCache.put(name, p);
if (p.isAttribute()) {
getAttributes().add(p);
}
if (p.isMastery()) {
if (p instanceof Param) {
getMasteryScores().add(p);
} else {
getMasteries().add(p);
}
}
if (checkParamPerLevel(p)) {
getPerLevelParams().add(p);
}
}
// Collections.sort(props, new DefaultComparator<PROPERTY>());
// Collections.sort(params, new DefaultComparator<PARAMETER>());
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class ContentManager method getCurrentParam.
public static PARAMETER getCurrentParam(PARAMETER param) {
PARAMETER cParam = currentCache.get(param);
if (cParam != null) {
return cParam;
}
if (param.name().startsWith(StringMaster.CURRENT))
return param;
cParam = getPARAM(StringMaster.CURRENT + param.getName(), true);
currentCache.put(param, cParam);
return cParam;
}
Aggregations