Split PokeBattle_Trainer into PlayerTrainer and NPCTrainer

This commit is contained in:
Maruno17
2021-01-24 17:55:39 +00:00
parent 7de034957b
commit 4098b1cd11
60 changed files with 748 additions and 648 deletions

View File

@@ -45,7 +45,7 @@ module PokeBattle_BattleCommon
pbSeenForm(pkmn) # In case the form changed upon leaving battle
# Record the Pokémon's species as owned in the Pokédex
if !pbPlayer.hasOwned?(pkmn.species)
pbPlayer.setOwned(pkmn.species)
pbPlayer.set_owned(pkmn.species)
if $Trainer.pokedex
pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pkmn.name))
@scene.pbShowPokedex(pkmn.species)
@@ -53,8 +53,8 @@ module PokeBattle_BattleCommon
end
# Record a Shadow Pokémon's species as having been caught
if pkmn.shadowPokemon?
pbPlayer.shadowcaught = {} if !pbPlayer.shadowcaught
pbPlayer.shadowcaught[pkmn.species] = true
pbPlayer.owned_shadow = {} if !pbPlayer.owned_shadow
pbPlayer.owned_shadow[pkmn.species] = true
end
# Store caught Pokémon
pbStorePokemon(pkmn)
@@ -194,7 +194,7 @@ module PokeBattle_BattleCommon
# Critical capture check
if ENABLE_CRITICAL_CAPTURES
c = 0
numOwned = $Trainer.pokedexOwned
numOwned = $Trainer.owned_count
if numOwned>600; c = x*5/12
elsif numOwned>450; c = x*4/12
elsif numOwned>300; c = x*3/12

View File

@@ -115,8 +115,8 @@ class PokeBattle_Battle
@caughtPokemon = []
player = [player] if !player.nil? && !player.is_a?(Array)
opponent = [opponent] if !opponent.nil? && !opponent.is_a?(Array)
@player = player # Array of PokeBattle_Trainer objects, or nil
@opponent = opponent # Array of PokeBattle_Trainer objects, or nil
@player = player # Array of PlayerTrainer/NPCTrainer objects, or nil
@opponent = opponent # Array of NPCTrainer objects, or nil
@items = nil
@endSpeeches = []
@endSpeechesWin = []
@@ -249,8 +249,8 @@ class PokeBattle_Battle
def pbGetOwnerName(idxBattler)
idxTrainer = pbGetOwnerIndexFromBattlerIndex(idxBattler)
return @opponent[idxTrainer].fullname if opposes?(idxBattler) # Opponent
return @player[idxTrainer].fullname if idxTrainer>0 # Ally trainer
return @opponent[idxTrainer].full_name if opposes?(idxBattler) # Opponent
return @player[idxTrainer].full_name if idxTrainer>0 # Ally trainer
return @player[idxTrainer].name # Player
end
@@ -622,7 +622,7 @@ class PokeBattle_Battle
def pbSetSeen(battler)
return if !battler || !@internalBattle
pbPlayer.seen[battler.displaySpecies] = true
pbPlayer.set_seen(battler.displaySpecies)
pbSeenForm(battler.displaySpecies,battler.displayGender,battler.displayForm)
end

View File

@@ -174,13 +174,13 @@ class PokeBattle_Battle
else # Trainer battle
case @opponent.length
when 1
pbDisplayPaused(_INTL("You are challenged by {1}!",@opponent[0].fullname))
pbDisplayPaused(_INTL("You are challenged by {1}!",@opponent[0].full_name))
when 2
pbDisplayPaused(_INTL("You are challenged by {1} and {2}!",@opponent[0].fullname,
@opponent[1].fullname))
pbDisplayPaused(_INTL("You are challenged by {1} and {2}!",@opponent[0].full_name,
@opponent[1].full_name))
when 3
pbDisplayPaused(_INTL("You are challenged by {1}, {2} and {3}!",
@opponent[0].fullname,@opponent[1].fullname,@opponent[2].fullname))
@opponent[0].full_name,@opponent[1].full_name,@opponent[2].full_name))
end
end
# Send out Pokémon (opposing trainers first)
@@ -196,12 +196,12 @@ class PokeBattle_Battle
sent = sendOuts[side][i]
case sent.length
when 1
msg += _INTL("{1} sent out {2}!",t.fullname,@battlers[sent[0]].name)
msg += _INTL("{1} sent out {2}!",t.full_name,@battlers[sent[0]].name)
when 2
msg += _INTL("{1} sent out {2} and {3}!",t.fullname,
msg += _INTL("{1} sent out {2} and {3}!",t.full_name,
@battlers[sent[0]].name,@battlers[sent[1]].name)
when 3
msg += _INTL("{1} sent out {2}, {3} and {4}!",t.fullname,
msg += _INTL("{1} sent out {2}, {3} and {4}!",t.full_name,
@battlers[sent[0]].name,@battlers[sent[1]].name,@battlers[sent[2]].name)
end
toSendOut.concat(sent)
@@ -339,7 +339,7 @@ class PokeBattle_Battle
if trainerBattle?
tMoney = 0
@opponent.each_with_index do |t,i|
tMoney += pbMaxLevelInTeam(1,i)*t.moneyEarned
tMoney += pbMaxLevelInTeam(1, i) * t.base_money
end
tMoney *= 2 if @field.effects[PBEffects::AmuletCoin]
tMoney *= 2 if @field.effects[PBEffects::HappyHour]
@@ -368,7 +368,7 @@ class PokeBattle_Battle
return if $game_switches[NO_MONEY_LOSS]
maxLevel = pbMaxLevelInTeam(0,0) # Player's Pokémon only, not partner's
multiplier = [8,16,24,36,48,64,80,100,120]
idxMultiplier = [pbPlayer.numbadges,multiplier.length-1].min
idxMultiplier = [pbPlayer.badge_count, multiplier.length - 1].min
tMoney = maxLevel*multiplier[idxMultiplier]
tMoney = pbPlayer.money if tMoney>pbPlayer.money
oldMoney = pbPlayer.money
@@ -395,13 +395,13 @@ class PokeBattle_Battle
@scene.pbTrainerBattleSuccess
case @opponent.length
when 1
pbDisplayPaused(_INTL("You defeated {1}!",@opponent[0].fullname))
pbDisplayPaused(_INTL("You defeated {1}!",@opponent[0].full_name))
when 2
pbDisplayPaused(_INTL("You defeated {1} and {2}!",@opponent[0].fullname,
@opponent[1].fullname))
pbDisplayPaused(_INTL("You defeated {1} and {2}!",@opponent[0].full_name,
@opponent[1].full_name))
when 3
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!",@opponent[0].fullname,
@opponent[1].fullname,@opponent[2].fullname))
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!",@opponent[0].full_name,
@opponent[1].full_name,@opponent[2].full_name))
end
@opponent.each_with_index do |_t,i|
@scene.pbShowOpponent(i)
@@ -423,13 +423,13 @@ class PokeBattle_Battle
if trainerBattle?
case @opponent.length
when 1
pbDisplayPaused(_INTL("You lost against {1}!",@opponent[0].fullname))
pbDisplayPaused(_INTL("You lost against {1}!",@opponent[0].full_name))
when 2
pbDisplayPaused(_INTL("You lost against {1} and {2}!",
@opponent[0].fullname,@opponent[1].fullname))
@opponent[0].full_name,@opponent[1].full_name))
when 3
pbDisplayPaused(_INTL("You lost against {1}, {2} and {3}!",
@opponent[0].fullname,@opponent[1].fullname,@opponent[2].fullname))
@opponent[0].full_name,@opponent[1].full_name,@opponent[2].full_name))
end
end
# Lose money from losing a battle

View File

@@ -172,7 +172,7 @@ class PokeBattle_Battle
idxPartyForName = pbLastInTeam(idxBattler)
end
if pbDisplayConfirm(_INTL("{1} is about to send in {2}. Will you switch your Pokémon?",
opponent.fullname,enemyParty[idxPartyForName].name))
opponent.full_name, enemyParty[idxPartyForName].name))
idxPlayerPartyNew = pbSwitchInBetween(0,false,true)
if idxPlayerPartyNew>=0
pbMessageOnRecall(@battlers[0])
@@ -270,7 +270,7 @@ class PokeBattle_Battle
end
else
owner = pbGetOwnerFromBattlerIndex(idxBattler)
pbDisplayBrief(_INTL("{1} sent out {2}!",owner.fullname,newPkmnName))
pbDisplayBrief(_INTL("{1} sent out {2}!",owner.full_name,newPkmnName))
end
end

View File

@@ -73,7 +73,7 @@ class PokeBattle_Battle
end
end
# NOTE: Add your own Mega objects for particular NPC trainers here.
# if pbGetOwnerFromBattlerIndex(idxBattler).trainertype == :BUGCATCHER
# if pbGetOwnerFromBattlerIndex(idxBattler).trainer_type == :BUGCATCHER
# return _INTL("Mega Net")
# end
return _INTL("Mega Ring")