Improve NPCBot compatibility

This commit is contained in:
郑佩茹
2023-08-11 17:09:58 -06:00
parent cc716b7158
commit 2b5d6e7a24
3 changed files with 52 additions and 9 deletions

View File

@@ -143,10 +143,10 @@ void IndividualProgression::AdjustStats(Player* player, float computedAdjustment
player->CastCustomSpell(player, ABSORB_SPELL, &bp1, nullptr, nullptr, false);
}
float IndividualProgression::ComputeVanillaAdjustment(Player *player, float configAdjustmentValue)
float IndividualProgression::ComputeVanillaAdjustment(uint8 playerLevel, float configAdjustmentValue)
{
float adjustmentApplyPercent = (player->getLevel() - 10.0f) / 50.0f;
return player->getLevel() > 10 ? 1.0f - ((1.0f - configAdjustmentValue) * adjustmentApplyPercent) : 1;
float adjustmentApplyPercent = (float(playerLevel) - 10.0f) / 50.0f;
return playerLevel > 10 ? 1.0f - ((1.0f - configAdjustmentValue) * adjustmentApplyPercent) : 1;
}
/**

View File

@@ -197,7 +197,7 @@ public:
void checkKillProgression(Player* player, Creature* killed);
static void LoadCustomProgressionEntries(const std::string& customProgressionString);
static void AdjustStats(Player* player, float computedAdjustment, float computedHealingAdjustment);
static float ComputeVanillaAdjustment(Player* player, float configAdjustmentValue);
static float ComputeVanillaAdjustment(uint8 playerLevel, float configAdjustmentValue);
static uint8 GetAccountProgression(uint32 accountId);
};

View File

@@ -566,10 +566,24 @@ public:
return;
}
// NPCBots Compatibility - healer may be null
if (!healer)
return;
// NPCBots compatibility
#ifdef _BOT_AI_H
if (healer->ToCreature()->IsNPCBotOrPet())
{
if (healer->getLevel() < 61)
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(healer->getLevel(), sIndividualProgression->vanillaHealingAdjustment));
}
else if (healer->getLevel() < 71)
{
damage *= (sIndividualProgression->tbcHealingAdjustment);
}
return;
}
#endif
bool isPet = healer->GetOwner() && healer->GetOwner()->GetTypeId() == TYPEID_PLAYER;
if (!isPet && healer->GetTypeId() != TYPEID_PLAYER)
{
@@ -579,7 +593,7 @@ public:
float gearAdjustment = computeTotalGearTuning(player);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_NAXX40))
{
heal *= (sIndividualProgression->ComputeVanillaAdjustment(player, sIndividualProgression->vanillaHealingAdjustment) - gearAdjustment);
heal *= (sIndividualProgression->ComputeVanillaAdjustment(player->getLevel(), sIndividualProgression->vanillaHealingAdjustment) - gearAdjustment);
}
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5))
{
@@ -595,7 +609,21 @@ public:
{
if (!sIndividualProgression->enabled || !attacker)
return;
// NPCBots compatibility
#ifdef _BOT_AI_H
if (attacker->ToCreature()->IsNPCBotOrPet())
{
if (attacker->getLevel() < 61)
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(attacker->getLevel(), sIndividualProgression->vanillaPowerAdjustment));
}
else if (attacker->getLevel() < 71)
{
damage *= (sIndividualProgression->tbcPowerAdjustment);
}
return;
}
#endif
bool isPet = attacker->GetOwner() && attacker->GetOwner()->GetTypeId() == TYPEID_PLAYER;
if (!isPet && attacker->GetTypeId() != TYPEID_PLAYER)
{
@@ -605,7 +633,7 @@ public:
float gearAdjustment = computeTotalGearTuning(player);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_NAXX40))
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(player, sIndividualProgression->vanillaPowerAdjustment) - gearAdjustment);
damage *= (sIndividualProgression->ComputeVanillaAdjustment(player->getLevel(), sIndividualProgression->vanillaPowerAdjustment) - gearAdjustment);
}
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5))
{
@@ -622,6 +650,21 @@ public:
if (!sIndividualProgression->enabled || !attacker)
return;
// NPCBots compatibility
#ifdef _BOT_AI_H
if (attacker->ToCreature()->IsNPCBotOrPet())
{
if (attacker->getLevel() < 61)
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(attacker->getLevel(), sIndividualProgression->vanillaPowerAdjustment));
}
else if (attacker->getLevel() < 71)
{
damage *= (sIndividualProgression->tbcPowerAdjustment);
}
return;
}
#endif
bool isPet = attacker->GetOwner() && attacker->GetOwner()->GetTypeId() == TYPEID_PLAYER;
if (!isPet && attacker->GetTypeId() != TYPEID_PLAYER)
{
@@ -631,7 +674,7 @@ public:
float gearAdjustment = computeTotalGearTuning(player);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_NAXX40))
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(player, sIndividualProgression->vanillaPowerAdjustment) - gearAdjustment);
damage *= (sIndividualProgression->ComputeVanillaAdjustment(player->getLevel(), sIndividualProgression->vanillaPowerAdjustment) - gearAdjustment);
}
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5))
{