Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wheel divine empowerment multiplier #1899

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading