Skip to content

Commit

Permalink
fix: wheel divine empowerment multiplier (#1899)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Nov 24, 2023
1 parent 760d265 commit 0ba46fe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
local function removeEmpowermentItem(position)
for x = -1, 1 do
for y = -1, 1 do
local tile = Tile(Position(position.x + x, position.y + y, position.z))
if tile then
local item = tile:getItemById(ITEM_DIVINE_EMPOWERMENT)
if item then
item:remove()
end
end
end
end
end

local spell = Spell("instant")

function spell.onCastSpell(creature, var)
Expand Down Expand Up @@ -29,10 +43,12 @@ function spell.onCastSpell(creature, var)
for y = -1, 1 do
local item = Game.createItem(ITEM_DIVINE_EMPOWERMENT, 1, Position(position.x + x, position.y + y, position.z))
if item then
item:setDuration(5, 5, 0, false)
item:setAttribute(ITEM_ATTRIBUTE_OWNER, creature:getId())
end
end
end

addEvent(removeEmpowermentItem, 5000, position)
creature:onThinkWheelOfDestiny(true)
return true
end
Expand Down
5 changes: 4 additions & 1 deletion src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ void Combat::CombatHealthFunc(std::shared_ptr<Creature> caster, std::shared_ptr<
targetPlayer = target->getPlayer();
}

if (caster && attackerPlayer) {
if (attackerPlayer) {
std::shared_ptr<Item> item = attackerPlayer->getWeapon();
damage = applyImbuementElementalDamage(attackerPlayer, item, damage);
g_events().eventPlayerOnCombat(attackerPlayer, target, item, damage);
Expand All @@ -582,6 +582,9 @@ void Combat::CombatHealthFunc(std::shared_ptr<Creature> caster, std::shared_ptr<
damage.secondary.value /= 2;
}
}

damage.damageMultiplier += attackerPlayer->wheel()->getMajorStatConditional("Divine Empowerment", WheelMajor_t::DAMAGE);
g_logger().debug("Wheel Divine Empowerment damage multiplier {}", damage.damageMultiplier);
}

if (g_game().combatBlockHit(damage, caster, target, params.blockedByShield, params.blockedByArmor, params.itemId != 0)) {
Expand Down
1 change: 0 additions & 1 deletion src/creatures/players/wheel/player_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,6 @@ void PlayerWheel::downgradeSpell(const std::string &name) {

std::shared_ptr<Spell> PlayerWheel::getCombatDataSpell(CombatDamage &damage) {
std::shared_ptr<Spell> spell = nullptr;
damage.damageMultiplier += getMajorStatConditional("Divine Empowerment", WheelMajor_t::DAMAGE);
WheelSpellGrade_t spellGrade = WheelSpellGrade_t::NONE;
if (!(damage.instantSpellName).empty()) {
spellGrade = getSpellUpgrade(damage.instantSpellName);
Expand Down
2 changes: 1 addition & 1 deletion src/lua/functions/creatures/player/player_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3877,7 +3877,7 @@ int PlayerFunctions::luaPlayerUpgradeSpellWOD(lua_State* L) {
}

int PlayerFunctions::luaPlayerRevelationStageWOD(lua_State* L) {
// player:revelationStagesWOD([name[, set]])
// player:revelationStageWOD([name[, set]])
std::shared_ptr<Player> player = getUserdataShared<Player>(L, 1);
if (!player) {
lua_pushnil(L);
Expand Down

0 comments on commit 0ba46fe

Please sign in to comment.