Search in sources :

Example 1 with RESIST_GRADE

use of main.content.enums.GenericEnums.RESIST_GRADE in project Eidolons by IDemiurge.

the class ResistMaster method initUnitResistances.

public static void initUnitResistances(Unit unit) {
    int resist = unit.getIntParam(PARAMS.RESISTANCE);
    for (DAMAGE_TYPE dmg_type : GenericEnums.DAMAGE_TYPE.values()) {
        PARAMETER resistForDmgType = DC_ContentManager.getResistForDmgType(dmg_type);
        if (resistForDmgType != null) {
            if (dmg_type.isMagical()) {
                RESIST_GRADE grade = new EnumMaster<RESIST_GRADE>().retrieveEnumConst(RESIST_GRADE.class, unit.getProperty(DC_ContentManager.getResistGradeForDmgType(dmg_type)));
                if (grade == null) {
                    grade = GenericEnums.RESIST_GRADE.Normal;
                }
                int amount = resist * grade.getPercent() / 100;
                unit.modifyParameter(resistForDmgType, amount);
            }
        }
    }
}
Also used : RESIST_GRADE(main.content.enums.GenericEnums.RESIST_GRADE) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE) PARAMETER(main.content.values.parameters.PARAMETER)

Example 2 with RESIST_GRADE

use of main.content.enums.GenericEnums.RESIST_GRADE in project Eidolons by IDemiurge.

the class ContentGenerator method getDefaultSelfDamageMap.

private static Map<DAMAGE_TYPE, RESIST_GRADE> getDefaultSelfDamageMap(ITEM_MATERIAL_GROUP group) {
    Map<DAMAGE_TYPE, RESIST_GRADE> map = new HashMap<>();
    for (DAMAGE_TYPE dmg_type : GenericEnums.DAMAGE_TYPE.values()) {
        if (!dmg_type.isMagical()) {
            map.put(dmg_type, GenericEnums.RESIST_GRADE.Normal);
        } else {
            map.put(dmg_type, GenericEnums.RESIST_GRADE.Ineffective);
        }
    }
    switch(group) {
        case BONE:
            map.put(GenericEnums.DAMAGE_TYPE.PIERCING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Resistant);
            break;
        case CLOTH:
        case LEATHER:
            map.put(GenericEnums.DAMAGE_TYPE.BLUDGEONING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.COLD, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.FIRE, GenericEnums.RESIST_GRADE.Resistant);
            break;
        case METAL:
        case STONE:
            map.put(GenericEnums.DAMAGE_TYPE.FIRE, GenericEnums.RESIST_GRADE.Resistant);
            break;
    }
    switch(group) {
        case BONE:
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Impregnable);
            break;
        case CLOTH:
            map.put(GenericEnums.DAMAGE_TYPE.PIERCING, GenericEnums.RESIST_GRADE.Vulnerable);
            break;
        case LEATHER:
            map.put(GenericEnums.DAMAGE_TYPE.FIRE, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SLASHING, GenericEnums.RESIST_GRADE.Vulnerable);
            break;
        case METAL:
            map.put(GenericEnums.DAMAGE_TYPE.BLUDGEONING, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHT, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.ACID, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.COLD, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Ineffective);
            break;
        case STONE:
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Impregnable);
            map.put(GenericEnums.DAMAGE_TYPE.PIERCING, GenericEnums.RESIST_GRADE.Resistant);
            break;
    }
    // fill with 'normals'
    return map;
}
Also used : RESIST_GRADE(main.content.enums.GenericEnums.RESIST_GRADE) HashMap(java.util.HashMap) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE)

Example 3 with RESIST_GRADE

use of main.content.enums.GenericEnums.RESIST_GRADE in project Eidolons by IDemiurge.

the class ContentGenerator method getDefaultResistMap.

private static Map<DAMAGE_TYPE, RESIST_GRADE> getDefaultResistMap(ITEM_MATERIAL_GROUP group) {
    Map<DAMAGE_TYPE, RESIST_GRADE> map = new HashMap<>();
    for (DAMAGE_TYPE dmg_type : GenericEnums.DAMAGE_TYPE.values()) {
        if (!dmg_type.isMagical()) {
            map.put(dmg_type, GenericEnums.RESIST_GRADE.Normal);
        } else {
            map.put(dmg_type, GenericEnums.RESIST_GRADE.Ineffective);
        }
    }
    switch(group) {
        case BONE:
            map.put(GenericEnums.DAMAGE_TYPE.PIERCING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Resistant);
            break;
        case CLOTH:
        case LEATHER:
            map.put(GenericEnums.DAMAGE_TYPE.BLUDGEONING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.COLD, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.FIRE, GenericEnums.RESIST_GRADE.Resistant);
            break;
        case METAL:
        case STONE:
            map.put(GenericEnums.DAMAGE_TYPE.FIRE, GenericEnums.RESIST_GRADE.Resistant);
            break;
    }
    switch(group) {
        case BONE:
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Impregnable);
            break;
        case CLOTH:
            map.put(GenericEnums.DAMAGE_TYPE.PIERCING, GenericEnums.RESIST_GRADE.Vulnerable);
            break;
        case LEATHER:
            map.put(GenericEnums.DAMAGE_TYPE.FIRE, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SLASHING, GenericEnums.RESIST_GRADE.Vulnerable);
            break;
        case METAL:
            map.put(GenericEnums.DAMAGE_TYPE.SLASHING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.BLUDGEONING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHT, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.ACID, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.COLD, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Ineffective);
            break;
        case STONE:
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Impregnable);
            map.put(GenericEnums.DAMAGE_TYPE.PIERCING, GenericEnums.RESIST_GRADE.Resistant);
            break;
        case CRYSTAL:
            map.put(GenericEnums.DAMAGE_TYPE.FIRE, GenericEnums.RESIST_GRADE.Impregnable);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHTNING, GenericEnums.RESIST_GRADE.Impregnable);
            map.put(GenericEnums.DAMAGE_TYPE.PIERCING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.SLASHING, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.ACID, GenericEnums.RESIST_GRADE.Resistant);
            map.put(GenericEnums.DAMAGE_TYPE.BLUDGEONING, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.SONIC, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.COLD, GenericEnums.RESIST_GRADE.Vulnerable);
            map.put(GenericEnums.DAMAGE_TYPE.LIGHT, GenericEnums.RESIST_GRADE.Ineffective);
            break;
    }
    // fill with 'normals'
    return map;
}
Also used : RESIST_GRADE(main.content.enums.GenericEnums.RESIST_GRADE) HashMap(java.util.HashMap) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE)

Example 4 with RESIST_GRADE

use of main.content.enums.GenericEnums.RESIST_GRADE in project Eidolons by IDemiurge.

the class ContentGenerator method generateArmorPerDamageType.

public static void generateArmorPerDamageType(ObjType t, MATERIAL material) {
    Integer armor = t.getIntParam(PARAMS.ARMOR);
    for (DAMAGE_TYPE dmg_type : GenericEnums.DAMAGE_TYPE.values()) {
        RESIST_GRADE grade = (material == null) ? getGradeForUnitType(t, dmg_type) : material.getResistGrade(dmg_type);
        PROPERTY prop = DC_ContentManager.getResistGradeForDmgType(dmg_type);
        if (prop == null) {
            continue;
        }
        t.setProperty(prop, grade.toString());
        t.setParam(DC_ContentManager.getArmorParamForDmgType(dmg_type), Math.round(armor * grade.getPercent() / 100));
        if (material == null) {
            grade = new EnumMaster<RESIST_GRADE>().retrieveEnumConst(RESIST_GRADE.class, t.getProperty(DC_ContentManager.getResistGradeForDmgType(dmg_type)));
        } else {
            grade = material.getSelfDamageGrade(dmg_type);
        }
        t.setProperty(DC_ContentManager.getSelfDamageGradeForDmgType(dmg_type), grade.toString());
        prop = DC_ContentManager.getSelfDamageGradeForDmgType(dmg_type);
        if (prop == null) {
            continue;
        }
        grade = new EnumMaster<RESIST_GRADE>().retrieveEnumConst(RESIST_GRADE.class, t.getProperty(prop));
        t.setParam(DC_ContentManager.getArmorSelfDamageParamForDmgType(dmg_type), Math.round(grade.getPercent()));
    }
}
Also used : RESIST_GRADE(main.content.enums.GenericEnums.RESIST_GRADE) EnumMaster(main.system.auxiliary.EnumMaster) PROPERTY(main.content.values.properties.PROPERTY) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE)

Aggregations

DAMAGE_TYPE (main.content.enums.GenericEnums.DAMAGE_TYPE)4 RESIST_GRADE (main.content.enums.GenericEnums.RESIST_GRADE)4 HashMap (java.util.HashMap)2 PARAMETER (main.content.values.parameters.PARAMETER)1 PROPERTY (main.content.values.properties.PROPERTY)1 EnumMaster (main.system.auxiliary.EnumMaster)1