Adds OnSwitchIn hook.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
a78b2e54a4
commit
aaadbfb4f2
|
@ -1,7 +1,7 @@
|
||||||
#include "BattleSide.hpp"
|
#include "BattleSide.hpp"
|
||||||
#include "../EventHooks/EventDataClasses.hpp"
|
#include "../EventHooks/EventDataClasses.hpp"
|
||||||
#include "Battle.hpp"
|
|
||||||
#include "../ScriptHandling/ScriptMacros.hpp"
|
#include "../ScriptHandling/ScriptMacros.hpp"
|
||||||
|
#include "Battle.hpp"
|
||||||
|
|
||||||
using namespace CreatureLib::Battling;
|
using namespace CreatureLib::Battling;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void BattleSide::SetChoice(BaseTurnChoice* choice) {
|
||||||
void BattleSide::SetCreature(ArbUt::OptionalBorrowedPtr<Creature> creature, uint8_t index) {
|
void BattleSide::SetCreature(ArbUt::OptionalBorrowedPtr<Creature> creature, uint8_t index) {
|
||||||
auto old = _creatures[index];
|
auto old = _creatures[index];
|
||||||
if (old.HasValue()) {
|
if (old.HasValue()) {
|
||||||
HOOK(OnRemove, this);
|
HOOK(OnRemove, old.GetValue());
|
||||||
old.GetValue()->SetOnBattleField(false);
|
old.GetValue()->SetOnBattleField(false);
|
||||||
}
|
}
|
||||||
_creatures[index] = creature;
|
_creatures[index] = creature;
|
||||||
|
@ -75,6 +75,7 @@ void BattleSide::SetCreature(ArbUt::OptionalBorrowedPtr<Creature> creature, uint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_battle->TriggerEventListener<SwitchEvent>(CreatureIndex(this->_index, index), creature.GetValue());
|
_battle->TriggerEventListener<SwitchEvent>(CreatureIndex(this->_index, index), creature.GetValue());
|
||||||
|
HOOK(OnSwitchIn, creature.GetValue(), creature.GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleSide::CreatureOnSide(const ArbUt::BorrowedPtr<Creature>& creature) const {
|
bool BattleSide::CreatureOnSide(const ArbUt::BorrowedPtr<Creature>& creature) const {
|
||||||
|
|
|
@ -108,6 +108,7 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
virtual void OnEndTurn(){};
|
virtual void OnEndTurn(){};
|
||||||
virtual void OnFaint(Creature*, DamageSource){};
|
virtual void OnFaint(Creature*, DamageSource){};
|
||||||
|
virtual void OnSwitchIn(Creature*){};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue