feat(Core/Conf): Miss Chance Multiplier (#10873)

This commit is contained in:
Nefertumm
2022-03-08 17:44:22 -03:00
committed by GitHub
parent eb3b803970
commit 0e35b681fb
4 changed files with 19 additions and 5 deletions

View File

@@ -3009,11 +3009,18 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel);
int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
int32 MISS_CHANCE_MULTIPLIER = sWorld->getRate(
int32 MISS_CHANCE_MULTIPLIER;
if (sWorld->getBoolConfig(CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS) && GetTypeId() != TYPEID_PLAYER) // keep it as it was originally (7 and 11)
{
MISS_CHANCE_MULTIPLIER = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11;
}
else
{
MISS_CHANCE_MULTIPLIER = sWorld->getRate(
victim->GetTypeId() == TYPEID_PLAYER
? RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER
: RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE
);
: RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE);
}
// Base hit chance from attacker and victim levels
int32 modHitChance = levelDiff < 3

View File

@@ -173,6 +173,7 @@ enum WorldBoolConfigs
CONFIG_REALM_LOGIN_ENABLED,
CONFIG_PLAYER_SETTINGS_ENABLED,
CONFIG_ALLOW_JOIN_BG_AND_LFG,
CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS,
BOOL_CONFIG_VALUE_COUNT
};

View File

@@ -572,8 +572,9 @@ void World::LoadConfigSettings(bool reload)
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_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);
m_bool_configs[CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS] = sConfigMgr->GetOption<bool>("Rate.MissChanceMultiplier.OnlyAffectsPlayer", false);
rate_values[RATE_TALENT] = sConfigMgr->GetOption<float>("Rate.Talent", 1.0f);
if (rate_values[RATE_TALENT] < 0.0f)

View File

@@ -2550,6 +2550,7 @@ Die.Command.Mode = 1
# Rate.MissChanceMultiplier.Creature
# Rate.MissChanceMultiplier.Player
# Rate.MissChanceMultiplier.OnlyAffectsPlayer
#
# 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
@@ -2557,15 +2558,19 @@ Die.Command.Mode = 1
#
# 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.
# You can set Rate.MissChanceMultiplier.OnlyAffectsPlayer to 1 if you only want to affect the MissChance
# for player casters only. This way you won't be affecting creature missing chance.
#
# Example: if you want the chance to keep growing linearly, use 1.
#
# Default: Rate.MissChanceMultiplier.TargetCreature = 11
# Rate.MissChanceMultiplier.TargetPlayer = 7
# Rate.MissChanceMultiplier.OnlyAffectsPlayer = 0
#
Rate.MissChanceMultiplier.TargetCreature = 11
Rate.MissChanceMultiplier.TargetPlayer = 7
Rate.MissChanceMultiplier.OnlyAffectsPlayer = 0
#
###################################################################################################