feat(Core/Conf): Rate.MissChanceMultiplier (#10639)

This commit is contained in:
Francesco Borzì
2022-02-13 11:12:08 +01:00
committed by GitHub
parent e1711e28f7
commit 6aa727c455
4 changed files with 35 additions and 8 deletions

View File

@@ -3004,19 +3004,21 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
}
SpellSchoolMask schoolMask = spellInfo->GetSchoolMask();
// PvP - PvE spell misschances per leveldif > 2
int32 lchance = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11;
int32 thisLevel = getLevelForTarget(victim);
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTrigger())
thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel);
int32 leveldif = int32(victim->getLevelForTarget(this)) - thisLevel;
int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
int32 MISS_CHANCE_MULTIPLIER = sWorld->getRate(
victim->GetTypeId() == TYPEID_PLAYER
? RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER
: RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE
);
// Base hit chance from attacker and victim levels
int32 modHitChance;
if (leveldif < 3)
modHitChance = 96 - leveldif;
else
modHitChance = 94 - (leveldif - 2) * lchance;
int32 modHitChance = levelDiff < 3
? 96 - levelDiff
: 94 - (levelDiff - 2) * MISS_CHANCE_MULTIPLIER;
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
if (Player* modOwner = GetSpellModOwner())

View File

@@ -486,6 +486,8 @@ enum Rates
RATE_DURABILITY_LOSS_ABSORB,
RATE_DURABILITY_LOSS_BLOCK,
RATE_MOVESPEED,
RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE,
RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER,
MAX_RATES
};

View File

@@ -566,6 +566,10 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_HONOR] = sConfigMgr->GetOption<float>("Rate.Honor", 1.0f);
rate_values[RATE_ARENA_POINTS] = sConfigMgr->GetOption<float>("Rate.ArenaPoints", 1.0f);
rate_values[RATE_INSTANCE_RESET_TIME] = sConfigMgr->GetOption<float>("Rate.InstanceResetTime", 1.0f);
rate_values[RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE] = sConfigMgr->GetOption<float>("Rate.MissChanceMultiplier.TargetCreature", 11.0f);
rate_values[RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER] = sConfigMgr->GetOption<float>("Rate.MissChanceMultiplier.TargetPlayer", 7.0f);
rate_values[RATE_TALENT] = sConfigMgr->GetOption<float>("Rate.Talent", 1.0f);
if (rate_values[RATE_TALENT] < 0.0f)
{

View File

@@ -2543,6 +2543,25 @@ Death.Bones.BattlegroundOrArena = 1
Die.Command.Mode = 1
# Rate.MissChanceMultiplier.Creature
# Rate.MissChanceMultiplier.Player
#
# Description: When the target is 3 or more level higher than the player,
# the chance to hit is determined by the formula: 94 - (levelDiff - 2) * Rate.MissChanceMultiplier
# The higher the Rate.MissChanceMultiplier constant, the higher is the chance to miss.
#
# Note: this does not affect when the player is less than 3 levels different than the target,
# where this (linear) formula is used instead to calculate the hit chance: 96 - levelDiff.
#
# Example: if you want the chance to keep growing linearly, use 1.
#
# Default: Rate.MissChanceMultiplier.TargetCreature = 11
# Rate.MissChanceMultiplier.TargetPlayer = 7
#
Rate.MissChanceMultiplier.TargetCreature = 11
Rate.MissChanceMultiplier.TargetPlayer = 7
#
###################################################################################################