赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 3 |
经验 | 0 |
最后登录 | 2018-9-2 |
在线时间 | 5 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 331
- 在线时间
- 5 小时
- 注册时间
- 2012-4-21
- 帖子
- 5
|
3楼
楼主 |
发表于 2012-4-27 21:17:12
|
只看该作者
begin
BADGEFORCUT=0
BADGEFORFLASH=1
BADGEFORROCKSMASH=2
BADGEFORSURF=3
BADGEFORFLY=4
BADGEFORSTRENGTH=5
BADGEFORDIVE=6
BADGEFORWATERFALL=7
STARTING_OVER_SWITCH=5
POKeRUS_SWITCH=3
GRASS_ANIMATION_ID=103
DIVE_TERRAIN_TAG=5
WATERFALL_TERRAIN_TAG=8
def pbIsPassableWaterTag?(tag)
return tag==6||tag==7||tag==5||tag==9
end
def pbIsGrassTag?(tag)
return tag==2||tag==10||tag==11
end
def pbIsWaterTag?(tag)
return tag==6||tag==7||tag==5||tag==8||tag==9
end
def pbBattleAnimation(bgm=nil)
if bgm
$game_system.bgm_play(bgm,100,100)
else
$game_system.bgm_play("002-Battle02.mid",100,100)
end
viewport=Viewport.new(0,0,480,320)
viewport.z=99999
viewport.color=Color.new(17*8,17*8,17*8)
3.times do
viewport.color.alpha=0
6.times do
viewport.color.alpha+=30
Graphics.update
Input.update
pbUpdateSceneMap
end
6.times do
viewport.color.alpha-=30
Graphics.update
Input.update
pbUpdateSceneMap
end
end
if FileTest.exist?("rubyscreen.dll")
v=rand(10)
else
v=rand(5)
end
case v
when 0
Graphics.freeze
viewport.color=Color.new(0,0,0,255)
Graphics.transition(40,"Graphics/Transitions/Battle.png")
when 1
Graphics.freeze
viewport.color=Color.new(0,0,0,255)
Graphics.transition(40,"Graphics/Transitions/Image1.png")
when 2
Graphics.freeze
viewport.color=Color.new(0,0,0,255)
Graphics.transition(40,"Graphics/Transitions/Image2.png")
when 3
Graphics.freeze
viewport.color=Color.new(0,0,0,255)
Graphics.transition(40,"Graphics/Transitions/Image3.png")
when 4
Graphics.freeze
viewport.color=Color.new(0,0,0,255)
Graphics.transition(40,"Graphics/Transitions/Image4.png")
when 5
pbBreakingGlass
viewport.color=Color.new(0,0,0,255)
when 6
pbBreakingGlass # pbZoomAndFadeOut
viewport.color=Color.new(0,0,0,255)
when 7
pbRotatingPieces
viewport.color=Color.new(0,0,0,255)
when 8
pbScrollScreen((rand(4)+1)*2)
viewport.color=Color.new(0,0,0,255)
when 9
pbMosaic
viewport.color=Color.new(0,0,0,255)
end
5.times do
Graphics.update
Input.update
pbUpdateSceneMap
end
yield if block_given?
for j in 0..17
viewport.color=Color.new(0,0,0,(17-j)*15)
Graphics.update
Input.update
pbUpdateSceneMap
end
viewport.dispose
end
def pbWildBattle(species,level,variable=nil,canescape=true)
if Input.press?(Input::CTRL) && $DEBUG
Kernel.pbMessage(_INTL("跳出战斗..."))
$game_variables[variable]=1 if variable
return true
end
currentlevels=[]
for i in $Trainer.party
currentlevels.push(i.level)
end
genwildpoke=PokeBattle_Pokemon.new(species,level,$Trainer)
dexdata=pbOpenDexData
itemrnd=rand(100)
if itemrnd<50
dexdata.pos=76*(species-1)+48
genwildpoke.item=dexdata.fgetw
elsif itemrnd<55
dexdata.pos=76*(species-1)+50
genwildpoke.item=dexdata.fgetw
end
dexdata.close
pokerus=(rand(8192)==0)
if pokerus
genwildpoke.pokerus=1
genwildpoke.pokerusTime=Time.now.to_i
end
wildpoke=[genwildpoke]
scene=PokeBattle_Scene.new
battle=PokeBattle_Battle.new(scene,$Trainer.party,wildpoke,$Trainer,nil)
battle.internalbattle=true
if $game_screen.weather_type==1 || $game_screen.weather_type==2
battle.weather=PBWeather::RAINDANCE
battle.weatherduration=-1
elsif $game_screen.weather_type==3
battle.weather=PBWeather::HAIL
battle.weatherduration=-1
elsif $game_screen.weather_type==4
battle.weather=PBWeather::SANDSTORM
battle.weatherduration=-1
end
battle.environment=pbGetEnvironment
battle.cantescape=!canescape
battle.shiftStyle=($PokemonSystem.battlestyle==0)
battle.battlescene=($PokemonSystem.battlescene==0)
playingBGS=$game_system.getPlayingBGS
playingBGM=$game_system.getPlayingBGM
$game_system.bgm_stop
$game_system.bgs_stop
wildbgm=pbGetMetadata(0,MetadataWildBattleBGM)
if wildbgm
wildbgm="#{wildbgm}"
end
restorebgm=true
decision=0
pbBattleAnimation(wildbgm) {
decision=battle.pbStartBattle
if decision==2
Kernel.pbStartOver
restorebgm=false
else
# Check conditions for evolution
for i in 0...currentlevels.length
pokemon=$Trainer.party[i]
if pokemon && pokemon.level!=currentlevels[i]
newspecies=Kernel.pbCheckEvolution(pokemon)
if newspecies>0
# Start evolution scene
evo=PokemonEvolutionScene.new
evo.pbStartScreen(pokemon,newspecies)
evo.pbEvolution
evo.pbEndScreen
end
end
end
if decision==1
for pkmn in $Trainer.party
Kernel.pbPickup(pkmn)
end
end
if pokerus && rand(3)==0
first=0
last=$Trainer.party.length-1
if $Trainer.party[first].pokerus==0 && !$Trainer.party[first].egg?
$Trainer.party[first].pokerus=1
$Trainer.party[first].pokerusTime=Time.now.to_i
end
if $Trainer.party[last].pokerus==0 && !$Trainer.party[last].egg?
$Trainer.party[last].pokerus=1
$Trainer.party[last].pokerusTime=Time.now.to_i
end
end
end
}
if restorebgm
$game_system.bgm_play(playingBGM)
$game_system.bgs_play(playingBGS)
end
$PokemonEncounters.clearStepCount
Input.update
$game_variables[variable]=decision if variable
return (decision!=2)
end
def pbDynamicItemList(*args)
ret=[]
for i in 0...args.length
if PBItems.hasConst?(PBItems,args[i])
ret.push(PBItems.const_get(args[i].to_sym))
end
end
return ret
end
def Kernel.pbPickup(pokemon)
return if pokemon.ability!=PBAbilities::PICKUP || pokemon.egg?
return if pokemon.item!=0
return if rand(10)!=0
pickupList=pbDynamicItemList(
:POTION,
:ANTIDOTE,
:SUPERPOTION,
:GREATBALL,
:REPEL,
:ESCAPEROPE,
:XATTACK,
:FULLHEAL,
:ULTRABALL,
:HYPERPOTION,
:RARECANDY,
:PROTEIN,
:REVIVE,
:HPUP,
:FULLRESTORE,
:MAXREVIVE,
:PPUP,
:MAXELIXIR
)
pickupListRare=pbDynamicItemList(
:HYPERPOTION,
:NUGGET,
:KINGSROCK,
:FULLRESTORE,
:ETHER,
:WHITEHERB,
:TM44,
:ELIXIR,
:TM01,
:LEFTOVERS,
:TM26
)
return if pickupList.length!=18
return if pickupListRare.length!=11
randlist=[30,10,10,10,10,10,10,5,3,1,1]
items=[]
rnd=rand(100)
itemstart=(pokemon.level-1)/10
itemstart=0 if itemstart<0
for i in 0...9
items.push(pickupList[i+itemstart])
end
items.push(pickupListRare[itemstart])
items.push(pickupListRare[itemstart+1])
cumnumber=0
for i in 0...11
cumnumber+=randlist[i]
if rnd<cumnumber
pokemon.item=items[i]
break
end
end
end
def Kernel.pbOnStepTaken
if $game_player.move_route_forcing
pbFieldMovementOnStepTaken
return
end
for pkmn in $Trainer.party
next if pkmn.egg?
if pkmn.pokerus==1 && Time.now.to_i>=pkmn.pokerusTime+345600
# Cured
pkmn.pokerus=2
end
end
if $PokemonGlobal.repel>0
$PokemonGlobal.repel-=1
if $PokemonGlobal.repel<=0
Kernel.pbDisplayMessage(_INTL("Repel's effect wore off..."))
end
end
$PokemonGlobal.happinessSteps=0 if !$PokemonGlobal.happinessSteps
$PokemonGlobal.happinessSteps+=1
if $PokemonGlobal.happinessSteps==256
for pkmn in $Trainer.party
pkmn.happiness+=1 if pkmn.hp>0 && !pkmn.egg?
pkmn.happiness=255 if pkmn.happiness>255
end
$PokemonGlobal.happinessSteps=0
end
pbDayCareOnStepTaken
$PokemonGlobal.stepcount=0 if !$PokemonGlobal.stepcount
$PokemonGlobal.stepcount+=1
$PokemonGlobal.stepcount&=0xFFFFFF
if $PokemonGlobal.stepcount % 4 == 0
for i in $Trainer.party
if i.status==PBStatuses::POISON && i.hp>0 && !i.egg?
$game_screen.start_flash(Color.new(255,0,0,128), 4)
i.hp-=1
if i.hp==0
Kernel.pbDisplayMessage(_INTL("{1} 昏倒了...",i.name))
end
if pbAllFainted
Kernel.pbDisplayMessage(_INTL("{1} 没有能对战的怪兽!",i.name))
Kernel.pbDisplayMessage(_INTL("{1} 眼前一片黑!",i.name))
pbFadeOutIn(99999){
Kernel.pbStartOver
}
return
end
end
end
end
pbFieldMovementOnStepTaken
if $PokemonGlobal.surfing
encounter=$PokemonEncounters.pbGenerateEncounter(2)
if encounter && !(Input.press?(Input::CTRL) && $DEBUG)
encname=PBSpecies.getName(encounter[0])
pbWildBattle(encounter[0],encounter[1])
end
elsif $PokemonEncounters.isCave?
encounter=$PokemonEncounters.pbGenerateEncounter(1)
if encounter && !(Input.press?(Input::CTRL) && $DEBUG)
encname=PBSpecies.getName(encounter[0])
pbWildBattle(encounter[0],encounter[1])
end
elsif $PokemonEncounters.isGrass? && !(Input.press?(Input::CTRL) && $DEBUG)
encounter=$PokemonEncounters.pbGenerateEncounter(0)
x=$game_player.x
y=$game_player.y
if pbIsGrassTag?($game_map.terrain_tag(x,y))
if encounter
encname=PBSpecies.getName(encounter[0])
pbWildBattle(encounter[0],encounter[1])
end
end
end
end
def pbGetEnvironment
if $PokemonGlobal.diving
return PBEnvironment::Underwater
elsif $PokemonEncounters.isCave?
return PBEnvironment::Cave
elsif !pbGetMetadata($game_map.map_id,MetadataOutdoor)
return PBEnvironment::None
else
terrain=$game_player.terrain_tag
if terrain==2 # Normal grass
return PBEnvironment::Grass
elsif terrain==10 # Tall grass
return PBEnvironment::TallGrass
elsif terrain==5 || terrain==7
return PBEnvironment::MovingWater
elsif terrain==6
return PBEnvironment::StillWater
elsif terrain==4
return PBEnvironment::Rock
elsif terrain==3
return PBEnvironment::Sand
end
return PBEnvironment::None
end
end
def pbFieldMovementOnStepTaken
x=$game_player.x
y=$game_player.y
if $game_map.terrain_tag(x,y)==2 # grass terrain tag
$scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,x,y)
end
if $game_map.terrain_tag(x,y)==9 # Crest of waterfall
Kernel.pbDescendWaterfall
end
end
class DarknessSprite < SpriteWrapper
attr_reader :radius
def initialize(viewport=nil)
super(viewport)
@darkness=Bitmap.new(480,320)
@radius=48
self.bitmap=@darkness
self.z=99998
refresh
end
def dispose
@darkness.dispose
super
end
def radius=(value)
@radius=value
refresh
end
def refresh
@darkness.fill_rect(0,0,480,320,Color.new(0,0,0,255))
cx=240
cy=160
cradius=@radius
for i in cx-cradius..cx+cradius
diff2 = (cradius * cradius) - ((i - cx) * (i - cx));
diff = Math.sqrt( diff2);
@darkness.fill_rect(i,cy-diff,1,diff*2,Color.new(0,0,0,0))
end
end
end
class LocationWindow < Window_SimpleTextPokemon
def initialize(name)
super(name)
self.resizeToFit(name)
self.x=0
self.y=-self.height
self.z=99999
@currentmap=$game_map.map_id
@frames=0
end
def update
return if disposed?
super
if $game_temp.message_window_showing ||
@currentmap!=$game_map.map_id ||
$PokemonTemp.mapChanged
self.dispose
return
end
if @frames>60
self.y-=4
self.dispose if self.y+self.height<0
else
self.y+=4 if self.y<0
@frames+=1
end
end
end
def Kernel.pbOnMapChange
healing=pbGetMetadata($game_map.map_id,MetadataHealingSpot)
if healing
$PokemonGlobal.healingSpot=healing
end
$PokemonMap.clear if $PokemonMap
if $PokemonEncounters
$PokemonEncounters.setup($game_map.map_id)
end
$PokemonGlobal.visitedMaps[$game_map.map_id]=true
$PokemonTemp.mapChanged=true
end
def Kernel.pbOnMapSceneChange(scene,mapChanged)
darkmap=pbGetMetadata($game_map.map_id,MetadataDarkMap)
if darkmap && !$PokemonGlobal.flashUsed
$PokemonTemp.darknessSprite=DarknessSprite.new
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
else
if !darkmap
$PokemonGlobal.flashUsed=false
end
if $PokemonTemp.darknessSprite
$PokemonTemp.darknessSprite.dispose if $PokemonTemp.darknessSprite
$PokemonTemp.darknessSprite=nil
end
end
if mapChanged
if pbGetMetadata($game_map.map_id,MetadataShowArea)
scene.spriteset.addUserSprite(LocationWindow.new($game_map.name))
end
weather=pbGetMetadata($game_map.map_id,MetadataWeather)
if weather && rand(100)<weather[1]
$game_screen.weather(weather[0],8,20)
else
$game_screen.weather(0,0,0)
end
end
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
Kernel.pbMountBike
else
val=pbGetMetadata($game_map.map_id,MetadataBicycle)
val=pbGetMetadata($game_map.map_id,MetadataOutdoor) if val==nil
if !val
Kernel.pbDismountBike
end
end
end
def Kernel.pbUpdateVehicle
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
if meta
if $PokemonGlobal.diving
$game_player.character_name=meta[6] && meta[6]!="" ? meta[6] : meta[1] # Diving graphic
elsif $PokemonGlobal.surfing
$game_player.character_name=meta[4] && meta[4]!="" ? meta[4] : meta[1] # Surfing graphic
elsif $PokemonGlobal.bicycle
$game_player.character_name=meta[2] && meta[2]!="" ? meta[2] : meta[1] # Bicycle graphic
else
$game_player.character_name=meta[1] # Regular graphic
end
end
end
def Kernel.pbMountBike
return if $PokemonGlobal.bicycle
$PokemonGlobal.bicycle=true
Kernel.pbUpdateVehicle
end
def Kernel.pbDismountBike
return if !$PokemonGlobal.bicycle
$PokemonGlobal.bicycle=false
Kernel.pbUpdateVehicle
end
def Kernel.pbCancelVehicles
$PokemonGlobal.surfing=false
$PokemonGlobal.diving=false
$PokemonGlobal.bicycle=false
Kernel.pbUpdateVehicle
end
def pbFishing
bitechance=65
hookchance=65
msgwindow=Kernel.pbCreateMessageWindow
loop do
time=2+rand(10)
message=""
time.times do
message+=". "
end
if Kernel.pbDisplayMessageFancy(msgwindow,message,0,0,true)
Kernel.pbDisplayMessageFancy(msgwindow,_INTL("钓不到..."))
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
rnd=rand(100)
if rnd<bitechance
frames=rand(15)+30
if !Kernel.pbDisplayMessageFancy(msgwindow,message+_INTL("\r\n咬钩了!"),nil,frames)
Kernel.pbDisplayMessageFancy(msgwindow,_INTL("它跑了..."))
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
rnd=rand(100)
if rnd<hookchance
Kernel.pbDisplayMessageFancy(msgwindow,_INTL("钓到了一只口袋怪兽!"),-1)
Kernel.pbDisposeMessageWindow(msgwindow)
return true
end
hookchance+=15
bitechance+=15
else
Kernel.pbDisplayMessageFancy(msgwindow,_INTL("钓不到..."))
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
end
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
def pbAllFainted
for i in $Trainer.party
return false if !i.egg? && i.hp>0
end
return true
end
def Kernel.pbSetPokemonCenter
$PokemonGlobal.pokecenterMapId=$game_map.map_id
$PokemonGlobal.pokecenterX=$game_player.x
$PokemonGlobal.pokecenterY=$game_player.y
$PokemonGlobal.pokecenterDirection=$game_player.direction
end
def Kernel.pbStartOver
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
Kernel.pbDisplayMessage(_INTL("{1} 往口袋怪兽中心匆忙地跑去,保护努力战斗而且昏倒的口袋怪兽免于较进一步的伤害。",$Trainer.name))
Kernel.pbCancelVehicles
$game_switches[STARTING_OVER_SWITCH]=true
$game_temp.player_new_map_id=$PokemonGlobal.pokecenterMapId
$game_temp.player_new_x=$PokemonGlobal.pokecenterX
$game_temp.player_new_y=$PokemonGlobal.pokecenterY
$game_temp.player_new_direction=$PokemonGlobal.pokecenterDirection
$scene.transfer_player
$game_map.refresh
else
Kernel.pbDisplayMessage(_INTL("{1} 往家匆忙地跑去,保护努力战斗而且昏倒的口袋怪兽免于较进一步的伤害",$Trainer.name))
homedata=pbGetMetadata(0,MetadataHome)
if homedata
Kernel.pbCancelVehicles
$game_switches[STARTING_OVER_SWITCH]=true
$game_temp.player_new_map_id=homedata[0]
$game_temp.player_new_x=homedata[1]
$game_temp.player_new_y=homedata[2]
$game_temp.player_new_direction=homedata[3]
$scene.transfer_player
$game_map.refresh
else
for i in $Trainer.party
i.heal
end
end
end
end
def Kernel.pbItemBall(item)
itemname=PBItems.getName(item)
Kernel.pbDisplayMessage(_INTL("{1} 找到了 {2}!",$Trainer.name,itemname))
if $PokemonBag.pbStoreItem(item)
case $ItemData[item][ITEMPOCKET]
when 1
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入道具口袋中。",$Trainer.name,itemname))
when 2
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入怪兽球口袋中。",$Trainer.name,itemname))
when 3
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入秘笈口袋中。",$Trainer.name,itemname))
when 4
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入树果口袋中。",$Trainer.name,itemname))
when 5
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入珍贵物品口袋中。",$Trainer.name,itemname))
end
return true
else
Kernel.pbDisplayMessage(_INTL("太糟糕了... 背包装满了..."))
return false
end
end
def Kernel.pbReceiveItem(item)
itemname=PBItems.getName(item)
Kernel.pbDisplayMessage(_INTL("获得 {2}!",$Trainer.name,itemname))
if $PokemonBag.pbStoreItem(item)
case $ItemData[item][ITEMPOCKET]
when 1
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入道具口袋中。",$Trainer.name,itemname))
when 2
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入怪兽球口袋中。",$Trainer.name,itemname))
when 3
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入秘笈口袋中。",$Trainer.name,itemname))
when 4
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入树果口袋中。",$Trainer.name,itemname))
when 5
Kernel.pbDisplayMessage(_INTL("{1} 将 {2} 放入珍贵物品口袋中。",$Trainer.name,itemname))
end
return true
else
return false
end
end
def Kernel.pbHealAll
for i in $Trainer.party
i.heal
end
end
def Kernel.pbPokerus?
return false if $game_switches[POKeRUS_SWITCH]
for i in $Trainer.party
return true if i.pokerus==1 && !i.egg?
end
return false
end
def Kernel.pbCheckMove(move)
for i in $Trainer.party
for j in i.moves
return i if j.id==move
end
end
return nil
end
def Kernel.pbCut
if $DEBUG || $Trainer.badges[BADGEFORCUT]
movefinder=Kernel.pbCheckMove(PBMoves::CUT)
if $DEBUG || movefinder
Kernel.pbDisplayMessage(_INTL("这树好像能砍断!"))
if Kernel.pbConfirmMessage(_INTL("砍掉它吗?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} 使用间合斩!",speciesname))
return true
end
else
Kernel.pbDisplayMessage(_INTL("这树看起来好像能砍断。"))
end
else
Kernel.pbDisplayMessage(_INTL("这树看起来好像能砍断。"))
end
return false
end
def Kernel.pbRockSmashRandomEncounter
if rand(100)<25
encounter=$PokemonEncounters.pbEncounteredPokemon(3)
if encounter
encname=PBSpecies.getName(encounter[0])
Kernel.pbWildBattle(encounter[0],encounter[1])
end
end
end
def Kernel.pbHeadbuttEffect(event)
a=((event.x*event.y+event.x*event.y)/5)%10
b=($Trainer.id&0xFFFF)%10
chance=1
if a==b
chance=8
elsif a>b && (a-b).abs<5
chance=5
elsif a<b && (a-b).abs>5
chance=5
end
if rand(10)>=chance
Kernel.pbDisplayMessage(_INTL("不. 没有东西..."))
else
encounter=$PokemonEncounters.pbEncounteredPokemon(chance==1 ? 7 : 8)
if encounter
encname=PBSpecies.getName(encounter[0])
Kernel.pbWildBattle(encounter[0],encounter[1])
else
Kernel.pbDisplayMessage(_INTL("不. 没有东西..."))
end
end
end
def Kernel.pbHeadbutt(event)
movefinder=Kernel.pbCheckMove(PBMoves::HEADBUTT)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("这颗树上好像有只口袋怪兽。 想要把撞它下来吗?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} 使用了头撞!",speciesname))
Kernel.pbHeadbuttEffect(event)
end
else
Kernel.pbDisplayMessage(_INTL("这颗树上好像有只口袋怪兽。 也许一只口袋怪兽能摇动它."))
end
Input.update
return
end
def Kernel.pbRockSmash
if $DEBUG || $Trainer.badges[BADGEFORROCKSMASH]
movefinder=Kernel.pbCheckMove(PBMoves::ROCKSMASH)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("这块岩石显得很破碎. 是否使用岩碎?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} 使用岩碎!",speciesname))
return true
end
else
Kernel.pbDisplayMessage(_INTL("这是一块高低不平的岩石, 但是使用口袋怪兽的技能可以弄碎吧。"))
end
else
Kernel.pbDisplayMessage(_INTL("这是一块高低不平的岩石, 但是使用口袋怪兽的技能可以弄碎吧。"))
end
return false
end
def Kernel.pbStrength
if $PokemonMap.strengthUsed
Kernel.pbDisplayMessage(_INTL("怪力术好像能移动大岩石."))
elsif $DEBUG || $Trainer.badges[BADGEFORSTRENGTH]
movefinder=Kernel.pbCheckMove(PBMoves::STRENGTH)
if $DEBUG || movefinder
Kernel.pbDisplayMessage(_INTL("一个大圆石,但是使用口袋怪兽的技能可以移动它吧。"))
if Kernel.pbConfirmMessage(_INTL("是否使用怪力术?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} 使用怪力术!",speciesname))
Kernel.pbDisplayMessage(_INTL("{1}'的怪力术使岩石移动了!",speciesname))
$PokemonMap.strengthUsed=true
return true
end
else
Kernel.pbDisplayMessage(_INTL("一个大圆石,但是使用口袋怪兽的技能可以移动它吧。"))
end
else
Kernel.pbDisplayMessage(_INTL("一个大圆石,但是使用口袋怪兽的技能可以移动它吧。"))
end
return false
end
def Kernel.pbSurf
if $DEBUG || $Trainer.badges[BADGEFORSURF]
movefinder=Kernel.pbCheckMove(PBMoves::SURF)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("水是深蓝色的... 是否使用冲浪术?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} 使用冲浪术!",speciesname))
Kernel.pbCancelVehicles
$PokemonGlobal.surfing=true
$PokemonEncounters.clearStepCount
Kernel.pbJumpToward
Kernel.pbUpdateVehicle
$game_player.check_event_trigger_here([1,2])
return true
end
end
end
return false
end
def Kernel.pbSurfacing
return if !$PokemonGlobal.diving
divemap=nil
meta=pbLoadMetadata
for i in 0...meta.length
if meta[i] && meta[i][MetadataDiveMap]
if meta[i][MetadataDiveMap]==$game_map.map_id
divemap=i
break
end
end
end
return if !divemap
movefinder=Kernel.pbCheckMove(PBMoves::DIVE)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} 使用潜水.",speciesname))
pbFadeOutIn(99999){
$game_temp.player_new_map_id=divemap
$game_temp.player_new_x=$game_player.x
$game_temp.player_new_y=$game_player.y
$game_temp.player_new_direction=$game_player.direction
pbCancelVehicles
$PokemonGlobal.surfing=true
pbUpdateVehicle
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
return true
end
else
raise _INTL("Can't find Pokemon with Dive...")
end
return false
end
def Kernel.pbAscendWaterfall
return if $game_player.direction!=8
oldthrough=$game_player.through
oldmovespeed=$game_player.move_speed
terrain=Kernel.pbFacingTerrainTag
return if terrain!=8 && terrain!=9
$game_player.through=true
$game_player.move_speed=2
loop do
$game_player.move_up
terrain=$game_player.terrain_tag
break if terrain!=8 && terrain!=9
end
$game_player.through=oldthrough
$game_player.move_speed=oldmovespeed
end
def Kernel.pbDescendWaterfall
return if $game_player.direction!=2
oldthrough=$game_player.through
oldmovespeed=$game_player.move_speed
terrain=Kernel.pbFacingTerrainTag
return if terrain!=8 && terrain!=9
$game_player.through=true
$game_player.move_speed=2
loop do
$game_player.move_down
terrain=$game_player.terrain_tag
break if terrain!=8 && terrain!=9
end
$game_player.through=oldthrough
$game_player.move_speed=oldmovespeed
end
def Kernel.pbWaterfall
if $DEBUG || $Trainer.badges[BADGEFORWATERFALL]
movefinder=Kernel.pbCheckMove(PBMoves::WATERFALL)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} used Waterfall.",speciesname))
pbAscendWaterfall
return true
end
else
Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
end
else
Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
end
return false
end
def Kernel.pbDive
divemap=pbGetMetadata($game_map.map_id,MetadataDiveMap)
return false if !divemap
if $DEBUG || $Trainer.badges[BADGEFORDIVE]
movefinder=Kernel.pbCheckMove(PBMoves::DIVE)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
speciesname=!movefinder ? PBSpecies.getName(0) : movefinder.name
Kernel.pbDisplayMessage(_INTL("{1} used Dive.",speciesname))
pbFadeOutIn(99999){
$game_temp.player_new_map_id=divemap
$game_temp.player_new_x=$game_player.x
$game_temp.player_new_y=$game_player.y
$game_temp.player_new_direction=$game_player.direction
pbCancelVehicles
$PokemonGlobal.diving=true
pbUpdateVehicle
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
return true
end
else
Kernel.pbMessage(_INTL("The sea is deep here. A Pokemon may be able to go underwater."))
end
else
Kernel.pbMessage(_INTL("The sea is deep here. A Pokemon may be able to go underwater."))
end
return false
end
def pbEndSurf(xOffset,yOffset)
return false if !$PokemonGlobal.surfing
x=$game_player.x
y=$game_player.y
currentTag=$game_map.terrain_tag(x,y)
facingTag=Kernel.pbFacingTerrainTag
if pbIsWaterTag?(currentTag)&&!pbIsWaterTag?(facingTag)
if Kernel.pbJumpToward
Kernel.pbCancelVehicles
increase_steps
$game_player.check_event_trigger_here([1,2])
Kernel.pbOnStepTaken
end
return true
end
return false
end
class Interpreter
def pbPushThisBoulder
if $PokemonMap.strengthUsed
pbPushThisEvent
end
return true
end
def pbHeadbutt
Kernel.pbHeadbutt(get_character(0))
return true
end
def pbSetEventTime(*arg)
$PokemonGlobal.eventvars={} if !$PokemonGlobal.eventvars
time=Time.now.to_i
pbSetSelfSwitch(@event_id,"A",true)
$PokemonGlobal.eventvars[[@map_id,@event_id]]=time
for otherevt in arg
pbSetSelfSwitch(otherevt,"A",true)
$PokemonGlobal.eventvars[[@map_id,otherevt]]=time
end
end
def getVariable
return nil if !$PokemonGlobal.eventvars
return $PokemonGlobal.eventvars[[@map_id,@event_id]]
end
def setVariable(value)
$PokemonGlobal.eventvars={} if !$PokemonGlobal.eventvars
$PokemonGlobal.eventvars[[@map_id,@event_id]]=value
end
def setTempSwitchOn(c)
get_character(0).setTempSwitchOn(c)
end
def setTempSwitchOff(c)
get_character(0).setTempSwitchOff(c)
end
def command_352
scene=PokemonSaveScene.new
screen=PokemonSave.new(scene)
screen.pbSaveScreen
return true
end
def command_125
value = operate_value(@parameters[0], @parameters[1], @parameters[2])
$Trainer.money+=value
$Trainer.money=0 if $Trainer.money<0
$Trainer.money=999999 if $Trainer.money>999999
end
end
def Kernel.pbCanUseHiddenMove?(pkmn,move)
case move
when PBMoves::FLY
if !$DEBUG && !$Trainer.badges[BADGEFORFLY]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用。"))
return false
end
if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
return true
when PBMoves::CUT
if !$DEBUG && !$Trainer.badges[BADGEFORCUT]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用"))
return false
end
facingEvent=$game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="Tree"
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
return true
when PBMoves::HEADBUTT
facingEvent=$game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="HeadbuttTree"
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
return true
when PBMoves::SURF
terrain=Kernel.pbFacingTerrainTag
if !$DEBUG && !$Trainer.badges[BADGEFORCUT]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用"))
return false
end
if $PokemonGlobal.surfing
Kernel.pbDisplayMessage(_INTL("已经用了冲浪术。"))
return false
end
terrain=Kernel.pbFacingTerrainTag
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
Kernel.pbDisplayMessage(_INTL("让我们享受骑脚踏车兜风的!"))
return false
end
if !pbIsWaterTag?(terrain)
Kernel.pbDisplayMessage(_INTL("这里不能冲浪!"))
return false
end
return true
when PBMoves::STRENGTH
if !$DEBUG && !$Trainer.badges[BADGEFORSTRENGTH]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用"))
return false
end
facingEvent=$game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="Boulder"
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
return true
when PBMoves::ROCKSMASH
terrain=Kernel.pbFacingTerrainTag
if !$DEBUG && !$Trainer.badges[BADGEFORROCKSMASH]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用"))
return false
end
facingEvent=$game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="Rock"
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
return true
when PBMoves::FLASH
if !$DEBUG && !$Trainer.badges[BADGEFORFLASH]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用"))
return false
end
if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
if $PokemonGlobal.flashUsed
Kernel.pbDisplayMessage(_INTL("这已经在使用中。"))
return false
end
return true
when PBMoves::WATERFALL
if !$DEBUG && !$Trainer.badges[BADGEFORWATERFALL]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用"))
return false
end
terrain=Kernel.pbFacingTerrainTag
if terrain!=WATERFALL_TERRAIN_TAG
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
return true
when PBMoves::DIVE
if !$DEBUG && !$Trainer.badges[BADGEFORDIVE]
Kernel.pbDisplayMessage(_INTL("对不起, 没得到新的徽章之前不能使用"))
return false
end
if $PokemonGlobal.diving
return true
end
if $game_player.terrain_tag!=5
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
if !pbGetMetadata($game_map.map_id,MetadataDiveMap)
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
return true
when PBMoves::TELEPORT
if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
healing=$PokemonGlobal.healingSpot
if !healing
healing=pbGetMetadata(0,MetadataHome) # Home
end
if healing
mapname=pbGetMapNameFromId(healing[0])
if Kernel.pbConfirmMessage(_INTL("返回到最后一次使用恢复的{1}吗?",mapname))
return true
end
return false
else
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
when PBMoves::DIG
escape=pbGetMetadata($game_map.map_id,MetadataEscapePoint)
if !escape
Kernel.pbDisplayMessage(_INTL("这里不能使用。"))
return false
end
mapname=pbGetMapNameFromId(escape[0])
if Kernel.pbConfirmMessage(_INTL("离开这里返回到 {1}?",mapname))
return true
end
return false
when PBMoves::SWEETSCENT
return true
end
return false
end
def Kernel.pbUseHiddenMove(pokemon,move,flydata=nil)
case move
when PBMoves::FLY
Kernel.pbDisplayMessage(_INTL("{1} 使用飞空术!",pokemon.name))
pbFadeOutIn(99999){
Kernel.pbCancelVehicles
$game_temp.player_new_map_id=flydata[0]
$game_temp.player_new_x=flydata[1]
$game_temp.player_new_y=flydata[2]
$game_temp.player_new_direction=2
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
return true
when PBMoves::CUT
Kernel.pbDisplayMessage(_INTL("{1} 使用间合斩!",pokemon.name))
facingEvent=$game_player.pbFacingEvent
if facingEvent
facingEvent.erase
$PokemonMap.addErasedEvent(facingEvent.id)
end
return true
when PBMoves::SURF
Kernel.pbDisplayMessage(_INTL("{1} 使用冲浪术!",pokemon.name))
Kernel.pbCancelVehicles
$PokemonEncounters.clearStepCount
$PokemonGlobal.surfing=true
Kernel.pbJumpToward
Kernel.pbUpdateVehicle
$game_player.check_event_trigger_here([1,2])
return true
when PBMoves::STRENGTH
Kernel.pbDisplayMessage(_INTL("{1} 使用怪力术!",pokemon.name))
Kernel.pbDisplayMessage(_INTL("{1}'的怪力术使岩石移动了!",pokemon.name))
$PokemonGlobal.strengthUsed=true
return true
when PBMoves::ROCKSMASH
Kernel.pbDisplayMessage(_INTL("{1} 使用岩碎!",pokemon.name))
facingEvent=$game_player.pbFacingEvent
if facingEvent
facingEvent.erase
$PokemonMap.addErasedEvent(facingEvent.id)
end
return true
when PBMoves::FLASH
darkness=$PokemonTemp.darknessSprite
return false if !darkness || darkness.disposed?
Kernel.pbDisplayMessage(_INTL("{1} 使用闪光!",pokemon.name))
$PokemonGlobal.flashUsed=true
while darkness.radius<300
Graphics.update
Input.update
pbUpdateSceneMap
darkness.radius+=2
end
darkness.dispose
$PokemonTemp.darknessSprite=nil
return true
when PBMoves::WATERFALL
Kernel.pbDisplayMessage(_INTL("{1} 使用攀瀑.",pokemon.name))
pbAscendWaterfall
return true
when PBMoves::DIVE
wasdiving=$PokemonGlobal.diving
if $PokemonGlobal.diving
divemap=nil
meta=pbLoadMetadata
for i in 0...meta.length
if meta[i] && meta[i][MetadataDiveMap]
if meta[i][MetadataDiveMap]==$game_map.map_id
divemap=i
break
end
end
end
else
divemap=pbGetMetadata($game_map.map_id,MetadataDiveMap)
end
return false if !divemap
Kernel.pbDisplayMessage(_INTL("{1} 使用潜水.",speciesname))
pbFadeOutIn(99999){
$game_temp.player_new_map_id=divemap
$game_temp.player_new_x=$game_player.x
$game_temp.player_new_y=$game_player.y
$game_temp.player_new_direction=$game_player.direction
pbCancelVehicles
if wasdiving
$PokemonGlobal.surfing=true
else
$PokemonGlobal.diving=true
end
pbUpdateVehicles
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
return true
when PBMoves::HEADBUTT
Kernel.pbDisplayMessage(_INTL("{1} 使用头撞!",pokemon.name))
Kernel.pbHeadbuttEffect(event)
when PBMoves::SWEETSCENT
Kernel.pbDisplayMessage(_INTL("{1} 使用甜味!",pokemon.name))
pbSweetScent
return true
when PBMoves::DIG
escape=pbGetMetadata($game_map.map_id,MetadataEscapePoint)
if escape
Kernel.pbDisplayMessage(_INTL("{1} 使用挖洞!",pokemon.name))
pbFadeOutIn(99999){
Kernel.pbCancelVehicles
$game_temp.player_new_map_id=escape[0]
$game_temp.player_new_x=escape[1]
$game_temp.player_new_y=escape[2]
$game_temp.player_new_direction=2
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
return true
end
return false
when PBMoves::TELEPORT
healing=$PokemonGlobal.healingSpot
if !healing
healing=pbGetMetadata(0,MetadataHome)
end
if healing
Kernel.pbDisplayMessage(_INTL("{1} 使用瞬间移动!",pokemon.name))
pbFadeOutIn(99999){
Kernel.pbCancelVehicles
$game_temp.player_new_map_id=healing[0]
$game_temp.player_new_x=healing[1]
$game_temp.player_new_y=healing[2]
$game_temp.player_new_direction=2
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
return true
end
return false
end
end
def pbSweetScent
viewport=Viewport.new(0,0,480,360)
viewport.z=99999
count=0
viewport.color.alpha-=10
begin
if viewport.color.alpha<128 && count==0
viewport.color.red=255
viewport.color.green=0
viewport.color.blue=0
viewport.color.alpha+=10
else
count+=1
if count>60
viewport.color.alpha-=10
end
end
Graphics.update
Input.update
end until viewport.color.alpha<=0
viewport.dispose
encounter=nil
if $PokemonGlobal.surfing
encounter=$PokemonEncounters.pbEncounteredPokemon(2)
elsif $PokemonEncounters.isCave?
encounter=$PokemonEncounters.pbEncounteredPokemon(1)
elsif $PokemonEncounters.isGrass? && $game_player.terrain_tag==2
encounter=$PokemonEncounters.pbEncounteredPokemon(0)
end
if !encounter
Kernel.pbDisplayMessage(_INTL("这里没有出现什么东西..."))
else
pbWildBattle(encounter[0],encounter[1])
end
end
def pbUseKeyItem
if $PokemonBag.registeredItem==0
Kernel.pbDisplayMessage(_INTL("放在背包的装备,被登录了立即使用。"))
else
Kernel.pbUseKeyItemInField($PokemonBag.registeredItem)
end
end
def Kernel.pbHiddenMoveEvent
$PokemonTemp.hiddenMoveEventCalling=false
terrain=Kernel.pbFacingTerrainTag
if pbIsWaterTag?(terrain) &&
!$PokemonGlobal.surfing &&
!pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
Kernel.pbSurf
return
end
if terrain==WATERFALL_TERRAIN_TAG
Kernel.pbWaterfall
return
end
if terrain==9
Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
return
end
terrain=$game_player.terrain_tag
if terrain==DIVE_TERRAIN_TAG
Kernel.pbDive
return
end
if $PokemonGlobal.diving
Kernel.pbSurfacing
return
end
facingEvent=$game_player.pbFacingEvent
if facingEvent
if facingEvent.name=="Boulder"
Kernel.pbStrength
return
end
end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
else
end
end
这是FILED的脚本 |
|