Search in sources :

Example 91 with PARAMETER

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;
}
Also used : ArrayList(java.util.ArrayList) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) PARAMETER(main.content.values.parameters.PARAMETER)

Example 92 with PARAMETER

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);
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) Property(main.system.math.Property) PARAMETER(main.content.values.parameters.PARAMETER) HashSet(java.util.HashSet)

Example 93 with PARAMETER

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++;
    }
}
Also used : G_Panel(main.swing.generic.components.G_Panel) ValueBar(main.swing.generic.misc.ValueBar) PARAMETER(main.content.values.parameters.PARAMETER)

Example 94 with PARAMETER

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);
}
Also used : G_List(main.swing.generic.components.list.G_List) G_Panel(main.swing.generic.components.G_Panel) PARAMETER(main.content.values.parameters.PARAMETER)

Example 95 with PARAMETER

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