Search in sources :

Example 26 with PARAMS

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

the class ItemGenerator method initParams.

private static void initParams(QUALITY_LEVEL quality, MATERIAL material, ObjType newType, PARAMS[] params, PARAMS[] mod_params) {
    int n = newType.getIntParam(PARAMS.MATERIAL_QUANTITY);
    newType.modifyParameter(PARAMS.WEIGHT, (int) Math.round(material.getWeight() * n));
    int i = 0;
    for (PARAMS p : mod_params) {
        int amount;
        int modifier = material.getModifier();
        if (p == PARAMS.DURABILITY_MODIFIER) {
            if (material.getDurabilityMod() != 0) {
                modifier = material.getDurabilityMod();
            }
        }
        if (p == PARAMS.DICE) {
            amount = // newType.getIntParam(portrait) *
            modifier / // TODO DICE ALREADY USED, DIE_SIZE TO BE SET FOR WEAPONS!
            2;
        } else if (p == PARAMS.ARMOR_MODIFIER) {
            // TODO *NEW
            amount = newType.getIntParam(PARAMS.ARMOR_LAYERS) * modifier * ARMOR_MODIFIER;
        // Integer cover = newType.getIntParam(PARAMS.COVER_PERCENTAGE);
        // Integer layers = newType.getIntParam(PARAMS.ARMOR_LAYERS);
        // Integer pieces =
        // newType.getIntParam(PARAMS.MATERIAL_QUANTITY);
        // System.out.println(newType.getName() + " has " + cover +
        // " cover, " + pieces
        // + " pieces, " + amount + " armor");
        } else {
            amount = newType.getIntParam(p) * modifier * n / 100;
        }
        newType.modifyParameter(params[i], amount, null, true);
        i++;
    }
    boolean magicApplied = false;
    if (newType.getOBJ_TYPE_ENUM() == DC_TYPE.ARMOR) {
        if (!isBasicMode())
            ContentGenerator.generateArmorPerDamageType(newType, material);
    // TODO [UPDATED]
    // if (material.getResistances() != null)
    // for (String s :
    // StringMaster.openContainer(material.getResistances())) {
    // Integer base =
    // StringMaster.getInteger(VariableManager.getVarPart(s));
    // int durabilityMod = quality.getDurabilityMod();
    // if (base < 0)
    // durabilityMod = 100 - (durabilityMod - 100) / 2;
    // 
    // String amount = n + "*" + base;
    // amount = durabilityMod + "*" +
    // StringMaster.wrapInParenthesis(amount) + "/100";
    // newType.modifyParameter(VariableManager.removeVarPart(s) +
    // " Resistance",
    // amount);
    // magicApplied = true;
    // }
    } else {
        if (material.getDmg_type() != null) {
            // MAGICAL MATERIALS
            int perc = (int) Math.round(material.getEnchantmentCapacity() / SPELL_DAMAGE_FACTOR * Math.sqrt(n));
            perc = MathMaster.applyMod(perc, quality.getDurabilityMod());
            String abilName = "DamagePercOnAttackThis";
            String appendix = " deals an additional " + perc + "% of " + material.getDmg_type().getName() + " damage on each successful hit";
            if (StringMaster.contains(ItemEnums.WEAPON_GROUP.TOWER_SHIELDS + "|" + ItemEnums.WEAPON_GROUP.BUCKLERS + "|" + ItemEnums.WEAPON_GROUP.SHIELDS, newType.getProperty(G_PROPS.WEAPON_GROUP))) {
                // TODO APPENDIX
                abilName = "DamagePercOnHitThis";
            } else if (newType.getProperty(G_PROPS.WEAPON_GROUP).equalsIgnoreCase("" + ItemEnums.WEAPON_GROUP.WANDS)) {
                abilName = "DamagePercOnSpellImpact";
            } else if (newType.getProperty(G_PROPS.WEAPON_GROUP).equalsIgnoreCase("" + ItemEnums.WEAPON_GROUP.ORBS)) {
                abilName = "DamagePercOnSpellHit";
            }
            newType.addProperty(G_PROPS.PASSIVES, abilName + StringMaster.wrapInParenthesis(perc + "," + material.getDmg_type().getName()));
            newType.appendProperty(G_PROPS.DESCRIPTION, StringMaster.NEW_LINE + material.getName() + ": " + appendix);
            magicApplied = true;
        }
    }
    Integer mod = newType.getIntParam(PARAMS.COST_MODIFIER);
    if (mod <= 0) {
        mod = 100;
    }
    newType.modifyParameter(PARAMS.GOLD_COST, material.getCost() * n * mod / 100);
    newType.setParameter(PARAMS.HARDNESS, material.getHardness());
    // if (new EnumMaster<WEAPON_GROUP>().retrieveEnumConst(WEAPON_GROUP.class, newType
    // .getProperty(G_PROPS.WEAPON_GROUP)) == ItemEnums.WEAPON_GROUP.SHIELDS) {
    // newType.setParam(PARAMS.ARMOR, newType.getIntParam(PARAMS.DAMAGE_BONUS));
    // TODO       ContentGenerator.generateArmorPerDamageType(newType, material);
    // }
    mod = quality.getDurabilityMod();
    if (mod > 0 && mod != 100) {
        newType.multiplyParamByPercent(PARAMS.DURABILITY, mod, false);
    }
    mod = quality.getCostMod();
    if (mod > 0 && mod != 100) {
        newType.multiplyParamByPercent(PARAMS.GOLD_COST, mod, false);
    }
    if (magicApplied) {
        newType.multiplyParamByPercent(PARAMS.GOLD_COST, mod, false);
    }
    newType.modifyParameter(PARAMS.ENCHANTMENT_CAPACITY, n * material.getEnchantmentCapacity());
// PARAMS.DICE min/max? special dmg category?
}
Also used : PARAMS(eidolons.content.PARAMS)

Example 27 with PARAMS

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

the class AttributeMaster method getAttributeBonusInfoStrings.

public static List<String> getAttributeBonusInfoStrings(ATTRIBUTE attr, Unit hero) {
    List<String> list = new ArrayList<>();
    Object key;
    key = StringMaster.getWellFormattedString(attr.name());
    for (PARAMS p : attr.getParams()) {
        Map<String, Double> map = hero.getModifierMaps().get(p);
        if (map == null) {
            continue;
        }
        Double amount = map.get(key);
        if (amount == null) {
            continue;
        }
        String string = "+";
        if (amount < 0) {
            string = "-";
        }
        string += StringMaster.wrapInBraces("" + amount) + " " + p.getName();
        list.add(string);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) PARAMS(eidolons.content.PARAMS)

Example 28 with PARAMS

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

the class UnitLevelManager method buyPoint.

public boolean buyPoint(boolean attr, boolean gold, Entity type) {
    PARAMS cost_param = (gold) ? PARAMS.GOLD : PARAMS.XP;
    PARAMS param = (attr) ? PARAMS.ATTR_POINTS : PARAMS.MASTERY_POINTS;
    PARAMS buyParam = (attr) ? (gold) ? PARAMS.ATTR_BOUGHT_WITH_GOLD : PARAMS.ATTR_BOUGHT_WITH_XP : (gold) ? PARAMS.MASTERY_BOUGHT_WITH_GOLD : PARAMS.MASTERY_BOUGHT_WITH_XP;
    int amount = DC_MathManager.getBuyCost(attr, gold, type);
    if (((gold) ? type.getIntParam(PARAMS.GOLD) : type.getIntParam(PARAMS.XP)) < amount) {
        return false;
    }
    type.modifyParameter(cost_param, -amount);
    type.modifyParameter(param, 1);
    type.modifyParameter(buyParam, 1);
    return true;
}
Also used : PARAMS(eidolons.content.PARAMS)

Example 29 with PARAMS

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

the class UnitLevelManager method up.

public void up(Entity newType, int i, boolean attrs) {
    PARAMS perLevel = (attrs) ? PARAMS.ATTR_POINTS_PER_LEVEL : PARAMS.MASTERY_POINTS_PER_LEVEL;
    Integer attrsPerLevel = newType.getIntParam(perLevel);
    if (attrsPerLevel <= 0) {
        int forLevel = newType.getLevel() * DC_Formulas.getPointsPerLevelIncrease(newType, attrs);
        attrsPerLevel = forLevel + DC_Formulas.getAttrPointsPerLevelDefault(newType);
        newType.setParam(perLevel, attrsPerLevel);
        newType.modifyParameter(perLevel, forLevel);
    }
    PARAMS pointsParam = (attrs) ? PARAMS.ATTR_POINTS : PARAMS.MASTERY_POINTS;
    newType.modifyParameter(pointsParam, attrsPerLevel);
    Integer points = newType.getIntParam(pointsParam);
    newType.modifyParameter(perLevel, DC_Formulas.getPointsPerLevelIncrease(newType, attrs));
    // double for monsters?
    spendPoints(points, newType, attrs);
}
Also used : PARAMS(eidolons.content.PARAMS)

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