AI now keeps their last defined Pokémon for last, tweaks to some battle effects based on mechanics generation

This commit is contained in:
Maruno17
2021-10-24 23:06:47 +01:00
parent 18049c22b9
commit 680c1de392
8 changed files with 49 additions and 13 deletions

View File

@@ -342,6 +342,18 @@ class PokeBattle_Battle
return pbAbleCount(idxBattler)==0
end
def pbTeamAbleNonActiveCount(idxBattler = 0)
inBattleIndices = []
eachSameSideBattler(idxBattler) { |b| inBattleIndices.push(b.pokemonIndex) }
count = 0
eachInTeamFromBattlerIndex(idxBattler) do |pkmn, i|
next if !pkmn || !pkmn.able?
next if inBattleIndices.include?(idxParty)
count += 1
end
return count
end
# For the given side of the field (0=player's, 1=opponent's), returns an array
# containing the number of able Pokémon in each team.
def pbAbleTeamCounts(side)

View File

@@ -16,9 +16,11 @@ class PokeBattle_Battle
return false
end
if !pbIsOwner?(idxBattler,idxParty)
owner = pbGetOwnerFromPartyIndex(idxBattler,idxParty)
partyScene.pbDisplay(_INTL("You can't switch {1}'s Pokémon with one of yours!",
owner.name)) if partyScene
if partyScene
owner = pbGetOwnerFromPartyIndex(idxBattler,idxParty)
partyScene.pbDisplay(_INTL("You can't switch {1}'s Pokémon with one of yours!",
owner.name))
end
return false
end
if party[idxParty].fainted?
@@ -129,7 +131,7 @@ class PokeBattle_Battle
end
# For choosing a replacement Pokémon when prompted in the middle of other
# things happening (U-turn, Baton Pass, in def pbSwitch).
# things happening (U-turn, Baton Pass, in def pbEORSwitch).
def pbSwitchInBetween(idxBattler,checkLaxOnly=false,canCancel=false)
return pbPartyScreen(idxBattler,checkLaxOnly,canCancel) if pbOwnedByPlayer?(idxBattler)
return @battleAI.pbDefaultChooseNewEnemy(idxBattler,pbParty(idxBattler))