Skip to content

Commit

Permalink
fix: spell combats
Browse files Browse the repository at this point in the history
  • Loading branch information
luan committed Sep 17, 2023
1 parent 98293c4 commit 96e0d7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/creatures/combat/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ CombatSpell::CombatSpell(const std::shared_ptr<Combat> newCombat, bool newNeedTa

bool CombatSpell::loadScriptCombat() {
m_combat = g_luaEnvironment().getCombatObject(g_luaEnvironment().lastCombatId);
return !m_combat.expired();
return m_combat != nullptr;
}

bool CombatSpell::castSpell(std::shared_ptr<Creature> creature) {
Expand Down
6 changes: 3 additions & 3 deletions src/creatures/combat/spells.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ class CombatSpell final : public Script, public BaseSpell, public std::enable_sh
bool executeCastSpell(std::shared_ptr<Creature> creature, const LuaVariant &var) const;

bool loadScriptCombat();
std::shared_ptr<Combat> getCombat() {
return m_combat.lock();
std::shared_ptr<Combat> getCombat() const {
return m_combat;
}

private:
std::string getScriptTypeName() const override {
return "onCastSpell";
}

std::weak_ptr<Combat> m_combat;
std::shared_ptr<Combat> m_combat;

bool needDirection;
bool needTarget;
Expand Down

0 comments on commit 96e0d7e

Please sign in to comment.