The 1.60 client has ten hunter pet passives (skill line 270): Faster Attack I-VII (+17 .. +100% attack speed) and Slower Attack I-III (-17, -20, -26%). On a 2.0 s pet they give exactly the common wild speeds, 1.7 .. 1.0 s and 2.34 .. 2.52 s. Our pets kept the beast's wild speed as their base swing time instead, so the pet frame showed a raw speed and no passive. A hunter pet now has a 2.0 s base swing and learns the passive nearest to its beast's wild speed (by ratio; 0 or 2.0 s: none) as a family spell, so it is not saved and comes back on every summon. Attack power still counts per second of the wild speed, so a pet's damage per second is what it was: Frenzy and other haste still add to it. Dev world DB 11-16, tameable beasts by wild speed: 2.0 s or none 11110, 1.5 s 275, 1.0 s 38, 3.0 s 37, 1.3 s 33, 1.2 s 17, 1.4 / 1.6 / 2.4 s 16 each. The 3.0 s beasts (and a few odd ones) take the nearest step, so a 3.0 s pet swings at 2.52 s now. Idea from the Everlake core (GPL), written as our own code; the credit is in NOTICE.md.
65 lines
2.6 KiB
C++
65 lines
2.6 KiB
C++
/*
|
|
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "tc_catch2.h"
|
|
|
|
#include "ClassicPetAttackSpeed.h"
|
|
|
|
using namespace ClassicPetAttackSpeed;
|
|
|
|
namespace
|
|
{
|
|
uint32_t PassiveFor(uint32_t wildMs)
|
|
{
|
|
Step const* step = ForWildAttackTime(wildMs);
|
|
return step ? step->spellId : 0;
|
|
}
|
|
}
|
|
|
|
TEST_CASE("a 2.0 s beast or one without a speed gets no attack speed passive", "[classic][pet]")
|
|
{
|
|
CHECK(PassiveFor(0) == 0);
|
|
CHECK(PassiveFor(2000) == 0);
|
|
CHECK(PassiveFor(1920) == 0); // 4% off 2.0 s, nearer than Faster Attack I (1.71 s)
|
|
}
|
|
|
|
TEST_CASE("the common wild speeds get the passive that gives exactly that speed", "[classic][pet]")
|
|
{
|
|
// The beast counts of the dev world DB, 11-16: 1500 275, 1000 38, 1300 33, 1200 17, 1400 16, 1600 16, 2400 16, 1700 5
|
|
CHECK(PassiveFor(1000) == 1263110); // Faster Attack VII
|
|
CHECK(PassiveFor(1200) == 1263109); // VI
|
|
CHECK(PassiveFor(1300) == 1263107); // V
|
|
CHECK(PassiveFor(1400) == 1263104); // IV
|
|
CHECK(PassiveFor(1500) == 1263102); // III
|
|
CHECK(PassiveFor(1600) == 1263100); // II
|
|
CHECK(PassiveFor(1700) == 1263099); // I
|
|
CHECK(PassiveFor(2400) == 1263113); // Slower Attack II
|
|
for (uint32_t wild : { 1000u, 1200u, 1300u, 1400u, 1500u, 1600u, 1700u, 2400u })
|
|
CHECK(std::fabs(SwingMs(ForWildAttackTime(wild)->pct) - float(wild)) < 0.02f * float(wild));
|
|
}
|
|
|
|
TEST_CASE("an uncommon wild speed takes the nearest step", "[classic][pet]")
|
|
{
|
|
CHECK(PassiveFor(500) == 1263110); // faster than any step: the fastest, 1.0 s
|
|
CHECK(PassiveFor(1111) == 1263109); // 1.11 s: 1.2 s is nearer than 1.0 s by ratio
|
|
CHECK(PassiveFor(1250) == 1263107); // between 1.2 and 1.3 s (Faster Attack V gives 1.299 s): 1.3 by ratio
|
|
CHECK(PassiveFor(1800) == 1263099); // 1.71 s is nearer than 2.0 s
|
|
CHECK(PassiveFor(2340) == 1263111); // Slower Attack I
|
|
CHECK(PassiveFor(3000) == 1263114); // slower than any step: the slowest, 2.52 s
|
|
CHECK(PassiveFor(4000) == 1263114);
|
|
}
|