mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Created and implemented GameData::Species
This commit is contained in:
@@ -33,8 +33,7 @@ end
|
||||
class PokeBattle_Move_003 < PokeBattle_SleepMove
|
||||
def pbMoveFailed?(user,targets)
|
||||
if NEWEST_BATTLE_MECHANICS && @id == :DARKVOID
|
||||
if !user.isSpecies?(:DARKRAI) &&
|
||||
!isConst?(user.effects[PBEffects::TransformSpecies],PBSpecies,:DARKRAI)
|
||||
if !user.isSpecies?(:DARKRAI) && user.effects[PBEffects::TransformSpecies] != :DARKRAI
|
||||
@battle.pbDisplay(_INTL("But {1} can't use the move!",user.pbThis))
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -53,7 +53,7 @@ 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 = {} if !pbPlayer.shadowcaught
|
||||
pbPlayer.shadowcaught[pkmn.species] = true
|
||||
end
|
||||
# Store caught Pokémon
|
||||
@@ -65,7 +65,7 @@ module PokeBattle_BattleCommon
|
||||
#=============================================================================
|
||||
# Throw a Poké Ball
|
||||
#=============================================================================
|
||||
def pbThrowPokeBall(idxBattler,ball,rareness=nil,showPlayer=false)
|
||||
def pbThrowPokeBall(idxBattler,ball,catch_rate=nil,showPlayer=false)
|
||||
# Determine which Pokémon you're throwing the Poké Ball at
|
||||
battler = nil
|
||||
if opposes?(idxBattler)
|
||||
@@ -105,7 +105,7 @@ module PokeBattle_BattleCommon
|
||||
# Calculate the number of shakes (4=capture)
|
||||
pkmn = battler.pokemon
|
||||
@criticalCapture = false
|
||||
numShakes = pbCaptureCalc(pkmn,battler,rareness,ball)
|
||||
numShakes = pbCaptureCalc(pkmn,battler,catch_rate,ball)
|
||||
PBDebug.log("[Threw Poké Ball] #{itemName}, #{numShakes} shakes (4=capture)")
|
||||
# Animation of Ball throw, absorb, shake and capture/burst out
|
||||
@scene.pbThrow(ball,numShakes,@criticalCapture,battler.index,showPlayer)
|
||||
@@ -162,33 +162,23 @@ module PokeBattle_BattleCommon
|
||||
#=============================================================================
|
||||
# Calculate how many shakes a thrown Poké Ball will make (4 = capture)
|
||||
#=============================================================================
|
||||
def pbCaptureCalc(pkmn,battler,rareness,ball)
|
||||
def pbCaptureCalc(pkmn,battler,catch_rate,ball)
|
||||
return 4 if $DEBUG && Input.press?(Input::CTRL)
|
||||
# Get a rareness if one wasn't provided
|
||||
if !rareness
|
||||
rareness = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::RARENESS)
|
||||
end
|
||||
# Modify rareness depending on the Poké Ball's effect
|
||||
ultraBeast = (battler.isSpecies?(:NIHILEGO) ||
|
||||
battler.isSpecies?(:BUZZWOLE) ||
|
||||
battler.isSpecies?(:PHEROMOSA) ||
|
||||
battler.isSpecies?(:XURKITREE) ||
|
||||
battler.isSpecies?(:CELESTEELA) ||
|
||||
battler.isSpecies?(:KARTANA) ||
|
||||
battler.isSpecies?(:GUZZLORD) ||
|
||||
battler.isSpecies?(:POIPOLE) ||
|
||||
battler.isSpecies?(:NAGANADEL) ||
|
||||
battler.isSpecies?(:STAKATAKA) ||
|
||||
battler.isSpecies?(:BLACEPHALON))
|
||||
# Get a catch rate if one wasn't provided
|
||||
catch_rate = pkmn.species_data.catch_rate if !catch_rate
|
||||
# Modify catch_rate depending on the Poké Ball's effect
|
||||
ultraBeast = [:NIHILEGO, :BUZZWOLE, :PHEROMOSA, :XURKITREE, :CELESTEELA,
|
||||
:KARTANA, :GUZZLORD, :POIPOLE, :NAGANADEL, :STAKATAKA,
|
||||
:BLACEPHALON].include?(pkmn.species)
|
||||
if !ultraBeast || ball == :BEASTBALL
|
||||
rareness = BallHandlers.modifyCatchRate(ball,rareness,self,battler,ultraBeast)
|
||||
catch_rate = BallHandlers.modifyCatchRate(ball,catch_rate,self,battler,ultraBeast)
|
||||
else
|
||||
rareness /= 10
|
||||
catch_rate /= 10
|
||||
end
|
||||
# First half of the shakes calculation
|
||||
a = battler.totalhp
|
||||
b = battler.hp
|
||||
x = ((3*a-2*b)*rareness.to_f)/(3*a)
|
||||
x = ((3*a-2*b)*catch_rate.to_f)/(3*a)
|
||||
# Calculation modifiers
|
||||
if battler.status==PBStatuses::SLEEP || battler.status==PBStatuses::FROZEN
|
||||
x *= 2.5
|
||||
|
||||
@@ -148,7 +148,7 @@ class PokeBattle_Battle
|
||||
pbCommonAnimation("MegaEvolution2",battler)
|
||||
megaName = battler.pokemon.megaName
|
||||
if !megaName || megaName==""
|
||||
megaName = _INTL("Mega {1}",PBSpecies.getName(battler.pokemon.species))
|
||||
megaName = _INTL("Mega {1}", battler.pokemon.speciesName)
|
||||
end
|
||||
pbDisplay(_INTL("{1} has Mega Evolved into {2}!",battler.pbThis,megaName))
|
||||
side = battler.idxOwnSide
|
||||
|
||||
@@ -668,10 +668,10 @@ class BattlerFaintAnimation < PokeBattle_Animation
|
||||
# Animation
|
||||
# Play cry
|
||||
delay = 10
|
||||
cry = pbCryFile(batSprite.pkmn)
|
||||
cry = GameData::Species.cry_filename_from_pokemon(batSprite.pkmn)
|
||||
if cry
|
||||
battler.setSE(0,pbCryFile(batSprite.pkmn),nil,75) # 75 is pitch
|
||||
delay = pbCryFrameLength(batSprite.pkmn)*20/Graphics.frame_rate
|
||||
battler.setSE(0, cry, nil, 75) # 75 is pitch
|
||||
delay = GameData::Species.cry_length(batSprite.pkmn) * 20 / Graphics.frame_rate
|
||||
end
|
||||
# Sprite drops down
|
||||
shadow.setVisible(delay,false)
|
||||
|
||||
@@ -540,13 +540,13 @@ class PokemonBattlerSprite < RPG::Sprite
|
||||
@spriteX = p[0]
|
||||
@spriteY = p[1]
|
||||
# Apply metrics
|
||||
pbApplyBattlerMetricsToSprite(self,@index,@pkmn.fSpecies)
|
||||
@pkmn.species_data.apply_metrics_to_sprite(self, @index)
|
||||
end
|
||||
|
||||
def setPokemonBitmap(pkmn,back=false)
|
||||
@pkmn = pkmn
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap = pbLoadPokemonBitmap(@pkmn,back)
|
||||
@_iconBitmap = GameData::Species.sprite_bitmap_from_pokemon(@pkmn, back)
|
||||
self.bitmap = (@_iconBitmap) ? @_iconBitmap.bitmap : nil
|
||||
pbSetPosition
|
||||
end
|
||||
@@ -557,8 +557,7 @@ class PokemonBattlerSprite < RPG::Sprite
|
||||
# @battleAnimations array.
|
||||
def pbPlayIntroAnimation(pictureEx=nil)
|
||||
return if !@pkmn
|
||||
cry = pbCryFile(@pkmn)
|
||||
pbSEPlay(cry) if cry
|
||||
GameData::Species.play_cry_from_pokemon(@pkmn)
|
||||
end
|
||||
|
||||
QUARTER_ANIM_PERIOD = Graphics.frame_rate*3/20
|
||||
@@ -637,13 +636,13 @@ class PokemonBattlerShadowSprite < RPG::Sprite
|
||||
self.x = p[0]
|
||||
self.y = p[1]
|
||||
# Apply metrics
|
||||
pbApplyBattlerMetricsToSprite(self,@index,@pkmn.fSpecies,true)
|
||||
@pkmn.species_data.apply_metrics_to_sprite(self, @index, true)
|
||||
end
|
||||
|
||||
def setPokemonBitmap(pkmn)
|
||||
@pkmn = pkmn
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap = pbLoadPokemonShadowBitmap(@pkmn)
|
||||
@_iconBitmap = GameData::Species.shadow_bitmap_from_pokemon(@pkmn)
|
||||
self.bitmap = (@_iconBitmap) ? @_iconBitmap.bitmap : nil
|
||||
pbSetPosition
|
||||
end
|
||||
|
||||
@@ -323,9 +323,7 @@ class PokeBattle_Scene
|
||||
pkmnSprite.setPokemonBitmap(pkmn,back)
|
||||
shadowSprite.setPokemonBitmap(pkmn)
|
||||
# Set visibility of battler's shadow
|
||||
if shadowSprite && !back
|
||||
shadowSprite.visible = showShadow?(pkmn.fSpecies)
|
||||
end
|
||||
shadowSprite.visible = pkmn.species_data.shows_shadow? if shadowSprite && !back
|
||||
end
|
||||
|
||||
def pbResetMoveIndex(idxBattler)
|
||||
|
||||
@@ -504,9 +504,8 @@ class PBAnimation < Array
|
||||
when 0 # Play SE
|
||||
if i.name && i.name!=""
|
||||
pbSEPlay("Anim/"+i.name,i.volume,i.pitch)
|
||||
else
|
||||
poke = (user && user.pokemon) ? user.pokemon : 1
|
||||
name = (pbCryFile(poke) rescue nil)
|
||||
elsif user && user.pokemon
|
||||
name = GameData::Species.cry_filename_from_pokemon(user.pokemon)
|
||||
pbSEPlay(name,i.volume,i.pitch) if name
|
||||
end
|
||||
# if sprite
|
||||
|
||||
@@ -410,28 +410,28 @@ class PokeBattle_SafariZone
|
||||
#=============================================================================
|
||||
# Safari battle-specific methods
|
||||
#=============================================================================
|
||||
def pbEscapeRate(rareness)
|
||||
return 125 if rareness<=45 # Escape factor 9 (45%)
|
||||
return 100 if rareness<=60 # Escape factor 7 (35%)
|
||||
return 75 if rareness<=120 # Escape factor 5 (25%)
|
||||
return 50 if rareness<=250 # Escape factor 3 (15%)
|
||||
return 25 # Escape factor 2 (10%)
|
||||
def pbEscapeRate(catch_rate)
|
||||
return 125 if catch_rate <= 45 # Escape factor 9 (45%)
|
||||
return 100 if catch_rate <= 60 # Escape factor 7 (35%)
|
||||
return 75 if catch_rate <= 120 # Escape factor 5 (25%)
|
||||
return 50 if catch_rate <= 250 # Escape factor 3 (15%)
|
||||
return 25 # Escape factor 2 (10%)
|
||||
end
|
||||
|
||||
def pbStartBattle
|
||||
begin
|
||||
wildpoke = @party2[0]
|
||||
self.pbPlayer.seen[wildpoke.species] = true
|
||||
pbSeenForm(wildpoke)
|
||||
pkmn = @party2[0]
|
||||
self.pbPlayer.seen[pkmn.species] = true
|
||||
pbSeenForm(pkmn)
|
||||
@scene.pbStartBattle(self)
|
||||
pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
|
||||
pbDisplayPaused(_INTL("Wild {1} appeared!",pkmn.name))
|
||||
@scene.pbSafariStart
|
||||
@scene.pbCommonAnimation(PBWeather.animationName(@weather))
|
||||
safariBall = GameData::Item.get(:SAFARIBALL).id
|
||||
rareness = pbGetSpeciesData(wildpoke.species,wildpoke.form,SpeciesData::RARENESS)
|
||||
catchFactor = (rareness*100)/1275
|
||||
catch_rate = pkmn.species_data.catch_rate
|
||||
catchFactor = (catch_rate*100)/1275
|
||||
catchFactor = [[catchFactor,3].max,20].min
|
||||
escapeFactor = (pbEscapeRate(rareness)*100)/1275
|
||||
escapeFactor = (pbEscapeRate(catch_rate)*100)/1275
|
||||
escapeFactor = [[escapeFactor,2].max,20].min
|
||||
loop do
|
||||
cmd = @scene.pbSafariCommandMenu(0)
|
||||
@@ -452,12 +452,12 @@ class PokeBattle_SafariZone
|
||||
end
|
||||
end
|
||||
when 1 # Bait
|
||||
pbDisplayBrief(_INTL("{1} threw some bait at the {2}!",self.pbPlayer.name,wildpoke.name))
|
||||
pbDisplayBrief(_INTL("{1} threw some bait at the {2}!",self.pbPlayer.name,pkmn.name))
|
||||
@scene.pbThrowBait
|
||||
catchFactor /= 2 if pbRandom(100)<90 # Harder to catch
|
||||
escapeFactor /= 2 # Less likely to escape
|
||||
when 2 # Rock
|
||||
pbDisplayBrief(_INTL("{1} threw a rock at the {2}!",self.pbPlayer.name,wildpoke.name))
|
||||
pbDisplayBrief(_INTL("{1} threw a rock at the {2}!",self.pbPlayer.name,pkmn.name))
|
||||
@scene.pbThrowRock
|
||||
catchFactor *= 2 # Easier to catch
|
||||
escapeFactor *= 2 if pbRandom(100)<90 # More likely to escape
|
||||
@@ -475,14 +475,14 @@ class PokeBattle_SafariZone
|
||||
@decision = 2
|
||||
elsif pbRandom(100)<5*escapeFactor
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplay(_INTL("{1} fled!",wildpoke.name))
|
||||
pbDisplay(_INTL("{1} fled!",pkmn.name))
|
||||
@decision = 3
|
||||
elsif cmd==1 # Bait
|
||||
pbDisplay(_INTL("{1} is eating!",wildpoke.name))
|
||||
pbDisplay(_INTL("{1} is eating!",pkmn.name))
|
||||
elsif cmd==2 # Rock
|
||||
pbDisplay(_INTL("{1} is angry!",wildpoke.name))
|
||||
pbDisplay(_INTL("{1} is angry!",pkmn.name))
|
||||
else
|
||||
pbDisplay(_INTL("{1} is watching carefully!",wildpoke.name))
|
||||
pbDisplay(_INTL("{1} is watching carefully!",pkmn.name))
|
||||
end
|
||||
# Weather continues
|
||||
@scene.pbCommonAnimation(PBWeather.animationName(@weather))
|
||||
|
||||
@@ -51,6 +51,19 @@ class PokeBattle_RealBattlePeer
|
||||
def pbBoxName(box)
|
||||
return (box<0) ? "" : $PokemonStorage[box].name
|
||||
end
|
||||
|
||||
def pbOnEnteringBattle(_battle,pkmn,wild=false)
|
||||
f = MultipleForms.call("getFormOnEnteringBattle",pkmn,wild)
|
||||
pkmn.form = f if f
|
||||
end
|
||||
|
||||
# For switching out, including due to fainting, and for the end of battle
|
||||
def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false)
|
||||
return if !pkmn
|
||||
f = MultipleForms.call("getFormOnLeavingBattle",pkmn,battle,usedInBattle,endBattle)
|
||||
pkmn.form = f if f && pkmn.form!=f
|
||||
pkmn.hp = pkmn.totalhp if pkmn.hp>pkmn.totalhp
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -863,8 +863,10 @@ BattleHandlers::DamageCalcTargetItem.add(:EVIOLITE,
|
||||
# means it also cares about the Pokémon's form. Some forms cannot
|
||||
# evolve even if the species generally can, and such forms are not
|
||||
# affected by Eviolite.
|
||||
evos = EvolutionHelper.evolutions(target.pokemon.fSpecies, true)
|
||||
mults[DEF_MULT] *= 1.5 if evos && evos.length>0
|
||||
evos = target.pokemon.species_data.evolutions
|
||||
if evos.any? { |e| e[1] != PBEvolution::None && !e[3] } # Not a "None", not a prevolution
|
||||
mults[DEF_MULT] *= 1.5 if evos && evos.length > 0
|
||||
end
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -143,10 +143,10 @@ BallHandlers::ModifyCatchRate.add(:QUICKBALL,proc { |ball,catchRate,battle,battl
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:FASTBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
baseStats = pbGetSpeciesData(battler.species,battler.form,SpeciesData::BASE_STATS)
|
||||
baseStats = battler.pokemon.baseStats
|
||||
baseSpeed = baseStats[PBStats::SPEED]
|
||||
catchRate *= 4 if baseSpeed>=100
|
||||
next [catchRate,255].min
|
||||
catchRate *= 4 if baseSpeed >= 100
|
||||
next [catchRate, 255].min
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
|
||||
Reference in New Issue
Block a user