Search in sources :

Example 51 with PARAMETER

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;
    }
}
Also used : PARAMETER(main.content.values.parameters.PARAMETER)

Example 52 with PARAMETER

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);
        }
    }
}
Also used : PARAMETER(main.content.values.parameters.PARAMETER)

Example 53 with PARAMETER

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);
    }
}
Also used : ObjType(main.entity.type.ObjType) PARAMETER(main.content.values.parameters.PARAMETER)

Example 54 with PARAMETER

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>());
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) Param(main.content.values.parameters.Param) PARAMETER(main.content.values.parameters.PARAMETER)

Example 55 with 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;
}
Also used : 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