Search in sources :

Example 21 with PARAMS

use of eidolons.content.PARAMS in project Eidolons by IDemiurge.

the class TextMaster method initValueDescriptionsFolder.

public static void initValueDescriptionsFolder() {
    for (PARAMS p : PARAMS.values()) {
        String path = getParamsPath();
        String name = p.getName();
        if (p.isMastery()) {
            path += "mastery\\";
        }
        if (p.isAttribute()) {
            path += "attributes\\";
        }
        if (p.isDynamic()) {
            name = name.replace("c ", "");
        }
        String descr = FileManager.readFile(path + name);
        if (!descr.isEmpty()) {
            p.setDescr(descr);
        }
    }
    for (PROPS p : PROPS.values()) {
        String path = getPropsPath();
        String name = p.getName();
        if (p.isPrinciple()) {
            path += "principles\\";
        }
        String descr = FileManager.readFile(path + name);
        if (!descr.isEmpty()) {
            p.setDescr(descr);
        }
    }
}
Also used : PARAMS(eidolons.content.PARAMS) G_PROPS(main.content.values.properties.G_PROPS) PROPS(eidolons.content.PROPS)

Example 22 with PARAMS

use of eidolons.content.PARAMS in project Eidolons by IDemiurge.

the class XlsMaster method createSheet.

private static void createSheet(HSSFWorkbook workbook, DC_TYPE TYPE, String[] groups, PARAMS[] params, String[] formulas) {
    HSSFSheet sheet = workbook.createSheet(TYPE.getName());
    int row = 0;
    HSSFRow rowhead = sheet.createRow((short) row);
    rowhead.createCell(0).setCellValue("Name");
    int column = 1;
    for (String formula : formulas) {
        rowhead.createCell(column).setCellValue(formula.split(formula_sep)[0]);
        column++;
    }
    for (PARAMS param : params) {
        rowhead.createCell(column).setCellValue((param).getShortName());
        column++;
    }
    row++;
    for (String group : groups) {
        rowhead = sheet.createRow((short) row);
        row++;
        rowhead.createCell(0).setCellValue(group);
        for (ObjType objType : DataManager.getTypesGroup(TYPE, group)) {
            rowhead = sheet.createRow((short) row);
            row++;
            column = 0;
            rowhead.createCell(column).setCellValue(objType.getName());
            column++;
            final ObjType simUnit = DataManager.getType(simUnitName, C_OBJ_TYPE.UNITS_CHARS);
            Ref ref = new Ref() {

                @Override
                public ObjType getType(String string) {
                    if (string.equalsIgnoreCase(TYPE_KEY))
                        return objType;
                    return simUnit;
                }
            };
            Map<VALUE, Integer> valueMap = null;
            int simUnitRow = 0;
            // Map<VALUE, Integer> entityMap;
            for (String raw_formula : formulas) {
                String formula = getFormula(raw_formula, row, column, valueMap, simUnitRow);
                rowhead.createCell(column).setCellFormula(formula);
                column++;
            }
            for (PARAMS param : params) {
                rowhead.createCell(column).setCellValue(objType.getParam(param));
                column++;
            }
        }
    }
}
Also used : Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) HSSFRow(org.apache.poi.hssf.usermodel.HSSFRow) HSSFSheet(org.apache.poi.hssf.usermodel.HSSFSheet) PARAMS(eidolons.content.PARAMS) VALUE(main.content.VALUE)

Example 23 with PARAMS

use of eidolons.content.PARAMS in project Eidolons by IDemiurge.

the class ResistPanel method updateAct.

@Override
public void updateAct(float delta) {
    List<Pair<PARAMETER, String>> source = (List<Pair<PARAMETER, String>>) getUserObject();
    source.forEach(pair -> {
        PARAMS param = (PARAMS) pair.getLeft();
        DAMAGE_TYPE damageType = getFromParams(param);
        if (map.containsKey(damageType)) {
            final ValueContainer container = map.get(damageType);
            ValueTooltip valueTooltip = new ValueTooltip();
            valueTooltip.setUserObject((Supplier) () -> Arrays.asList(new ValueContainer(param.getName(), "")));
            container.addListener(valueTooltip.getController());
            container.updateValue(pair.getRight() + "%");
        }
    });
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE) PARAMS(eidolons.content.PARAMS) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Pair(org.apache.commons.lang3.tuple.Pair) PARAMETER(main.content.values.parameters.PARAMETER)

Example 24 with PARAMS

use of eidolons.content.PARAMS in project Eidolons by IDemiurge.

the class DC_FeatObj method applyRank.

private void applyRank() {
    Integer rank = getRank();
    if (rank == 0) {
        return;
    }
    Integer mod = rank * getRankFormulaMod();
    for (AbilityObj p : getPassives()) {
        // will affect AddParam effects?
        for (Ability a : p.getAbilities()) {
            for (Effect ef : a.getEffects()) {
                try {
                    ef.resetOriginalFormula();
                    ef.appendFormulaByMod(100 + mod);
                } catch (Exception e) {
                    main.system.ExceptionMaster.printStackTrace(e);
                }
            // some exceptions?
            /*
                     * how widely will this be used?
					 * mostly on simple low-level skills...
					 * but also on auras I guess...
					 * the point is to make things flexible, deeply customizable, and viable for 
					 * no-magic heroes...
					 * 
					 * it's true that with the amount of Masteries/Skills I may not need this on lower
					 * levels, but at some point I will! 
					 * 
					 * how will the rank be saved into hero data? 
					 * >> (var)
					 * >> special prop 
					 * >> prop per rank #
					 */
            }
        }
    }
    for (PARAMETER attr : ContentManager.getAttributes()) {
        PARAMS param = (PARAMS) attr;
        Integer value = getIntParam(param, true);
        if (value <= 0) {
            continue;
        }
        value += Math.round(value * mod / 100);
        setParam(param, value);
    }
    // modifyHeroParameters();
    for (PARAMETER param : DC_ContentManager.getFeatModifyingParams()) {
        Integer value = getIntParam(param, true);
        if (value == 0) {
            continue;
        }
        value += Math.round(value * mod / 100);
        setParam(param, value);
    }
    Integer sdMod = rank * getIntParam(PARAMS.RANK_SD_MOD);
    setParam(PARAMS.SKILL_DIFFICULTY, getIntParam(PARAMS.SKILL_DIFFICULTY, true));
    modifyParamByPercent(PARAMS.SKILL_DIFFICULTY, sdMod);
    rankApplied = true;
}
Also used : Ability(main.ability.Ability) AbilityObj(main.ability.AbilityObj) Effect(main.ability.effects.Effect) PARAMS(eidolons.content.PARAMS) PARAMETER(main.content.values.parameters.PARAMETER)

Example 25 with PARAMS

use of eidolons.content.PARAMS in project Eidolons by IDemiurge.

the class BuffRulesTest method buffRuleTest.

@Test
public void buffRuleTest() {
    // root_params
    int i = 0;
    for (PARAMS root_param : root_params) {
        // also test rule's state?
        Integer initial = entity.getIntParam(reduced_params[i]);
        entity.setParam(root_param, new Formula(value_low[i]).getInt(new Ref(entity)));
        game.getStateManager().reset(entity);
        Integer reduced = entity.getIntParam(reduced_params[i]);
        if (isReductionOn(root_param)) {
            printingAsserts.assertGreaterThanAndLog(initial, reduced, root_param + " rule");
        }
        if (!isIncreaseOn(root_param)) {
            i++;
            continue;
        }
        if (reduced_params[i] != increased_params[i]) {
            initial = entity.getIntParam(increased_params[i]);
        }
        entity.setParam(root_param, new Formula(value_high[i]).getInt(new Ref(entity)));
        game.getStateManager().reset(entity);
        Integer increased = entity.getIntParam(increased_params[i]);
        printingAsserts.assertGreaterThanAndLog(increased, initial, root_param + " rule");
        i++;
    }
}
Also used : Formula(main.system.math.Formula) Ref(main.entity.Ref) PARAMS(eidolons.content.PARAMS) CreateUnitTest(tests.entity.CreateUnitTest) Test(org.junit.Test)

Aggregations

PARAMS (eidolons.content.PARAMS)29 PARAMETER (main.content.values.parameters.PARAMETER)8 ArrayList (java.util.ArrayList)7 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)5 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)4 ValueTooltip (eidolons.libgdx.gui.tooltips.ValueTooltip)4 G_PROPS (main.content.values.properties.G_PROPS)4 Pair (org.apache.commons.lang3.tuple.Pair)4 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)3 DC_UnitAction (eidolons.entity.active.DC_UnitAction)3 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)3 Unit (eidolons.entity.obj.unit.Unit)3 Tooltip (eidolons.libgdx.gui.tooltips.Tooltip)3 TextureCache (eidolons.libgdx.texture.TextureCache)3 Arrays (java.util.Arrays)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 VALUE (main.content.VALUE)3 Ref (main.entity.Ref)3 ImageManager (main.system.images.ImageManager)3