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 bound weapon spell #691

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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->eArchetype == EffectArchetypes::ArchetypeID::kBoundWeapon)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure pEffectSetting is always valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add nullptr checks

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
Loading