Search in sources :

Example 11 with VALUE

use of main.content.VALUE in project Eidolons by IDemiurge.

the class ValuePageManager method getAdditionalPage.

private static List<VALUE> getAdditionalPage(boolean av, List<List<VALUE>> list, OBJ_TYPE TYPE, boolean prop) {
    List<VALUE> page = getAdditionalPages(av, prop).get(TYPE);
    if (page == null) {
        page = new ArrayList<>();
        for (VALUE p : (!prop) ? ContentManager.getParamsForType(TYPE.getName(), !av) : ContentManager.getPropsForType(TYPE.getName(), !av)) {
            if (!ContentManager.isValueForOBJ_TYPE(TYPE, p)) {
                continue;
            }
            if (checkValueInPages(list, p)) {
                continue;
            }
            page.add(p);
        }
        getAdditionalPages(av, prop).put(TYPE, page);
    }
    return page;
}
Also used : VALUE(main.content.VALUE)

Example 12 with VALUE

use of main.content.VALUE in project Eidolons by IDemiurge.

the class AttackTooltipFactory method createAttackTooltip.

public static AttackTooltip createAttackTooltip(DC_UnitAction el, boolean precalc, boolean costs, boolean additionalInfo, boolean combatMode, DC_Obj target) {
    Pair<PARAMS, PARAMS> pair = ACTION_TOOLTIPS_PARAMS_MAP.get(ACTION_TOOLTIP_HEADER_KEY);
    String name = ActionTooltipMaster.getStringForTableValue(ACTION_TOOLTIP_HEADER_KEY, el);
    final String leftImage = ActionTooltipMaster.getIconPathForTableRow(pair.getLeft());
    final String rightImage = ActionTooltipMaster.getIconPathForTableRow(pair.getRight());
    MultiValueContainer head = new MultiValueContainer(name, leftImage, rightImage);
    VALUE[] baseKeys = ACTION_TOOLTIP_BASE_KEYS;
    final List<MultiValueContainer> base = extractActionValues(el, baseKeys);
    baseKeys = ACTION_TOOLTIP_RANGE_KEYS;
    final List<MultiValueContainer> range = extractActionValues(el, baseKeys);
    List /*<List<MultiValueContainer>>*/
    textsList = new ArrayList<>();
    for (PARAMS[] params : ACTION_TOOLTIP_PARAMS_TEXT) {
        textsList.add(Arrays.stream(params).map(p -> {
            String textForTableValue = ActionTooltipMaster.getTextForTableValue(p, el);
            textForTableValue = TextWrapper.wrapWithNewLine(textForTableValue, 50);
            if (StringUtils.isEmpty(textForTableValue)) {
                return null;
            } else {
                return new MultiValueContainer(textForTableValue, "");
            }
        }).filter(Objects::nonNull).collect(Collectors.toList()));
    }
    AttackTooltip toolTip = new AttackTooltip(el);
    ValueContainer precalcRow = createPrecalcRow(precalc, el, target);
    toolTip.setUserObject(new ActionTooltipSource() {

        @Override
        public MultiValueContainer getHead() {
            return head;
        }

        @Override
        public List<MultiValueContainer> getBase() {
            return base;
        }

        @Override
        public List<MultiValueContainer> getRange() {
            return range;
        }

        @Override
        public List<List<ValueContainer>> getText() {
            return textsList;
        }

        @Override
        public CostTableSource getCostsSource() {
            return () -> ActionCostSourceImpl.getActionCostList(el);
        }

        @Override
        public ValueContainer getPrecalcRow() {
            return precalcRow;
        }
    });
    return toolTip;
}
Also used : UNIT_INFO_PARAMS(eidolons.content.UNIT_INFO_PARAMS) Arrays(java.util.Arrays) PARAMS(eidolons.content.PARAMS) TextWrapper(main.system.text.TextWrapper) MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) StringUtils(org.apache.commons.lang3.StringUtils) Function(java.util.function.Function) ActionCostSourceImpl(eidolons.libgdx.gui.panels.dc.actionpanel.datasource.ActionCostSourceImpl) ArrayList(java.util.ArrayList) Pair(org.apache.commons.lang3.tuple.Pair) FutureBuilder(eidolons.game.battlecraft.ai.tools.future.FutureBuilder) Tooltip(eidolons.libgdx.gui.tooltips.Tooltip) G_PROPS(main.content.values.properties.G_PROPS) DC_Obj(eidolons.entity.obj.DC_Obj) DC_UnitAction(eidolons.entity.active.DC_UnitAction) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) Obj(main.entity.obj.Obj) Collectors(java.util.stream.Collectors) ImageManager(main.system.images.ImageManager) Objects(java.util.Objects) List(java.util.List) TextureCache(eidolons.libgdx.texture.TextureCache) ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE) VALUE(main.content.VALUE) ArrayList(java.util.ArrayList) VALUE(main.content.VALUE) MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) Objects(java.util.Objects) ArrayList(java.util.ArrayList) List(java.util.List) UNIT_INFO_PARAMS(eidolons.content.UNIT_INFO_PARAMS) PARAMS(eidolons.content.PARAMS) MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer)

Example 13 with VALUE

use of main.content.VALUE in project Eidolons by IDemiurge.

the class AttackTooltipFactory method extractActionValues.

private static List<MultiValueContainer> extractActionValues(DC_UnitAction el, VALUE[] baseKeys) {
    List<MultiValueContainer> list = new ArrayList<>();
    Pair<PARAMS, PARAMS> pair;
    for (VALUE key : baseKeys) {
        pair = ACTION_TOOLTIPS_PARAMS_MAP.get(key);
        String name = ActionTooltipMaster.getStringForTableValue(key, el);
        String imagePath = ActionTooltipMaster.getIconPathForTableRow(key);
        final String leftVal = ActionTooltipMaster.getValueForTableParam(pair.getLeft(), el);
        final String rightVal = ActionTooltipMaster.getValueForTableParam(pair.getRight(), el);
        MultiValueContainer mvc;
        if (!ImageManager.isImage(imagePath)) {
            mvc = new MultiValueContainer(name, leftVal, rightVal);
        } else {
            mvc = new MultiValueContainer(TextureCache.getOrCreateR(imagePath), name, leftVal, rightVal);
        }
        list.add(mvc);
    }
    return list;
}
Also used : MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) ArrayList(java.util.ArrayList) UNIT_INFO_PARAMS(eidolons.content.UNIT_INFO_PARAMS) PARAMS(eidolons.content.PARAMS) VALUE(main.content.VALUE)

Example 14 with VALUE

use of main.content.VALUE in project Eidolons by IDemiurge.

the class BackgroundChoiceView method applyBackground.

private void applyBackground(Unit hero, ObjType bgType) {
    ObjType type = hero.getType();
    type.setProperty(G_PROPS.BASE_TYPE, bgType.getName());
    type.setProperty(G_PROPS.BACKGROUND_TYPE, bgType.getName());
    List<VALUE> backgroundParams = DC_ContentManager.getBackgroundStaticValues();
    for (VALUE v : backgroundParams) {
        if (v instanceof PARAMETER) {
            if (v.isWriteToType()) {
                hero.modifyParameter((PARAMETER) v, bgType.getIntParam((PARAMETER) v));
            } else {
                type.modifyParameter((PARAMETER) v, bgType.getIntParam((PARAMETER) v));
            }
        // type.multiplyParamByPercent((PARAMETER) v, 50, false);// TODO
        // feeble
        // fix!
        } else if (v instanceof PROPERTY) {
            type.setProperty((PROPERTY) v, bgType.getProperty((PROPERTY) v));
        }
    }
    hero.toBase();
}
Also used : ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) VALUE(main.content.VALUE) PARAMETER(main.content.values.parameters.PARAMETER)

Example 15 with VALUE

use of main.content.VALUE in project Eidolons by IDemiurge.

the class TextGenerator method generatePerkParamBonuses.

public static String generatePerkParamBonuses(Entity e) {
    List<List<VALUE>> pages = ValuePageManager.getValuesForHCInfoPages(e.getOBJ_TYPE_ENUM());
    String string = PREFIX;
    for (List<VALUE> list : pages) {
        boolean prop = false;
        for (VALUE v : list) {
            if (v instanceof PARAMETER) {
                if (!ContentManager.isValueForOBJ_TYPE(DC_TYPE.CHARS, v)) {
                    continue;
                }
                String amount = e.getValue(v);
                amount = TextParser.parse(amount, e.getRef());
                int n = new Formula(amount).getInt(e.getRef());
                if (n != 0) {
                    string += n + " " + v.getName() + ", ";
                }
            } else {
                prop = true;
                break;
            }
        }
        if (!prop && !list.equals(pages.get(pages.size() - 1))) {
            string += StringMaster.NEW_LINE;
        }
    }
    // StringMaster.replaceLast(" ," "and
    string.substring(0, string.length() - 2);
    return string;
}
Also used : Formula(main.system.math.Formula) List(java.util.List) VALUE(main.content.VALUE) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

VALUE (main.content.VALUE)33 ObjType (main.entity.type.ObjType)8 PARAMETER (main.content.values.parameters.PARAMETER)7 ArrayList (java.util.ArrayList)5 PROPERTY (main.content.values.properties.PROPERTY)5 PARAMS (eidolons.content.PARAMS)3 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)2 MultiValueContainer (eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer)2 List (java.util.List)2 OBJ_TYPE (main.content.OBJ_TYPE)2 G_PROPS (main.content.values.properties.G_PROPS)2 Obj (main.entity.obj.Obj)2 Formula (main.system.math.Formula)2 ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)1 EntityChoiceView (eidolons.client.cc.gui.neo.choice.EntityChoiceView)1 SequenceManager (eidolons.client.dc.SequenceManager)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Unit (eidolons.entity.obj.unit.Unit)1 FutureBuilder (eidolons.game.battlecraft.ai.tools.future.FutureBuilder)1