mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Split PokeBattle_Trainer into PlayerTrainer and NPCTrainer
This commit is contained in:
@@ -191,7 +191,7 @@ class PokeBattle_Battler
|
||||
|
||||
def owned?
|
||||
return false if !@battle.wildBattle?
|
||||
return $Trainer.owned[displaySpecies]
|
||||
return $Trainer.owned?(displaySpecies)
|
||||
end
|
||||
alias owned owned?
|
||||
|
||||
@@ -259,7 +259,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Badge multiplier
|
||||
if @battle.internalBattle && pbOwnedByPlayer? &&
|
||||
@battle.pbPlayer.numbadges>=NUM_BADGES_BOOST_SPEED
|
||||
@battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPEED
|
||||
speedMult *= 1.1
|
||||
end
|
||||
# Calculation
|
||||
|
||||
@@ -109,8 +109,8 @@ class PokeBattle_Battler
|
||||
return true if !@battle.pbOwnedByPlayer?(@index)
|
||||
disobedient = false
|
||||
# Pokémon may be disobedient; calculate if it is
|
||||
badgeLevel = 10*(@battle.pbPlayer.numbadges+1)
|
||||
badgeLevel = PBExperience.maxLevel if @battle.pbPlayer.numbadges>=8
|
||||
badgeLevel = 10 * (@battle.pbPlayer.badge_count + 1)
|
||||
badgeLevel = PBExperience.maxLevel if @battle.pbPlayer.badge_count >= 8
|
||||
if @pokemon.foreign?(@battle.pbPlayer) && @level>badgeLevel
|
||||
a = ((@level+badgeLevel)*@battle.pbRandom(256)/256).floor
|
||||
disobedient |= (a>=badgeLevel)
|
||||
|
||||
@@ -357,16 +357,16 @@ class PokeBattle_Move
|
||||
# Badge multipliers
|
||||
if @battle.internalBattle
|
||||
if user.pbOwnedByPlayer?
|
||||
if physicalMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_ATTACK
|
||||
if physicalMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_ATTACK
|
||||
multipliers[:attack_multiplier] *= 1.1
|
||||
elsif specialMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_SPATK
|
||||
elsif specialMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPATK
|
||||
multipliers[:attack_multiplier] *= 1.1
|
||||
end
|
||||
end
|
||||
if target.pbOwnedByPlayer?
|
||||
if physicalMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_DEFENSE
|
||||
if physicalMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_DEFENSE
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
elsif specialMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_SPDEF
|
||||
elsif specialMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPDEF
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -11,7 +11,7 @@ class PokeBattle_AI
|
||||
shouldSwitch = forceSwitch
|
||||
batonPass = -1
|
||||
moveType = -1
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler).skill || 0
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler).skill_level || 0
|
||||
battler = @battle.battlers[idxBattler]
|
||||
# If Pokémon is within 6 levels of the foe, and foe's last move was
|
||||
# super-effective and powerful
|
||||
|
||||
@@ -8,7 +8,7 @@ class PokeBattle_AI
|
||||
wildBattler = (@battle.wildBattle? && @battle.opposes?(idxBattler))
|
||||
skill = 0
|
||||
if !wildBattler
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(user.index).skill || 0
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(user.index).skill_level || 0
|
||||
end
|
||||
# Get scores and targets for each move
|
||||
# NOTE: A move is only added to the choices array if it has a non-zero
|
||||
|
||||
@@ -418,9 +418,9 @@ class PokeBattle_AI
|
||||
# Don't need to check the Atk/Sp Atk-boosting badges because the AI
|
||||
# won't control the player's Pokémon.
|
||||
if target.pbOwnedByPlayer?
|
||||
if move.physicalMove?(type) && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_DEFENSE
|
||||
if move.physicalMove?(type) && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_DEFENSE
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
elsif move.specialMove?(type) && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_SPDEF
|
||||
elsif move.specialMove?(type) && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPDEF
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,7 +109,7 @@ module PokeBattle_BallAnimationMixin
|
||||
end
|
||||
# Back sprite is animated, make the Poké Ball track the trainer's hand
|
||||
coordSets = [[traSprite.x-44,traSprite.y-32],[-10,-36],[118,-4]]
|
||||
case @trainer.trainertype
|
||||
case @trainer.trainer_type
|
||||
when :POKEMONTRAINER_Leaf
|
||||
coordSets = [[traSprite.x-30,traSprite.y-30],[-18,-36],[118,-6]]
|
||||
when :POKEMONTRAINER_Brendan
|
||||
|
||||
@@ -65,12 +65,12 @@ class PokeBattle_Scene
|
||||
end
|
||||
# Player's and partner trainer's back sprite
|
||||
@battle.player.each_with_index do |p,i|
|
||||
pbCreateTrainerBackSprite(i,p.trainertype,@battle.player.length)
|
||||
pbCreateTrainerBackSprite(i,p.trainer_type,@battle.player.length)
|
||||
end
|
||||
# Opposing trainer(s) sprites
|
||||
if @battle.trainerBattle?
|
||||
@battle.opponent.each_with_index do |p,i|
|
||||
pbCreateTrainerFrontSprite(i,p.trainertype,@battle.opponent.length)
|
||||
pbCreateTrainerFrontSprite(i,p.trainer_type,@battle.opponent.length)
|
||||
end
|
||||
end
|
||||
# Data boxes and Pokémon sprites
|
||||
|
||||
@@ -43,7 +43,7 @@ class PokeBattle_FakeBattler
|
||||
def captured=(value); end
|
||||
|
||||
def owned?
|
||||
return $Trainer.owned[pokemon.species]
|
||||
return $Trainer.owned?(pokemon.species)
|
||||
end
|
||||
|
||||
def pbThis(lowerCase=false)
|
||||
@@ -421,7 +421,7 @@ class PokeBattle_SafariZone
|
||||
def pbStartBattle
|
||||
begin
|
||||
pkmn = @party2[0]
|
||||
self.pbPlayer.seen[pkmn.species] = true
|
||||
self.pbPlayer.set_seen(pkmn.species)
|
||||
pbSeenForm(pkmn)
|
||||
@scene.pbStartBattle(self)
|
||||
pbDisplayPaused(_INTL("Wild {1} appeared!",pkmn.name))
|
||||
|
||||
@@ -97,7 +97,7 @@ class PokeBattle_BattleArena < PokeBattle_Battle
|
||||
@count += 1
|
||||
# Update skill rating
|
||||
for side in 0...2
|
||||
@skill[side] += self.successStates[side].skill
|
||||
@skill[side] += self.successStates[side].skill_level
|
||||
end
|
||||
# PBDebug.log("[Mind: #{@mind.inspect}, Skill: #{@skill.inspect}]")
|
||||
if @count==3
|
||||
|
||||
@@ -30,12 +30,12 @@ module PokeBattle_RecordedBattleModule
|
||||
if trainer.is_a?(Array)
|
||||
ret = []
|
||||
for i in 0...trainer.length
|
||||
ret.push([trainer[i].trainertype,trainer[i].name.clone,trainer[i].id,trainer[i].badges.clone])
|
||||
ret.push([trainer[i].trainer_type,trainer[i].name.clone,trainer[i].id,trainer[i].badges.clone])
|
||||
end
|
||||
return ret
|
||||
else
|
||||
return [
|
||||
[trainer.trainertype,trainer.name.clone,trainer.id,trainer.badges.clone]
|
||||
[trainer.trainer_type,trainer.name.clone,trainer.id,trainer.badges.clone]
|
||||
]
|
||||
end
|
||||
end
|
||||
@@ -146,15 +146,15 @@ module BattlePlayerHelper
|
||||
return nil if !trainer
|
||||
if trainer.length>1
|
||||
ret = []
|
||||
ret[0]=PokeBattle_Trainer.new(trainer[0][1],trainer[0][0])
|
||||
ret[0]=PlayerTrainer.new(trainer[0][1],trainer[0][0])
|
||||
ret[0].id = trainer[0][2]
|
||||
ret[0].badges = trainer[0][3]
|
||||
ret[1] = PokeBattle_Trainer.new(trainer[1][1],trainer[1][0])
|
||||
ret[1] = PlayerTrainer.new(trainer[1][1],trainer[1][0])
|
||||
ret[1].id = trainer[1][2]
|
||||
ret[1].badges = trainer[1][3]
|
||||
return ret
|
||||
else
|
||||
ret = PokeBattle_Trainer.new(trainer[0][1],trainer[0][0])
|
||||
ret = PlayerTrainer.new(trainer[0][1],trainer[0][0])
|
||||
ret.id = trainer[0][2]
|
||||
ret.badges = trainer[0][3]
|
||||
return ret
|
||||
|
||||
@@ -120,7 +120,7 @@ BallHandlers::ModifyCatchRate.add(:NESTBALL,proc { |ball,catchRate,battle,battle
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:REPEATBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
multiplier = (NEW_POKE_BALL_CATCH_RATES) ? 3.5 : 3
|
||||
catchRate *= multiplier if battle.pbPlayer.owned[battler.species]
|
||||
catchRate *= multiplier if battle.pbPlayer.owned?(battler.species)
|
||||
next catchRate
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user