Simple arrays for NPC penalty configurations.

This commit is contained in:
MobiusDevelopment
2020-06-21 06:45:13 +00:00
parent 4379cad634
commit 6ee8feb8a8
34 changed files with 280 additions and 280 deletions

View File

@ -625,11 +625,11 @@ public class Config
public static boolean SHOW_CREST_WITHOUT_QUEST;
public static boolean ENABLE_RANDOM_ENCHANT_EFFECT;
public static int MIN_NPC_LVL_DMG_PENALTY;
public static Map<Integer, Float> NPC_DMG_PENALTY;
public static Map<Integer, Float> NPC_CRIT_DMG_PENALTY;
public static Map<Integer, Float> NPC_SKILL_DMG_PENALTY;
public static float[] NPC_DMG_PENALTY;
public static float[] NPC_CRIT_DMG_PENALTY;
public static float[] NPC_SKILL_DMG_PENALTY;
public static int MIN_NPC_LVL_MAGIC_PENALTY;
public static Map<Integer, Float> NPC_SKILL_CHANCE_PENALTY;
public static float[] NPC_SKILL_CHANCE_PENALTY;
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
@ -3632,16 +3632,16 @@ public class Config
/**
* @param line the string line to parse
* @return a parsed float map
* @return a parsed float array
*/
private static Map<Integer, Float> parseConfigLine(String line)
private static float[] parseConfigLine(String line)
{
final String[] propertySplit = line.split(",");
final Map<Integer, Float> ret = new HashMap<>(propertySplit.length);
final float[] ret = new float[propertySplit.length];
int i = 0;
for (String value : propertySplit)
{
ret.put(i++, Float.parseFloat(value));
ret[i++] = Float.parseFloat(value);
}
return ret;
}

View File

@ -803,13 +803,13 @@ public class Formulas
if ((attacker.getActingPlayer() != null) && !target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 3))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 2;
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.length)
{
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY[Config.NPC_SKILL_CHANCE_PENALTY.length - 1];
}
else
{
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY[lvlDiff];
}
}
}
@ -1621,13 +1621,13 @@ public class Formulas
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attackerPlayer != null) && ((target.getLevel() - attackerPlayer.getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attackerPlayer.getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.length)
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
pvePenalty = Config.NPC_SKILL_DMG_PENALTY[Config.NPC_SKILL_DMG_PENALTY.length - 1];
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
pvePenalty = Config.NPC_SKILL_DMG_PENALTY[lvlDiff];
}
}