Adds Angelscript wrappers for Party.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -12,8 +12,8 @@ void PkmnLib::Battling::Pokemon::Evolve(ArbUt::BorrowedPtr<const Library::Pokemo
|
||||
// If the pokemon is genderless, but it's new evolution is not, we want to set its gender
|
||||
if (_gender != CreatureLib::Library::Gender::Genderless && _species->GetGenderRate() != -1) {
|
||||
// If we are currently in battle, use the battle random so we can get predictable events.
|
||||
if (_battle.HasValue()) {
|
||||
_gender = _species->GetRandomGender(_battle.GetValue()->GetRandom()->GetRNG());
|
||||
if (_battleData.Battle.HasValue()) {
|
||||
_gender = _species->GetRandomGender(_battleData.Battle.GetValue()->GetRandom()->GetRNG());
|
||||
}
|
||||
// Else create a new random.
|
||||
else {
|
||||
@@ -34,8 +34,8 @@ void PkmnLib::Battling::Pokemon::SetStatus(const ArbUt::StringView& name) {
|
||||
}
|
||||
_statusScript = std::unique_ptr<CreatureLib::Battling::BattleScript>(
|
||||
_library->LoadScript(static_cast<ScriptCategory>(PkmnScriptCategory::Status), name));
|
||||
if (_battle.HasValue()) {
|
||||
_battle.GetValue()->TriggerEventListener<StatusChangeEvent>(this, name);
|
||||
if (_battleData.Battle.HasValue()) {
|
||||
_battleData.Battle.GetValue()->TriggerEventListener<StatusChangeEvent>(this, name);
|
||||
}
|
||||
}
|
||||
void PkmnLib::Battling::Pokemon::ClearStatus() {
|
||||
@@ -43,8 +43,8 @@ void PkmnLib::Battling::Pokemon::ClearStatus() {
|
||||
return;
|
||||
_statusScript->OnRemove();
|
||||
_statusScript = nullptr;
|
||||
if (_battle.HasValue()) {
|
||||
_battle.GetValue()->TriggerEventListener<StatusChangeEvent>(this, ""_cnc);
|
||||
if (_battleData.Battle.HasValue()) {
|
||||
_battleData.Battle.GetValue()->TriggerEventListener<StatusChangeEvent>(this, ""_cnc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,10 @@ CreatureLib::Battling::Creature* PkmnLib::Battling::Pokemon::Clone() const {
|
||||
c->_statBoost = _statBoost;
|
||||
c->_flatStats = _flatStats;
|
||||
c->_boostedStats = _boostedStats;
|
||||
c->_battle = _battle;
|
||||
c->_side = _side;
|
||||
c->_onBattleField = _onBattleField;
|
||||
c->_battleData.Battle = _battleData.Battle;
|
||||
c->_battleData.Side = _battleData.Side;
|
||||
c->_battleData.OnBattleField = _battleData.OnBattleField;
|
||||
c->_battleData.Index = _battleData.Index;
|
||||
if (_activeTalent != nullptr) {
|
||||
c->_activeTalent = std::unique_ptr<PkmnScript::BattleScript>(_activeTalent->Clone());
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace PkmnLib::Battling {
|
||||
: CreatureLib::Battling::CreatureParty(party) {}
|
||||
PokemonParty(size_t size) : CreatureLib::Battling::CreatureParty(size) {}
|
||||
|
||||
ArbUt::OptionalBorrowedPtr<Pokemon> GetAtIndex(int index) const {
|
||||
ArbUt::OptionalBorrowedPtr<Pokemon> GetAtIndex(size_t index) const {
|
||||
return CreatureLib::Battling::CreatureParty::GetAtIndex(index).As<Pokemon>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user