Fixes battle not ending on capture of last pokemon
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
812ef65ea0
commit
3aa6e28a62
|
@ -91,8 +91,15 @@ void PkmnLib::Battling::Pokemon::AttemptCapture(PkmnLib::Library::Item* catchIte
|
||||||
if (result.WasCaught) {
|
if (result.WasCaught) {
|
||||||
// By marking the pokemon as caught, it becomes no longer usable for switch in.
|
// By marking the pokemon as caught, it becomes no longer usable for switch in.
|
||||||
_wasCaught = true;
|
_wasCaught = true;
|
||||||
// As the pokemon is caught now, we replace it with an empty space.
|
|
||||||
_battleData.Side.GetValue()->SetCreature(nullptr, _battleData.Index.GetCreatureIndex());
|
if (_battleData.Battle.HasValue() && _battleData.Side.HasValue()) {
|
||||||
|
auto sideIndex = _battleData.Side.GetValue()->GetCreatureIndex(this);
|
||||||
|
if (!_battleData.Battle.GetValue()->CanSlotBeFilled(_battleData.Side.GetValue()->GetSideIndex(),
|
||||||
|
sideIndex)) {
|
||||||
|
_battleData.Side.GetValue()->MarkSlotAsUnfillable(this);
|
||||||
|
}
|
||||||
|
_battleData.Battle.GetValue()->ValidateBattleState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void PkmnLib::Battling::Pokemon::ClearBattleData() noexcept {
|
void PkmnLib::Battling::Pokemon::ClearBattleData() noexcept {
|
||||||
|
|
Loading…
Reference in New Issue