From ba6ad33ff6351cb386d616a9b6197e691cc2fe00 Mon Sep 17 00:00:00 2001 From: Pedro Cruz Date: Mon, 18 Nov 2024 15:08:12 -0300 Subject: [PATCH] fix: wheel spells bonuses (#3122) This fixes the issue that some spells was sharing bonuses between all other spells --- src/creatures/combat/spells.cpp | 3 --- src/creatures/combat/spells.hpp | 6 +++--- src/io/io_wheel.cpp | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/creatures/combat/spells.cpp b/src/creatures/combat/spells.cpp index 327d97f3284..f522eac86a6 100644 --- a/src/creatures/combat/spells.cpp +++ b/src/creatures/combat/spells.cpp @@ -23,9 +23,6 @@ #include "lua/scripts/scripts.hpp" #include "lib/di/container.hpp" -std::array(WheelSpellBoost_t::TOTAL_COUNT)> wheelOfDestinyRegularBoost = { 0 }; -std::array(WheelSpellBoost_t::TOTAL_COUNT)> wheelOfDestinyUpgradedBoost = { 0 }; - Spells::Spells() = default; Spells::~Spells() = default; diff --git a/src/creatures/combat/spells.hpp b/src/creatures/combat/spells.hpp index 5d9edb70dd6..56ff1a330de 100644 --- a/src/creatures/combat/spells.hpp +++ b/src/creatures/combat/spells.hpp @@ -10,9 +10,7 @@ #pragma once #include "lua/creature/actions.hpp" - -enum class WheelSpellBoost_t : uint8_t; -enum class WheelSpellGrade_t : uint8_t; +#include "creatures/players/wheel/wheel_definitions.hpp" class InstantSpell; class RuneSpell; @@ -256,6 +254,8 @@ class Spell : public BaseSpell { bool pzLocked = false; bool whellOfDestinyUpgraded = false; + std::array(WheelSpellBoost_t::TOTAL_COUNT)> wheelOfDestinyRegularBoost = { 0 }; + std::array(WheelSpellBoost_t::TOTAL_COUNT)> wheelOfDestinyUpgradedBoost = { 0 }; private: uint32_t mana = 0; diff --git a/src/io/io_wheel.cpp b/src/io/io_wheel.cpp index 2e1b57c79bc..cfcf6593010 100644 --- a/src/io/io_wheel.cpp +++ b/src/io/io_wheel.cpp @@ -58,7 +58,7 @@ namespace InternalPlayerWheel { return; } - auto spell = g_spells().getInstantSpellByName(name); + const auto &spell = g_spells().getInstantSpellByName(name); if (spell) { g_logger().trace("[{}] registering instant spell with name {}", __FUNCTION__, spell->getName()); // Increase data @@ -127,7 +127,7 @@ bool IOWheel::initializeGlobalData(bool reload /* = false*/) { // Register spells for druid for (const auto &data : getWheelBonusData().spells.druid) { for (size_t i = 1; i < 3; ++i) { - const auto grade = data.grade[i]; + const auto &grade = data.grade[i]; InternalPlayerWheel::registerWheelSpellTable(grade, data.name, static_cast(i)); } }