def pbLoadGhostBitmap
bitmapFileName="Graphics/Battlers/ghost.png"
return AnimatedBitmap.new(bitmapFileName)
end
class PokemonBattlerSprite < RPG::Sprite
def setGhostBitmap
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadGhostBitmap()
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
self.color=Color.new(0,0,0,0)
end
end
class PokeBattle_Pokemon
def setGhostNoGender
@genderflag=2
end
end
GHOSTMAPS=[79,80,81,82,83]
def isGhostEncountersActive?
onGhostMap=false
for i in 0...GHOSTMAPS.length
if $game_map.map_id==GHOSTMAPS[i]
onGhostMap=true
break
end
end
return onGhostMap && !$PokemonBag.pbHasItem?(:SILPHSCOPE)
end
# Changed added
# Guaranteed escape from ghosts in Pokemon tower
if isGhostEncountersActive?
pbDisplayPaused(_INTL("Got away safely!"))
@decision=3
return 1
end
# Changed end
# Changed added
if isGhostEncountersActive? || $game_switches[88] # if your using the changing encounters mid game to add ghosts, then you need to use if $game_switches[170] || $game_switches[169] - switch 169 is the one defined as the switch that changes the encounters
pbDisplay(_INTL("Can't be catch!"))
return
end
# End changed
#========================
# Initialize wild Pokémon
#========================
if !@opponent
if @party2.length==1
if @doublebattle
raise _INTL("Only two wild Pokémon are allowed in double battles")
end
wildpoke=@party2[0]
wildpoke.name="Ghost" if isGhostEncountersActive? # Changed added this line
wildpoke.setGhostNoGender if isGhostEncountersActive? # Changed added
@battlers[1].pbInitialize(wildpoke,0,false)
@peer.pbOnEnteringBattle(self,wildpoke)
# pbSetSeen(wildpoke) # Changed removed this, added below:
pbSetSeen(wildpoke) if !isGhostEncountersActive?
@scene.pbStartBattle(self)
#pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
# Changed edited from the above
if isGhostEncountersActive?
pbDisplayPaused(_INTL("The Ghost appeared!"))
pbDisplayPaused(_INTL("Darn!\nThe Ghost can't be ID'd!"))
else
pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
end
# Changed done
# Changed - added - see http://pokemonessentials.wikia.com/wiki/Tutorial:Adding_ghosts
if isGhostEncountersActive? && !@opponent # In a wild battle
pbDisplay(_INTL("{1} is too scared to move!",@battlers[i].pbThis))
commandDone=true
#if pbCanShowFightMenu?(i)
# End Changed
# Changed added
if isGhostEncountersActive? # if you're using the changing encounters mid game to add ghosts, then you need to use if $game_switches[170] || $game_switches[169] - switch 169 is the one defined as the switch that changes the encounters
pbDisplay(_INTL("Ghost: Get out... Get out..."))
return
end
# Changed end
# Changed added
if isGhostEncountersActive?
ghost=@battle.party2[0]
@sprites["pokemon1"].setGhostBitmap()
else
@sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
end
# Changed end