Skip to content

Commit

Permalink
fix bound weapon spell (#691)
Browse files Browse the repository at this point in the history
* fix bound weapon

* Add nullptr checks
  • Loading branch information
otsffs authored Jun 24, 2024
1 parent 449d906 commit c81e6da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Code/client/Games/Skyrim/Forms/MagicItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ bool MagicItem::IsBuffSpell() const noexcept
}
}

bool MagicItem::IsBoundWeaponSpell() noexcept
{
for (EffectItem* pEffect : listOfEffects)
{
if (pEffect->pEffectSetting && pEffect->pEffectSetting->eArchetype == EffectArchetypes::ArchetypeID::kBoundWeapon)
return true;
}

return false;
}

EffectItem* MagicItem::GetEffect(const uint32_t aEffectId) noexcept
{
for (EffectItem* pEffect : listOfEffects)
Expand Down
1 change: 1 addition & 0 deletions Code/client/Games/Skyrim/Forms/MagicItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct MagicItem : TESBoundObject
bool IsInvisibilitySpell() const noexcept;
bool IsHealingSpell() const noexcept;
bool IsBuffSpell() const noexcept;
bool IsBoundWeaponSpell() noexcept;

EffectItem* GetEffect(const uint32_t aEffectId) noexcept;

Expand Down
2 changes: 1 addition & 1 deletion Code/client/Services/Generic/MagicService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void MagicService::OnAddTargetEvent(const AddTargetEvent& acEvent) noexcept
// These effects are applied through spell cast sync
if (SpellItem* pSpellItem = Cast<SpellItem>(TESForm::GetById(acEvent.SpellID)))
{
if ((pSpellItem->eCastingType == MagicSystem::CastingType::CONCENTRATION && !pSpellItem->IsHealingSpell()) || pSpellItem->IsWardSpell() || pSpellItem->IsInvisibilitySpell())
if ((pSpellItem->eCastingType == MagicSystem::CastingType::CONCENTRATION && !pSpellItem->IsHealingSpell()) || pSpellItem->IsWardSpell() || pSpellItem->IsInvisibilitySpell() || pSpellItem->IsBoundWeaponSpell())
{
return;
}
Expand Down

0 comments on commit c81e6da

Please sign in to comment.