Simplified pvePenalty calculation.

This commit is contained in:
MobiusDevelopment 2019-04-08 11:34:13 +00:00
parent adf1653c1c
commit 6ee572a36a
11 changed files with 154 additions and 231 deletions

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{

View File

@ -1407,26 +1407,6 @@ public final class Formulas
}
}
public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit)
{
if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (skill != null)
{
return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1));
}
else if (crit)
{
return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1));
}
return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1));
}
return 1.0;
}
/**
* Calculates if the specified creature can get its stun effect removed due to damage taken.
* @param creature the creature to be checked
@ -1572,7 +1552,20 @@ public final class Formulas
final double pveAttack;
final double pveDefense;
final double pveRaidDefense;
final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit);
double pvePenalty = 1;
if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2))
{
final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1);
}
else
{
pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff);
}
}
if (skill != null)
{