diff --git a/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb b/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb index e930dbf4d..1d49e8f72 100644 --- a/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb +++ b/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb @@ -32,7 +32,6 @@ module RPG end def self.need_clearing() - p @cache.size return @cache.size >= 100 end diff --git a/Data/Scripts/012_Overworld/001_Overworld.rb b/Data/Scripts/012_Overworld/001_Overworld.rb index 002e6c1ab..a330ad35f 100644 --- a/Data/Scripts/012_Overworld/001_Overworld.rb +++ b/Data/Scripts/012_Overworld/001_Overworld.rb @@ -2,11 +2,11 @@ # Constant checks #=============================================================================== # Pokérus check -Events.onMapUpdate += proc { |_sender,_e| +Events.onMapUpdate += proc { |_sender, _e| next if !$Trainer last = $PokemonGlobal.pokerusTime now = pbGetTimeNow - if !last || last.year!=now.year || last.month!=now.month || last.day!=now.day + if !last || last.year != now.year || last.month != now.month || last.day != now.day for i in $Trainer.pokemon_party i.lowerPokerusCount end @@ -19,21 +19,17 @@ Events.onMapUpdate += proc { |_sender,_e| def pbPokerus? return false if $game_switches[Settings::SEEN_POKERUS_SWITCH] for i in $Trainer.party - return true if i.pokerusStage==1 + return true if i.pokerusStage == 1 end return false end - - class PokemonTemp attr_accessor :batterywarning attr_accessor :cueBGM attr_accessor :cueFrames end - - def pbBatteryLow? pstate = System.power_state # If it's not discharging, it doesn't matter if it's low @@ -46,12 +42,12 @@ def pbBatteryLow? return false end -Events.onMapUpdate += proc { |_sender,_e| +Events.onMapUpdate += proc { |_sender, _e| if !$PokemonTemp.batterywarning && pbBatteryLow? if !$game_temp.in_menu && !$game_temp.in_battle && - !$game_player.move_route_forcing && !$game_temp.message_window_showing && - !pbMapInterpreterRunning? - if pbGetTimeNow.sec==0 + !$game_player.move_route_forcing && !$game_temp.message_window_showing && + !pbMapInterpreterRunning? + if pbGetTimeNow.sec == 0 pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress.")) $PokemonTemp.batterywarning = true end @@ -59,17 +55,15 @@ Events.onMapUpdate += proc { |_sender,_e| end if $PokemonTemp.cueFrames $PokemonTemp.cueFrames -= 1 - if $PokemonTemp.cueFrames<=0 + if $PokemonTemp.cueFrames <= 0 $PokemonTemp.cueFrames = nil - if $game_system.getPlayingBGM==nil + if $game_system.getPlayingBGM == nil pbBGMPlay($PokemonTemp.cueBGM) end end end } - - #=============================================================================== # Checks per step #=============================================================================== @@ -77,19 +71,19 @@ Events.onMapUpdate += proc { |_sender,_e| Events.onStepTaken += proc { $PokemonGlobal.happinessSteps = 0 if !$PokemonGlobal.happinessSteps $PokemonGlobal.happinessSteps += 1 - if $PokemonGlobal.happinessSteps>=128 + if $PokemonGlobal.happinessSteps >= 128 for pkmn in $Trainer.able_party - pkmn.changeHappiness("walking") if rand(2)==0 + pkmn.changeHappiness("walking") if rand(2) == 0 end $PokemonGlobal.happinessSteps = 0 end } # Poison party Pokémon -Events.onStepTakenTransferPossible += proc { |_sender,e| +Events.onStepTakenTransferPossible += proc { |_sender, e| handled = e[0] next if handled[0] - if $PokemonGlobal.stepcount%4==0 && Settings::POISON_IN_FIELD + if $PokemonGlobal.stepcount % 4 == 0 && Settings::POISON_IN_FIELD flashed = false for i in $Trainer.able_party if i.status == :POISON && !i.hasAbility?(:IMMUNITY) @@ -97,15 +91,15 @@ Events.onStepTakenTransferPossible += proc { |_sender,e| pbFlash(Color.new(163, 73, 164, 128), 8) flashed = true end - i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD - if i.hp==1 && !Settings::POISON_FAINT_IN_FIELD + i.hp -= 1 if i.hp > 1 || Settings::POISON_FAINT_IN_FIELD + if i.hp == 1 && !Settings::POISON_FAINT_IN_FIELD i.status = :NONE - pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1",i.name)) + pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1", i.name)) next - elsif i.hp==0 + elsif i.hp == 0 i.changeHappiness("faint") i.status = :NONE - pbMessage(_INTL("{1} fainted...",i.name)) + pbMessage(_INTL("{1} fainted...", i.name)) end if $Trainer.able_pokemon_count == 0 handled[0] = true @@ -127,26 +121,26 @@ def pbCheckAllFainted end # Gather soot from soot grass -Events.onStepTakenFieldMovement += proc { |_sender,e| - event = e[0] # Get the event affected by field movement - thistile = $MapFactory.getRealTilePos(event.map.map_id,event.x,event.y) +Events.onStepTakenFieldMovement += proc { |_sender, e| + event = e[0] # Get the event affected by field movement + thistile = $MapFactory.getRealTilePos(event.map.map_id, event.x, event.y) map = $MapFactory.getMap(thistile[0]) for i in [2, 1, 0] - tile_id = map.data[thistile[1],thistile[2],i] + tile_id = map.data[thistile[1], thistile[2], i] next if tile_id == nil next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass if event == $game_player && GameData::Item.exists?(:SOOTSACK) $Trainer.soot += 1 if $PokemonBag.pbHasItem?(:SOOTSACK) end -# map.data[thistile[1], thistile[2], i] = 0 -# $scene.createSingleSpriteset(map.map_id) + # map.data[thistile[1], thistile[2], i] = 0 + # $scene.createSingleSpriteset(map.map_id) break end } # Show grass rustle animation, and auto-move the player over waterfalls and ice Events.onStepTakenFieldMovement += proc { |_sender, e| - event = e[0] # Get the event affected by field movement + event = e[0] # Get the event affected by field movement if $scene.is_a?(Scene_Map) event.each_occupied_tile do |x, y| if $MapFactory.getTerrainTag(event.map.map_id, x, y, true).shows_grass_rustle @@ -168,29 +162,42 @@ Events.onStepTakenFieldMovement += proc { |_sender, e| def pbOnStepTaken(eventTriggered) if $game_player.move_route_forcing || pbMapInterpreterRunning? - Events.onStepTakenFieldMovement.trigger(nil,$game_player) + Events.onStepTakenFieldMovement.trigger(nil, $game_player) return end $PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount $PokemonGlobal.stepcount += 1 $PokemonGlobal.stepcount &= 0x7FFFFFFF - repel_active = ($PokemonGlobal.repel > 0) || $PokemonTemp.pokeradar + repel_active = ($PokemonGlobal.repel > 0) || $PokemonTemp.pokeradar Events.onStepTaken.trigger(nil) -# Events.onStepTakenFieldMovement.trigger(nil,$game_player) + # Events.onStepTakenFieldMovement.trigger(nil,$game_player) handled = [nil] - Events.onStepTakenTransferPossible.trigger(nil,handled) + Events.onStepTakenTransferPossible.trigger(nil, handled) return if handled[0] pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu - $PokemonTemp.encounterTriggered = false # This info isn't needed here + $PokemonTemp.encounterTriggered = false # This info isn't needed here end # Start wild encounters while turning on the spot Events.onChangeDirection += proc { - repel_active = ($PokemonGlobal.repel > 0) || $PokemonTemp.pokeradar + repel_active = ($PokemonGlobal.repel > 0) || $PokemonTemp.pokeradar pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu } +def isFusionForced? + return false if $game_switches[RANDOMIZED_WILD_POKEMON_SWITCH] + return $game_switches[FORCE_FUSE_NEXT_POKEMON_SWITCH] || $game_switches[FORCE_ALL_WILD_FUSIONS_SWITCH] +end + +def isFusedEncounter + return false if !FUSED_WILD_POKEMON_SWITCH[35] + return false if $game_switches[RANDOMIZED_WILD_POKEMON_SWITCH] + return true if isFusionForced?() + chance = pbGet(WILD_FUSION_RATE_VAR) == 0 ? 5 : pbGet(WILD_FUSION_RATE_VAR) + return (rand(chance) == 0) +end + def pbBattleOnStepTaken(repel_active) return if $Trainer.able_pokemon_count == 0 return if !$PokemonEncounters.encounter_possible_here? @@ -199,6 +206,14 @@ def pbBattleOnStepTaken(repel_active) return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active) $PokemonTemp.encounterType = encounter_type encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type) + if isFusedEncounter() + encounter_fusedWith = $PokemonEncounters.choose_wild_pokemon(encounter_type) + if encounter[0] != encounter_fusedWith[0] + encounter[0] = getFusionSpecies(encounter[0], encounter_fusedWith[0]) + end + end + $game_switches[FORCE_FUSE_NEXT_POKEMON_SWITCH] = false + encounter = EncounterModifier.trigger(encounter) if $PokemonEncounters.allow_encounter?(encounter, repel_active) if $PokemonEncounters.have_double_wild_battle? @@ -215,8 +230,6 @@ def pbBattleOnStepTaken(repel_active) EncounterModifier.triggerEncounterEnd end - - #=============================================================================== # Checks when moving between maps #=============================================================================== @@ -238,7 +251,7 @@ Events.onMapChanging += proc { |_sender, e| # Set up various data related to the new map Events.onMapChange += proc { |_sender, e| - old_map_ID = e[0] # previous map ID, is 0 if no map ID + old_map_ID = e[0] # previous map ID, is 0 if no map ID new_map_metadata = GameData::MapMetadata.try_get($game_map.map_id) if new_map_metadata && new_map_metadata.teleport_destination $PokemonGlobal.healingSpot = new_map_metadata.teleport_destination @@ -258,7 +271,7 @@ Events.onMapChange += proc { |_sender, e| } Events.onMapSceneChange += proc { |_sender, e| - scene = e[0] + scene = e[0] mapChanged = e[1] next if !scene || !scene.spriteset # Update map trail @@ -288,9 +301,9 @@ Events.onMapSceneChange += proc { |_sender, e| if $PokemonGlobal.mapTrail[1] for i in 0...Settings::NO_SIGNPOSTS.length / 2 nosignpost = true if Settings::NO_SIGNPOSTS[2 * i] == $PokemonGlobal.mapTrail[1] && - Settings::NO_SIGNPOSTS[2 * i + 1] == $game_map.map_id + Settings::NO_SIGNPOSTS[2 * i + 1] == $game_map.map_id nosignpost = true if Settings::NO_SIGNPOSTS[2 * i + 1] == $PokemonGlobal.mapTrail[1] && - Settings::NO_SIGNPOSTS[2 * i] == $game_map.map_id + Settings::NO_SIGNPOSTS[2 * i] == $game_map.map_id break if nosignpost end mapinfos = pbLoadMapInfos @@ -307,15 +320,13 @@ Events.onMapSceneChange += proc { |_sender, e| end } - - #=============================================================================== # Event locations, terrain tags #=============================================================================== # NOTE: Assumes the event is 1x1 tile in size. Only returns one tile. -def pbFacingTile(direction=nil,event=nil) - return $MapFactory.getFacingTile(direction,event) if $MapFactory - return pbFacingTileRegular(direction,event) +def pbFacingTile(direction = nil, event = nil) + return $MapFactory.getFacingTile(direction, event) if $MapFactory + return pbFacingTileRegular(direction, event) end # NOTE: Assumes the event is 1x1 tile in size. Only returns one tile. @@ -336,22 +347,22 @@ def pbEventFacesPlayer?(event, player, distance) return false if !event || !player || distance <= 0 x_min = x_max = y_min = y_max = -1 case event.direction - when 2 # Down + when 2 # Down x_min = event.x x_max = event.x + event.width - 1 y_min = event.y + 1 y_max = event.y + distance - when 4 # Left + when 4 # Left x_min = event.x - distance x_max = event.x - 1 y_min = event.y - event.height + 1 y_max = event.y - when 6 # Right + when 6 # Right x_min = event.x + event.width x_max = event.x + event.width - 1 + distance y_min = event.y - event.height + 1 y_max = event.y - when 8 # Up + when 8 # Up x_min = event.x x_max = event.x + event.width - 1 y_min = event.y - event.height + 1 - distance @@ -360,7 +371,7 @@ def pbEventFacesPlayer?(event, player, distance) return false end return player.x >= x_min && player.x <= x_max && - player.y >= y_min && player.y <= y_max + player.y >= y_min && player.y <= y_max end # Returns whether event is able to walk up to the player. @@ -369,13 +380,13 @@ def pbEventCanReachPlayer?(event, player, distance) delta_x = (event.direction == 6) ? 1 : (event.direction == 4) ? -1 : 0 delta_y = (event.direction == 2) ? 1 : (event.direction == 8) ? -1 : 0 case event.direction - when 2 # Down + when 2 # Down real_distance = player.y - event.y - 1 - when 4 # Left + when 4 # Left real_distance = event.x - player.x - 1 - when 6 # Right + when 6 # Right real_distance = player.x - event.x - event.width - when 8 # Up + when 8 # Up real_distance = event.y - event.height - player.y end if real_distance > 0 @@ -392,21 +403,19 @@ def pbFacingEachOther(event1, event2) return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1) end - - #=============================================================================== # Audio playing #=============================================================================== -def pbCueBGM(bgm,seconds,volume=nil,pitch=nil) +def pbCueBGM(bgm, seconds, volume = nil, pitch = nil) return if !bgm - bgm = pbResolveAudioFile(bgm,volume,pitch) + bgm = pbResolveAudioFile(bgm, volume, pitch) playingBGM = $game_system.playing_bgm - if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch + if !playingBGM || playingBGM.name != bgm.name || playingBGM.pitch != bgm.pitch pbBGMFade(seconds) if !$PokemonTemp.cueFrames - $PokemonTemp.cueFrames = (seconds*Graphics.frame_rate)*3/5 + $PokemonTemp.cueFrames = (seconds * Graphics.frame_rate) * 3 / 5 end - $PokemonTemp.cueBGM=bgm + $PokemonTemp.cueBGM = bgm elsif playingBGM pbBGMPlay(bgm) end @@ -430,86 +439,82 @@ def pbAutoplayOnSave end end - - #=============================================================================== # Event movement #=============================================================================== module PBMoveRoute - Down = 1 - Left = 2 - Right = 3 - Up = 4 - LowerLeft = 5 - LowerRight = 6 - UpperLeft = 7 - UpperRight = 8 - Random = 9 - TowardPlayer = 10 - AwayFromPlayer = 11 - Forward = 12 - Backward = 13 - Jump = 14 # xoffset, yoffset - Wait = 15 # frames - TurnDown = 16 - TurnLeft = 17 - TurnRight = 18 - TurnUp = 19 - TurnRight90 = 20 - TurnLeft90 = 21 - Turn180 = 22 - TurnRightOrLeft90 = 23 - TurnRandom = 24 - TurnTowardPlayer = 25 + Down = 1 + Left = 2 + Right = 3 + Up = 4 + LowerLeft = 5 + LowerRight = 6 + UpperLeft = 7 + UpperRight = 8 + Random = 9 + TowardPlayer = 10 + AwayFromPlayer = 11 + Forward = 12 + Backward = 13 + Jump = 14 # xoffset, yoffset + Wait = 15 # frames + TurnDown = 16 + TurnLeft = 17 + TurnRight = 18 + TurnUp = 19 + TurnRight90 = 20 + TurnLeft90 = 21 + Turn180 = 22 + TurnRightOrLeft90 = 23 + TurnRandom = 24 + TurnTowardPlayer = 25 TurnAwayFromPlayer = 26 - SwitchOn = 27 # 1 param - SwitchOff = 28 # 1 param - ChangeSpeed = 29 # 1 param - ChangeFreq = 30 # 1 param - WalkAnimeOn = 31 - WalkAnimeOff = 32 - StepAnimeOn = 33 - StepAnimeOff = 34 - DirectionFixOn = 35 - DirectionFixOff = 36 - ThroughOn = 37 - ThroughOff = 38 - AlwaysOnTopOn = 39 - AlwaysOnTopOff = 40 - Graphic = 41 # Name, hue, direction, pattern - Opacity = 42 # 1 param - Blending = 43 # 1 param - PlaySE = 44 # 1 param - Script = 45 # 1 param - ScriptAsync = 101 # 1 param + SwitchOn = 27 # 1 param + SwitchOff = 28 # 1 param + ChangeSpeed = 29 # 1 param + ChangeFreq = 30 # 1 param + WalkAnimeOn = 31 + WalkAnimeOff = 32 + StepAnimeOn = 33 + StepAnimeOff = 34 + DirectionFixOn = 35 + DirectionFixOff = 36 + ThroughOn = 37 + ThroughOff = 38 + AlwaysOnTopOn = 39 + AlwaysOnTopOff = 40 + Graphic = 41 # Name, hue, direction, pattern + Opacity = 42 # 1 param + Blending = 43 # 1 param + PlaySE = 44 # 1 param + Script = 45 # 1 param + ScriptAsync = 101 # 1 param end - - -def pbMoveRoute(event,commands,waitComplete=false) +def pbMoveRoute(event, commands, waitComplete = false) route = RPG::MoveRoute.new - route.repeat = false + route.repeat = false route.skippable = true route.list.clear route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn)) - i=0 - while i1) ? item.name_plural : item.name + return false if !item || quantity < 1 + itemname = (quantity > 1) ? item.name_plural : item.name pocket = item.pocket move = item.move - if $PokemonBag.pbStoreItem(item,quantity) # If item can be picked up + if $PokemonBag.pbStoreItem(item, quantity) # If item can be picked up meName = (item.is_key_item?) ? "Key item get" : "Item get" if item == :LEFTOVERS - pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) - elsif item.is_machine? # TM or HM - pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name)) - elsif quantity>1 - pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname)) + pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname)) + elsif item.is_machine? # TM or HM + pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name)) + elsif quantity > 1 + pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname)) elsif itemname.starts_with_vowel? - pbMessage(_INTL("\\me[{1}]You found an \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) + pbMessage(_INTL("\\me[{1}]You found an \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname)) else - pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) + pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname)) end pbMessage(_INTL("You put the {1} away\\nin the \\c[1]{3} Pocket\\c[0].", - itemname,pocket,PokemonBag.pocketNames()[pocket])) + itemname, pocket, PokemonBag.pocketNames()[pocket])) return true end # Can't add the item if item == :LEFTOVERS - pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname)) - elsif item.is_machine? # TM or HM - pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,GameData::Move.get(move).name)) - elsif quantity>1 - pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname)) + pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]", itemname)) + elsif item.is_machine? # TM or HM + pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]", itemname, GameData::Move.get(move).name)) + elsif quantity > 1 + pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]", quantity, itemname)) elsif itemname.starts_with_vowel? - pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname)) + pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]", itemname)) else - pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname)) + pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]", itemname)) end pbMessage(_INTL("But your Bag is full...")) return false end - - #=============================================================================== # Being given an item #=============================================================================== -def pbReceiveItem(item,quantity=1,item_name="",music=nil) +def pbReceiveItem(item, quantity = 1, item_name = "", music = nil) #item_name -> pour donner un autre nom à l'item. Pas encore réimplémenté et surtout là pour éviter que ça plante quand des events essaient de le faire item = GameData::Item.get(item) - return false if !item || quantity<1 - itemname = (quantity>1) ? item.name_plural : item.name + return false if !item || quantity < 1 + itemname = (quantity > 1) ? item.name_plural : item.name pocket = item.pocket move = item.move meName = (item.is_key_item?) ? "Key item get" : "Item get" if item == :LEFTOVERS - pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) - elsif item.is_machine? # TM or HM - pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name)) - elsif quantity>1 - pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname)) + pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname)) + elsif item.is_machine? # TM or HM + pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name)) + elsif quantity > 1 + pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname)) elsif itemname.starts_with_vowel? - pbMessage(_INTL("\\me[{1}]You obtained an \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) + pbMessage(_INTL("\\me[{1}]You obtained an \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname)) else - pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) + pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname)) end - if $PokemonBag.pbStoreItem(item,quantity) # If item can be added + if $PokemonBag.pbStoreItem(item, quantity) # If item can be added pbMessage(_INTL("You put the {1} away\\nin the \\c[1]{3} Pocket\\c[0].", - itemname,pocket,PokemonBag.pocketNames()[pocket])) + itemname, pocket, PokemonBag.pocketNames()[pocket])) return true end - return false # Can't add the item + return false # Can't add the item end diff --git a/Data/Scripts/013_Items/002_Item_Effects.rb b/Data/Scripts/013_Items/002_Item_Effects.rb index 004c79c12..5f4aef2ed 100644 --- a/Data/Scripts/013_Items/002_Item_Effects.rb +++ b/Data/Scripts/013_Items/002_Item_Effects.rb @@ -1,11 +1,11 @@ #=============================================================================== # UseText handlers #=============================================================================== -ItemHandlers::UseText.add(:BICYCLE,proc { |item| +ItemHandlers::UseText.add(:BICYCLE, proc { |item| next ($PokemonGlobal.bicycle) ? _INTL("Walk") : _INTL("Use") }) -ItemHandlers::UseText.copy(:BICYCLE,:RACEBIKE) +ItemHandlers::UseText.copy(:BICYCLE, :RACEBIKE) #=============================================================================== # UseFromBag handlers @@ -18,42 +18,42 @@ ItemHandlers::UseText.copy(:BICYCLE,:RACEBIKE) # a Pokémon and not a TM/HM), calls the UseInField handler for it instead. #=============================================================================== -ItemHandlers::UseFromBag.add(:HONEY,proc { |item| +ItemHandlers::UseFromBag.add(:HONEY, proc { |item| next 4 }) -ItemHandlers::UseFromBag.add(:ESCAPEROPE,proc { |item| +ItemHandlers::UseFromBag.add(:ESCAPEROPE, proc { |item| if $game_player.pbHasDependentEvents? pbMessage(_INTL("It can't be used when you have someone with you.")) next 0 end - if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0 - next 4 # End screen and consume item + if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length > 0 + next 4 # End screen and consume item end pbMessage(_INTL("Can't use that here.")) next 0 }) -ItemHandlers::UseFromBag.add(:BICYCLE,proc { |item| +ItemHandlers::UseFromBag.add(:BICYCLE, proc { |item| next (pbBikeCheck) ? 2 : 0 }) -ItemHandlers::UseFromBag.copy(:BICYCLE,:RACEBIKE) +ItemHandlers::UseFromBag.copy(:BICYCLE, :RACEBIKE) -ItemHandlers::UseFromBag.add(:OLDROD,proc { |item| - notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player) +ItemHandlers::UseFromBag.add(:OLDROD, proc { |item| + notCliff = $game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player) next 2 if $game_player.pbFacingTerrainTag.can_fish && ($PokemonGlobal.surfing || notCliff) pbMessage(_INTL("Can't use that here.")) next 0 }) -ItemHandlers::UseFromBag.copy(:OLDROD,:GOODROD,:SUPERROD) +ItemHandlers::UseFromBag.copy(:OLDROD, :GOODROD, :SUPERROD) -ItemHandlers::UseFromBag.add(:ITEMFINDER,proc { |item| +ItemHandlers::UseFromBag.add(:ITEMFINDER, proc { |item| next 2 }) -ItemHandlers::UseFromBag.copy(:ITEMFINDER,:DOWSINGMCHN,:DOWSINGMACHINE) +ItemHandlers::UseFromBag.copy(:ITEMFINDER, :DOWSINGMCHN, :DOWSINGMACHINE) #=============================================================================== # ConfirmUseInField handlers @@ -62,9 +62,9 @@ ItemHandlers::UseFromBag.copy(:ITEMFINDER,:DOWSINGMCHN,:DOWSINGMACHINE) # If an item does not have this handler, it is treated as returning true. #=============================================================================== -ItemHandlers::ConfirmUseInField.add(:ESCAPEROPE,proc { |item| +ItemHandlers::ConfirmUseInField.add(:ESCAPEROPE, proc { |item| escape = ($PokemonGlobal.escapePoint rescue nil) - if !escape || escape==[] + if !escape || escape == [] pbMessage(_INTL("Can't use that here.")) next false end @@ -73,7 +73,7 @@ ItemHandlers::ConfirmUseInField.add(:ESCAPEROPE,proc { |item| next false end mapname = pbGetMapNameFromId(escape[0]) - next pbConfirmMessage(_INTL("Want to escape from here and return to {1}?",mapname)) + next pbConfirmMessage(_INTL("Want to escape from here and return to {1}?", mapname)) }) #=============================================================================== @@ -86,9 +86,10 @@ ItemHandlers::ConfirmUseInField.add(:ESCAPEROPE,proc { |item| # If an item has this handler, it can be registered to the Ready Menu. #=============================================================================== -def pbRepel(item,steps) - if $PokemonGlobal.repel>0 - pbMessage(_INTL("But a repellent's effect still lingers from earlier.")) +def pbRepel(item, steps) + message = $game_switches[USED_AN_INCENSE_SWITCH] ? "But an incense's effect still lingers from earlier." : "But a repellent's effect still lingers from earlier." + if $PokemonGlobal.repel > 0 + pbMessage(_INTL(message)) return 0 end pbUseItemMessage(item) @@ -96,35 +97,56 @@ def pbRepel(item,steps) return 3 end -ItemHandlers::UseInField.add(:REPEL,proc { |item| - next pbRepel(item,100) +def pbIncense(item, steps) + if $PokemonGlobal.repel > 0 + pbMessage(_INTL("But a repellent's effect still lingers from earlier.")) + return 0 + elsif $PokemonGlobal.incense > 0 + pbMessage(_INTL("But an incense's effect still lingers from earlier.")) + return 0 + end + pbUseItemMessage(item) + $PokemonGlobal.incense = steps + return 3 +end + +ItemHandlers::UseInField.add(:FUSIONREPEL, proc { |item| + $game_switches[FORCE_ALL_WILD_FUSIONS_SWITCH] = true + $game_switches[USED_AN_INCENSE_SWITCH] = true + next pbIncense(item, 50) }) -ItemHandlers::UseInField.add(:SUPERREPEL,proc { |item| - next pbRepel(item,200) +ItemHandlers::UseInField.add(:REPEL, proc { |item| + next pbRepel(item, 100) }) -ItemHandlers::UseInField.add(:MAXREPEL,proc { |item| - next pbRepel(item,250) +ItemHandlers::UseInField.add(:SUPERREPEL, proc { |item| + next pbRepel(item, 200) +}) + +ItemHandlers::UseInField.add(:MAXREPEL, proc { |item| + next pbRepel(item, 250) }) Events.onStepTaken += proc { - if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice + if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice $PokemonGlobal.repel -= 1 if $PokemonGlobal.repel <= 0 + $game_switches[FORCE_ALL_WILD_FUSIONS_SWITCH] = false + $game_switches[USED_AN_INCENSE_SWITCH] = false if $PokemonBag.pbHasItem?(:REPEL) || - $PokemonBag.pbHasItem?(:SUPERREPEL) || - $PokemonBag.pbHasItem?(:MAXREPEL) + $PokemonBag.pbHasItem?(:SUPERREPEL) || + $PokemonBag.pbHasItem?(:MAXREPEL) if pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?")) ret = nil pbFadeOutIn { scene = PokemonBag_Scene.new - screen = PokemonBagScreen.new(scene,$PokemonBag) + screen = PokemonBagScreen.new(scene, $PokemonBag) ret = screen.pbChooseItemScreen(Proc.new { |item| - [:REPEL, :SUPERREPEL, :MAXREPEL].include?(item) + [:REPEL, :SUPERREPEL, :MAXREPEL, :FUSIONREPEL].include?(item) }) } - pbUseItem($PokemonBag,ret) if ret + pbUseItem($PokemonBag, ret) if ret end else pbMessage(_INTL("The repellent's effect wore off!")) @@ -133,7 +155,7 @@ Events.onStepTaken += proc { end } -ItemHandlers::UseInField.add(:BLACKFLUTE,proc { |item| +ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item| pbUseItemMessage(item) pbMessage(_INTL("Wild Pokémon will be repelled.")) $PokemonMap.blackFluteUsed = true @@ -141,7 +163,7 @@ ItemHandlers::UseInField.add(:BLACKFLUTE,proc { |item| next 1 }) -ItemHandlers::UseInField.add(:WHITEFLUTE,proc { |item| +ItemHandlers::UseInField.add(:WHITEFLUTE, proc { |item| pbUseItemMessage(item) pbMessage(_INTL("Wild Pokémon will be lured.")) $PokemonMap.blackFluteUsed = false @@ -149,15 +171,15 @@ ItemHandlers::UseInField.add(:WHITEFLUTE,proc { |item| next 1 }) -ItemHandlers::UseInField.add(:HONEY,proc { |item| +ItemHandlers::UseInField.add(:HONEY, proc { |item| pbUseItemMessage(item) pbSweetScent next 3 }) -ItemHandlers::UseInField.add(:ESCAPEROPE,proc { |item| +ItemHandlers::UseInField.add(:ESCAPEROPE, proc { |item| escape = ($PokemonGlobal.escapePoint rescue nil) - if !escape || escape==[] + if !escape || escape == [] pbMessage(_INTL("Can't use that here.")) next 0 end @@ -167,9 +189,9 @@ ItemHandlers::UseInField.add(:ESCAPEROPE,proc { |item| end pbUseItemMessage(item) pbFadeOutIn { - $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_map_id = escape[0] + $game_temp.player_new_x = escape[1] + $game_temp.player_new_y = escape[2] $game_temp.player_new_direction = escape[3] pbCancelVehicles $scene.transfer_player @@ -180,7 +202,7 @@ ItemHandlers::UseInField.add(:ESCAPEROPE,proc { |item| next 3 }) -ItemHandlers::UseInField.add(:SACREDASH,proc { |item| +ItemHandlers::UseInField.add(:SACREDASH, proc { |item| if $Trainer.pokemon_count == 0 pbMessage(_INTL("There is no Pokémon.")) next 0 @@ -197,25 +219,25 @@ ItemHandlers::UseInField.add(:SACREDASH,proc { |item| revived = 0 pbFadeOutIn { scene = PokemonParty_Scene.new - screen = PokemonPartyScreen.new(scene,$Trainer.party) - screen.pbStartScene(_INTL("Using item..."),false) + screen = PokemonPartyScreen.new(scene, $Trainer.party) + screen.pbStartScene(_INTL("Using item..."), false) for i in 0...$Trainer.party.length if $Trainer.party[i].fainted? revived += 1 $Trainer.party[i].heal screen.pbRefreshSingle(i) - screen.pbDisplay(_INTL("{1}'s HP was restored.",$Trainer.party[i].name)) + screen.pbDisplay(_INTL("{1}'s HP was restored.", $Trainer.party[i].name)) end end - if revived==0 + if revived == 0 screen.pbDisplay(_INTL("It won't have any effect.")) end screen.pbEndScene } - next (revived==0) ? 0 : 3 + next (revived == 0) ? 0 : 3 }) -ItemHandlers::UseInField.add(:BICYCLE,proc { |item| +ItemHandlers::UseInField.add(:BICYCLE, proc { |item| if pbBikeCheck if $PokemonGlobal.bicycle pbDismountBike @@ -227,102 +249,107 @@ ItemHandlers::UseInField.add(:BICYCLE,proc { |item| next 0 }) -ItemHandlers::UseInField.copy(:BICYCLE,:RACEBIKE) +ItemHandlers::UseInField.copy(:BICYCLE, :RACEBIKE) -ItemHandlers::UseInField.add(:OLDROD,proc { |item| - notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player) +ItemHandlers::UseInField.add(:OLDROD, proc { |item| + notCliff = $game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player) if !$game_player.pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff) pbMessage(_INTL("Can't use that here.")) next 0 end encounter = $PokemonEncounters.has_encounter_type?(:OldRod) - if pbFishing(encounter,1) + if pbFishing(encounter, 1) pbEncounter(:OldRod) end next 1 }) -ItemHandlers::UseInField.add(:GOODROD,proc { |item| - notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player) +ItemHandlers::UseInField.add(:GOODROD, proc { |item| + notCliff = $game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player) if !$game_player.pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff) pbMessage(_INTL("Can't use that here.")) next 0 end encounter = $PokemonEncounters.has_encounter_type?(:GoodRod) - if pbFishing(encounter,2) + if pbFishing(encounter, 2) pbEncounter(:GoodRod) end next 1 }) -ItemHandlers::UseInField.add(:SUPERROD,proc { |item| - notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player) +ItemHandlers::UseInField.add(:SUPERROD, proc { |item| + notCliff = $game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player) if !$game_player.pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff) pbMessage(_INTL("Can't use that here.")) next 0 end encounter = $PokemonEncounters.has_encounter_type?(:SuperRod) - if pbFishing(encounter,3) + if pbFishing(encounter, 3) pbEncounter(:SuperRod) end next 1 }) -ItemHandlers::UseInField.add(:ITEMFINDER,proc { |item| +ItemHandlers::UseInField.add(:ITEMFINDER, proc { |item| event = pbClosestHiddenItem if !event pbMessage(_INTL("... \\wt[10]... \\wt[10]... \\wt[10]...\\wt[10]Nope! There's no response.")) else - offsetX = event.x-$game_player.x - offsetY = event.y-$game_player.y - if offsetX==0 && offsetY==0 # Standing on the item, spin around + offsetX = event.x - $game_player.x + offsetY = event.y - $game_player.y + if offsetX == 0 && offsetY == 0 # Standing on the item, spin around 4.times do - pbWait(Graphics.frame_rate*2/10) + pbWait(Graphics.frame_rate * 2 / 10) $game_player.turn_right_90 end - pbWait(Graphics.frame_rate*3/10) - pbMessage(_INTL("The {1}'s indicating something right underfoot!",GameData::Item.get(item).name)) - else # Item is nearby, face towards it + pbWait(Graphics.frame_rate * 3 / 10) + pbMessage(_INTL("The {1}'s indicating something right underfoot!", GameData::Item.get(item).name)) + else + # Item is nearby, face towards it direction = $game_player.direction - if offsetX.abs>offsetY.abs - direction = (offsetX<0) ? 4 : 6 + if offsetX.abs > offsetY.abs + direction = (offsetX < 0) ? 4 : 6 else - direction = (offsetY<0) ? 8 : 2 + direction = (offsetY < 0) ? 8 : 2 end case direction - when 2 then $game_player.turn_down - when 4 then $game_player.turn_left - when 6 then $game_player.turn_right - when 8 then $game_player.turn_up + when 2 then + $game_player.turn_down + when 4 then + $game_player.turn_left + when 6 then + $game_player.turn_right + when 8 then + $game_player.turn_up end - pbWait(Graphics.frame_rate*3/10) - pbMessage(_INTL("Huh? The {1}'s responding!\1",GameData::Item.get(item).name)) + pbWait(Graphics.frame_rate * 3 / 10) + pbMessage(_INTL("Huh? The {1}'s responding!\1", GameData::Item.get(item).name)) pbMessage(_INTL("There's an item buried around here!")) end end next 1 }) -ItemHandlers::UseInField.copy(:ITEMFINDER,:DOWSINGMCHN,:DOWSINGMACHINE) +ItemHandlers::UseInField.copy(:ITEMFINDER, :DOWSINGMCHN, :DOWSINGMACHINE) -ItemHandlers::UseInField.add(:TOWNMAP,proc { |item| - pbShowMap(-1,false) +ItemHandlers::UseInField.add(:TOWNMAP, proc { |item| + pbShowMap(-1, false) next 1 }) -ItemHandlers::UseInField.add(:COINCASE,proc { |item| +ItemHandlers::UseInField.add(:COINCASE, proc { |item| pbMessage(_INTL("Coins: {1}", $Trainer.coins.to_s_formatted)) next 1 }) -ItemHandlers::UseInField.add(:EXPALL,proc { |item| - $PokemonBag.pbChangeItem(:EXPALL,:EXPALLOFF) +ItemHandlers::UseInField.add(:EXPALL, proc { |item| + $PokemonBag.pbChangeItem(:EXPALL, :EXPALLOFF) pbMessage(_INTL("The Exp Share was turned off.")) next 1 }) -ItemHandlers::UseInField.add(:EXPALLOFF,proc { |item| - $PokemonBag.pbChangeItem(:EXPALLOFF,:EXPALL) +ItemHandlers::UseInField.add(:EXPALLOFF, proc { |item| + $PokemonBag.pbChangeItem(:EXPALLOFF, :EXPALL) pbMessage(_INTL("The Exp Share was turned on.")) next 1 }) @@ -334,184 +361,184 @@ ItemHandlers::UseInField.add(:EXPALLOFF,proc { |item| # Applies to all items defined as an evolution stone. # No need to add more code for new ones. ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_evolution_stone? }, - proc { |item,pkmn,scene| - if pkmn.shadowPokemon? - scene.pbDisplay(_INTL("It won't have any effect.")) - next false - end - newspecies = pkmn.check_evolution_on_use_item(item) - if newspecies - pbFadeOutInWithMusic { - evo = PokemonEvolutionScene.new - evo.pbStartScreen(pkmn,newspecies) - evo.pbEvolution(false) - evo.pbEndScreen - if scene.is_a?(PokemonPartyScreen) - scene.pbRefreshAnnotations(proc { |p| !p.check_evolution_on_use_item(item).nil? }) - scene.pbRefresh - end - } - next true - end - scene.pbDisplay(_INTL("It won't have any effect.")) - next false - } + proc { |item, pkmn, scene| + if pkmn.shadowPokemon? + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + newspecies = pkmn.check_evolution_on_use_item(item) + if newspecies + pbFadeOutInWithMusic { + evo = PokemonEvolutionScene.new + evo.pbStartScreen(pkmn, newspecies) + evo.pbEvolution(false) + evo.pbEndScreen + if scene.is_a?(PokemonPartyScreen) + scene.pbRefreshAnnotations(proc { |p| !p.check_evolution_on_use_item(item).nil? }) + scene.pbRefresh + end + } + next true + end + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + } ) -ItemHandlers::UseOnPokemon.add(:POTION,proc { |item,pkmn,scene| - next pbHPItem(pkmn,20,scene) +ItemHandlers::UseOnPokemon.add(:POTION, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 20, scene) }) -ItemHandlers::UseOnPokemon.copy(:POTION,:BERRYJUICE,:SWEETHEART) -ItemHandlers::UseOnPokemon.copy(:POTION,:RAGECANDYBAR) if !Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS +ItemHandlers::UseOnPokemon.copy(:POTION, :BERRYJUICE, :SWEETHEART) +ItemHandlers::UseOnPokemon.copy(:POTION, :RAGECANDYBAR) if !Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS -ItemHandlers::UseOnPokemon.add(:SUPERPOTION,proc { |item,pkmn,scene| - next pbHPItem(pkmn,50,scene) +ItemHandlers::UseOnPokemon.add(:SUPERPOTION, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 50, scene) }) -ItemHandlers::UseOnPokemon.add(:HYPERPOTION,proc { |item,pkmn,scene| - next pbHPItem(pkmn,200,scene) +ItemHandlers::UseOnPokemon.add(:HYPERPOTION, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 200, scene) }) -ItemHandlers::UseOnPokemon.add(:MAXPOTION,proc { |item,pkmn,scene| - next pbHPItem(pkmn,pkmn.totalhp-pkmn.hp,scene) +ItemHandlers::UseOnPokemon.add(:MAXPOTION, proc { |item, pkmn, scene| + next pbHPItem(pkmn, pkmn.totalhp - pkmn.hp, scene) }) -ItemHandlers::UseOnPokemon.add(:FRESHWATER,proc { |item,pkmn,scene| - next pbHPItem(pkmn,50,scene) +ItemHandlers::UseOnPokemon.add(:FRESHWATER, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 50, scene) }) -ItemHandlers::UseOnPokemon.add(:SODAPOP,proc { |item,pkmn,scene| - next pbHPItem(pkmn,60,scene) +ItemHandlers::UseOnPokemon.add(:SODAPOP, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 60, scene) }) -ItemHandlers::UseOnPokemon.add(:LEMONADE,proc { |item,pkmn,scene| - next pbHPItem(pkmn,80,scene) +ItemHandlers::UseOnPokemon.add(:LEMONADE, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 80, scene) }) -ItemHandlers::UseOnPokemon.add(:MOOMOOMILK,proc { |item,pkmn,scene| - next pbHPItem(pkmn,100,scene) +ItemHandlers::UseOnPokemon.add(:MOOMOOMILK, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 100, scene) }) -ItemHandlers::UseOnPokemon.add(:ORANBERRY,proc { |item,pkmn,scene| - next pbHPItem(pkmn,10,scene) +ItemHandlers::UseOnPokemon.add(:ORANBERRY, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 10, scene) }) -ItemHandlers::UseOnPokemon.add(:SITRUSBERRY,proc { |item,pkmn,scene| - next pbHPItem(pkmn,pkmn.totalhp/4,scene) +ItemHandlers::UseOnPokemon.add(:SITRUSBERRY, proc { |item, pkmn, scene| + next pbHPItem(pkmn, pkmn.totalhp / 4, scene) }) -ItemHandlers::UseOnPokemon.add(:AWAKENING,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:AWAKENING, proc { |item, pkmn, scene| if pkmn.fainted? || pkmn.status != :SLEEP scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1} woke up.",pkmn.name)) + scene.pbDisplay(_INTL("{1} woke up.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.copy(:AWAKENING,:CHESTOBERRY,:BLUEFLUTE,:POKEFLUTE) +ItemHandlers::UseOnPokemon.copy(:AWAKENING, :CHESTOBERRY, :BLUEFLUTE, :POKEFLUTE) -ItemHandlers::UseOnPokemon.add(:ANTIDOTE,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:ANTIDOTE, proc { |item, pkmn, scene| if pkmn.fainted? || pkmn.status != :POISON scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1} was cured of its poisoning.",pkmn.name)) + scene.pbDisplay(_INTL("{1} was cured of its poisoning.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.copy(:ANTIDOTE,:PECHABERRY) +ItemHandlers::UseOnPokemon.copy(:ANTIDOTE, :PECHABERRY) -ItemHandlers::UseOnPokemon.add(:BURNHEAL,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:BURNHEAL, proc { |item, pkmn, scene| if pkmn.fainted? || pkmn.status != :BURN scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s burn was healed.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s burn was healed.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.copy(:BURNHEAL,:RAWSTBERRY) +ItemHandlers::UseOnPokemon.copy(:BURNHEAL, :RAWSTBERRY) -ItemHandlers::UseOnPokemon.add(:PARALYZEHEAL,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:PARALYZEHEAL, proc { |item, pkmn, scene| if pkmn.fainted? || pkmn.status != :PARALYSIS scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1} was cured of paralysis.",pkmn.name)) + scene.pbDisplay(_INTL("{1} was cured of paralysis.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.copy(:PARALYZEHEAL,:PARLYZHEAL,:CHERIBERRY) +ItemHandlers::UseOnPokemon.copy(:PARALYZEHEAL, :PARLYZHEAL, :CHERIBERRY) -ItemHandlers::UseOnPokemon.add(:ICEHEAL,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:ICEHEAL, proc { |item, pkmn, scene| if pkmn.fainted? || pkmn.status != :FROZEN scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1} was thawed out.",pkmn.name)) + scene.pbDisplay(_INTL("{1} was thawed out.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.copy(:ICEHEAL,:ASPEARBERRY) +ItemHandlers::UseOnPokemon.copy(:ICEHEAL, :ASPEARBERRY) -ItemHandlers::UseOnPokemon.add(:FULLHEAL,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:FULLHEAL, proc { |item, pkmn, scene| if pkmn.fainted? || pkmn.status == :NONE scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1} became healthy.",pkmn.name)) + scene.pbDisplay(_INTL("{1} became healthy.", pkmn.name)) next true }) ItemHandlers::UseOnPokemon.copy(:FULLHEAL, - :LAVACOOKIE,:OLDGATEAU,:CASTELIACONE,:LUMIOSEGALETTE,:SHALOURSABLE, - :BIGMALASADA,:LUMBERRY) -ItemHandlers::UseOnPokemon.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS + :LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE, :SHALOURSABLE, + :BIGMALASADA, :LUMBERRY) +ItemHandlers::UseOnPokemon.copy(:FULLHEAL, :RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS -ItemHandlers::UseOnPokemon.add(:FULLRESTORE,proc { |item,pkmn,scene| - if pkmn.fainted? || (pkmn.hp==pkmn.totalhp && pkmn.status == :NONE) +ItemHandlers::UseOnPokemon.add(:FULLRESTORE, proc { |item, pkmn, scene| + if pkmn.fainted? || (pkmn.hp == pkmn.totalhp && pkmn.status == :NONE) scene.pbDisplay(_INTL("It won't have any effect.")) next false end - hpgain = pbItemRestoreHP(pkmn,pkmn.totalhp-pkmn.hp) + hpgain = pbItemRestoreHP(pkmn, pkmn.totalhp - pkmn.hp) pkmn.heal_status scene.pbRefresh - if hpgain>0 - scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",pkmn.name,hpgain)) + if hpgain > 0 + scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.", pkmn.name, hpgain)) else - scene.pbDisplay(_INTL("{1} became healthy.",pkmn.name)) + scene.pbDisplay(_INTL("{1} became healthy.", pkmn.name)) end next true }) -ItemHandlers::UseOnPokemon.add(:REVIVE,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:REVIVE, proc { |item, pkmn, scene| if !pkmn.fainted? scene.pbDisplay(_INTL("It won't have any effect.")) next false end - pkmn.hp = (pkmn.totalhp/2).floor - pkmn.hp = 1 if pkmn.hp<=0 + pkmn.hp = (pkmn.totalhp / 2).floor + pkmn.hp = 1 if pkmn.hp <= 0 pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s HP was restored.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.add(:MAXREVIVE,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:MAXREVIVE, proc { |item, pkmn, scene| if !pkmn.fainted? scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -519,27 +546,27 @@ ItemHandlers::UseOnPokemon.add(:MAXREVIVE,proc { |item,pkmn,scene| pkmn.heal_HP pkmn.heal_status scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s HP was restored.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.add(:ENERGYPOWDER,proc { |item,pkmn,scene| - if pbHPItem(pkmn,50,scene) +ItemHandlers::UseOnPokemon.add(:ENERGYPOWDER, proc { |item, pkmn, scene| + if pbHPItem(pkmn, 50, scene) pkmn.changeHappiness("powder") next true end next false }) -ItemHandlers::UseOnPokemon.add(:ENERGYROOT,proc { |item,pkmn,scene| - if pbHPItem(pkmn,200,scene) +ItemHandlers::UseOnPokemon.add(:ENERGYROOT, proc { |item, pkmn, scene| + if pbHPItem(pkmn, 200, scene) pkmn.changeHappiness("energyroot") next true end next false }) -ItemHandlers::UseOnPokemon.add(:HEALPOWDER,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:HEALPOWDER, proc { |item, pkmn, scene| if pkmn.fainted? || pkmn.status == :NONE scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -547,11 +574,11 @@ ItemHandlers::UseOnPokemon.add(:HEALPOWDER,proc { |item,pkmn,scene| pkmn.heal_status pkmn.changeHappiness("powder") scene.pbRefresh - scene.pbDisplay(_INTL("{1} became healthy.",pkmn.name)) + scene.pbDisplay(_INTL("{1} became healthy.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.add(:REVIVALHERB,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:REVIVALHERB, proc { |item, pkmn, scene| if !pkmn.fainted? scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -560,14 +587,14 @@ ItemHandlers::UseOnPokemon.add(:REVIVALHERB,proc { |item,pkmn,scene| pkmn.heal_status pkmn.changeHappiness("revivalherb") scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s HP was restored.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name)) next true }) -ItemHandlers::UseOnPokemon.add(:ETHER,proc { |item,pkmn,scene| - move = scene.pbChooseMove(pkmn,_INTL("Restore which move?")) - next false if move<0 - if pbRestorePP(pkmn,move,10)==0 +ItemHandlers::UseOnPokemon.add(:ETHER, proc { |item, pkmn, scene| + move = scene.pbChooseMove(pkmn, _INTL("Restore which move?")) + next false if move < 0 + if pbRestorePP(pkmn, move, 10) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -575,12 +602,12 @@ ItemHandlers::UseOnPokemon.add(:ETHER,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.copy(:ETHER,:LEPPABERRY) +ItemHandlers::UseOnPokemon.copy(:ETHER, :LEPPABERRY) -ItemHandlers::UseOnPokemon.add(:MAXETHER,proc { |item,pkmn,scene| - move = scene.pbChooseMove(pkmn,_INTL("Restore which move?")) - next false if move<0 - if pbRestorePP(pkmn,move,pkmn.moves[move].total_pp-pkmn.moves[move].pp)==0 +ItemHandlers::UseOnPokemon.add(:MAXETHER, proc { |item, pkmn, scene| + move = scene.pbChooseMove(pkmn, _INTL("Restore which move?")) + next false if move < 0 + if pbRestorePP(pkmn, move, pkmn.moves[move].total_pp - pkmn.moves[move].pp) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -588,12 +615,12 @@ ItemHandlers::UseOnPokemon.add(:MAXETHER,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:ELIXIR,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:ELIXIR, proc { |item, pkmn, scene| pprestored = 0 for i in 0...pkmn.moves.length - pprestored += pbRestorePP(pkmn,i,10) + pprestored += pbRestorePP(pkmn, i, 10) end - if pprestored==0 + if pprestored == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -601,12 +628,12 @@ ItemHandlers::UseOnPokemon.add(:ELIXIR,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:MAXELIXIR,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:MAXELIXIR, proc { |item, pkmn, scene| pprestored = 0 for i in 0...pkmn.moves.length - pprestored += pbRestorePP(pkmn,i,pkmn.moves[i].total_pp-pkmn.moves[i].pp) + pprestored += pbRestorePP(pkmn, i, pkmn.moves[i].total_pp - pkmn.moves[i].pp) end - if pprestored==0 + if pprestored == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -614,219 +641,219 @@ ItemHandlers::UseOnPokemon.add(:MAXELIXIR,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:PPUP,proc { |item,pkmn,scene| - move = scene.pbChooseMove(pkmn,_INTL("Boost PP of which move?")) - if move>=0 - if pkmn.moves[move].total_pp<=1 || pkmn.moves[move].ppup>=3 +ItemHandlers::UseOnPokemon.add(:PPUP, proc { |item, pkmn, scene| + move = scene.pbChooseMove(pkmn, _INTL("Boost PP of which move?")) + if move >= 0 + if pkmn.moves[move].total_pp <= 1 || pkmn.moves[move].ppup >= 3 scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.moves[move].ppup += 1 movename = pkmn.moves[move].name - scene.pbDisplay(_INTL("{1}'s PP increased.",movename)) + scene.pbDisplay(_INTL("{1}'s PP increased.", movename)) next true end next false }) -ItemHandlers::UseOnPokemon.add(:PPMAX,proc { |item,pkmn,scene| - move = scene.pbChooseMove(pkmn,_INTL("Boost PP of which move?")) - if move>=0 - if pkmn.moves[move].total_pp<=1 || pkmn.moves[move].ppup>=3 +ItemHandlers::UseOnPokemon.add(:PPMAX, proc { |item, pkmn, scene| + move = scene.pbChooseMove(pkmn, _INTL("Boost PP of which move?")) + if move >= 0 + if pkmn.moves[move].total_pp <= 1 || pkmn.moves[move].ppup >= 3 scene.pbDisplay(_INTL("It won't have any effect.")) next false end pkmn.moves[move].ppup = 3 movename = pkmn.moves[move].name - scene.pbDisplay(_INTL("{1}'s PP increased.",movename)) + scene.pbDisplay(_INTL("{1}'s PP increased.", movename)) next true end next false }) -ItemHandlers::UseOnPokemon.add(:HPUP,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:HP)==0 +ItemHandlers::UseOnPokemon.add(:HPUP, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :HP) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s HP increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s HP increased.", pkmn.name)) pkmn.changeHappiness("vitamin") next true }) -ItemHandlers::UseOnPokemon.add(:PROTEIN,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:ATTACK)==0 +ItemHandlers::UseOnPokemon.add(:PROTEIN, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :ATTACK) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Attack increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Attack increased.", pkmn.name)) pkmn.changeHappiness("vitamin") next true }) -ItemHandlers::UseOnPokemon.add(:IRON,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:DEFENSE)==0 +ItemHandlers::UseOnPokemon.add(:IRON, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :DEFENSE) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Defense increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Defense increased.", pkmn.name)) pkmn.changeHappiness("vitamin") next true }) -ItemHandlers::UseOnPokemon.add(:CALCIUM,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:SPECIAL_ATTACK)==0 +ItemHandlers::UseOnPokemon.add(:CALCIUM, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :SPECIAL_ATTACK) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Special Attack increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Special Attack increased.", pkmn.name)) pkmn.changeHappiness("vitamin") next true }) -ItemHandlers::UseOnPokemon.add(:ZINC,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:SPECIAL_DEFENSE)==0 +ItemHandlers::UseOnPokemon.add(:ZINC, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :SPECIAL_DEFENSE) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Special Defense increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Special Defense increased.", pkmn.name)) pkmn.changeHappiness("vitamin") next true }) -ItemHandlers::UseOnPokemon.add(:CARBOS,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:SPEED)==0 +ItemHandlers::UseOnPokemon.add(:CARBOS, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :SPEED) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Speed increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Speed increased.", pkmn.name)) pkmn.changeHappiness("vitamin") next true }) -ItemHandlers::UseOnPokemon.add(:HEALTHWING,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:HP,1,false)==0 +ItemHandlers::UseOnPokemon.add(:HEALTHWING, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :HP, 1, false) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s HP increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s HP increased.", pkmn.name)) pkmn.changeHappiness("wing") next true }) -ItemHandlers::UseOnPokemon.add(:MUSCLEWING,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:ATTACK,1,false)==0 +ItemHandlers::UseOnPokemon.add(:MUSCLEWING, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :ATTACK, 1, false) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Attack increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Attack increased.", pkmn.name)) pkmn.changeHappiness("wing") next true }) -ItemHandlers::UseOnPokemon.add(:RESISTWING,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:DEFENSE,1,false)==0 +ItemHandlers::UseOnPokemon.add(:RESISTWING, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :DEFENSE, 1, false) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Defense increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Defense increased.", pkmn.name)) pkmn.changeHappiness("wing") next true }) -ItemHandlers::UseOnPokemon.add(:GENIUSWING,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:SPECIAL_ATTACK,1,false)==0 +ItemHandlers::UseOnPokemon.add(:GENIUSWING, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :SPECIAL_ATTACK, 1, false) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Special Attack increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Special Attack increased.", pkmn.name)) pkmn.changeHappiness("wing") next true }) -ItemHandlers::UseOnPokemon.add(:CLEVERWING,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:SPECIAL_DEFENSE,1,false)==0 +ItemHandlers::UseOnPokemon.add(:CLEVERWING, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :SPECIAL_DEFENSE, 1, false) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Special Defense increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Special Defense increased.", pkmn.name)) pkmn.changeHappiness("wing") next true }) -ItemHandlers::UseOnPokemon.add(:SWIFTWING,proc { |item,pkmn,scene| - if pbRaiseEffortValues(pkmn,:SPEED,1,false)==0 +ItemHandlers::UseOnPokemon.add(:SWIFTWING, proc { |item, pkmn, scene| + if pbRaiseEffortValues(pkmn, :SPEED, 1, false) == 0 scene.pbDisplay(_INTL("It won't have any effect.")) next false end - scene.pbDisplay(_INTL("{1}'s Speed increased.",pkmn.name)) + scene.pbDisplay(_INTL("{1}'s Speed increased.", pkmn.name)) pkmn.changeHappiness("wing") next true }) -ItemHandlers::UseOnPokemon.add(:RARECANDY,proc { |item,pkmn,scene| - if pkmn.level>=GameData::GrowthRate.max_level || pkmn.shadowPokemon? +ItemHandlers::UseOnPokemon.add(:RARECANDY, proc { |item, pkmn, scene| + if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon? scene.pbDisplay(_INTL("It won't have any effect.")) next false end - pbChangeLevel(pkmn,pkmn.level+1,scene) + pbChangeLevel(pkmn, pkmn.level + 1, scene) scene.pbHardRefresh next true }) -ItemHandlers::UseOnPokemon.add(:POMEGBERRY,proc { |item,pkmn,scene| - next pbRaiseHappinessAndLowerEV(pkmn,scene,:HP,[ - _INTL("{1} adores you! Its base HP fell!",pkmn.name), - _INTL("{1} became more friendly. Its base HP can't go lower.",pkmn.name), - _INTL("{1} became more friendly. However, its base HP fell!",pkmn.name) +ItemHandlers::UseOnPokemon.add(:POMEGBERRY, proc { |item, pkmn, scene| + next pbRaiseHappinessAndLowerEV(pkmn, scene, :HP, [ + _INTL("{1} adores you! Its base HP fell!", pkmn.name), + _INTL("{1} became more friendly. Its base HP can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base HP fell!", pkmn.name) ]) }) -ItemHandlers::UseOnPokemon.add(:KELPSYBERRY,proc { |item,pkmn,scene| - next pbRaiseHappinessAndLowerEV(pkmn,scene,:ATTACK,[ - _INTL("{1} adores you! Its base Attack fell!",pkmn.name), - _INTL("{1} became more friendly. Its base Attack can't go lower.",pkmn.name), - _INTL("{1} became more friendly. However, its base Attack fell!",pkmn.name) +ItemHandlers::UseOnPokemon.add(:KELPSYBERRY, proc { |item, pkmn, scene| + next pbRaiseHappinessAndLowerEV(pkmn, scene, :ATTACK, [ + _INTL("{1} adores you! Its base Attack fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Attack can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Attack fell!", pkmn.name) ]) }) -ItemHandlers::UseOnPokemon.add(:QUALOTBERRY,proc { |item,pkmn,scene| - next pbRaiseHappinessAndLowerEV(pkmn,scene,:DEFENSE,[ - _INTL("{1} adores you! Its base Defense fell!",pkmn.name), - _INTL("{1} became more friendly. Its base Defense can't go lower.",pkmn.name), - _INTL("{1} became more friendly. However, its base Defense fell!",pkmn.name) +ItemHandlers::UseOnPokemon.add(:QUALOTBERRY, proc { |item, pkmn, scene| + next pbRaiseHappinessAndLowerEV(pkmn, scene, :DEFENSE, [ + _INTL("{1} adores you! Its base Defense fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Defense can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Defense fell!", pkmn.name) ]) }) -ItemHandlers::UseOnPokemon.add(:HONDEWBERRY,proc { |item,pkmn,scene| - next pbRaiseHappinessAndLowerEV(pkmn,scene,:SPECIAL_ATTACK,[ - _INTL("{1} adores you! Its base Special Attack fell!",pkmn.name), - _INTL("{1} became more friendly. Its base Special Attack can't go lower.",pkmn.name), - _INTL("{1} became more friendly. However, its base Special Attack fell!",pkmn.name) +ItemHandlers::UseOnPokemon.add(:HONDEWBERRY, proc { |item, pkmn, scene| + next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_ATTACK, [ + _INTL("{1} adores you! Its base Special Attack fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Special Attack can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Special Attack fell!", pkmn.name) ]) }) -ItemHandlers::UseOnPokemon.add(:GREPABERRY,proc { |item,pkmn,scene| - next pbRaiseHappinessAndLowerEV(pkmn,scene,:SPECIAL_DEFENSE,[ - _INTL("{1} adores you! Its base Special Defense fell!",pkmn.name), - _INTL("{1} became more friendly. Its base Special Defense can't go lower.",pkmn.name), - _INTL("{1} became more friendly. However, its base Special Defense fell!",pkmn.name) +ItemHandlers::UseOnPokemon.add(:GREPABERRY, proc { |item, pkmn, scene| + next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_DEFENSE, [ + _INTL("{1} adores you! Its base Special Defense fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Special Defense can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Special Defense fell!", pkmn.name) ]) }) -ItemHandlers::UseOnPokemon.add(:TAMATOBERRY,proc { |item,pkmn,scene| - next pbRaiseHappinessAndLowerEV(pkmn,scene,:SPEED,[ - _INTL("{1} adores you! Its base Speed fell!",pkmn.name), - _INTL("{1} became more friendly. Its base Speed can't go lower.",pkmn.name), - _INTL("{1} became more friendly. However, its base Speed fell!",pkmn.name) +ItemHandlers::UseOnPokemon.add(:TAMATOBERRY, proc { |item, pkmn, scene| + next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPEED, [ + _INTL("{1} adores you! Its base Speed fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Speed can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Speed fell!", pkmn.name) ]) }) -ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:GRACIDEA, proc { |item, pkmn, scene| if !pkmn.isSpecies?(:SHAYMIN) || pkmn.form != 0 || - pkmn.status == :FROZEN || PBDayNight.isNight? + pkmn.status == :FROZEN || PBDayNight.isNight? scene.pbDisplay(_INTL("It had no effect.")) next false end @@ -836,13 +863,13 @@ ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene| end pkmn.setForm(1) { scene.pbRefresh - scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:REDNECTAR,proc { |item,pkmn,scene| - if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==0 +ItemHandlers::UseOnPokemon.add(:REDNECTAR, proc { |item, pkmn, scene| + if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 0 scene.pbDisplay(_INTL("It had no effect.")) next false end @@ -851,13 +878,13 @@ ItemHandlers::UseOnPokemon.add(:REDNECTAR,proc { |item,pkmn,scene| end pkmn.setForm(0) { scene.pbRefresh - scene.pbDisplay(_INTL("{1} changed form!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed form!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR,proc { |item,pkmn,scene| - if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==1 +ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR, proc { |item, pkmn, scene| + if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 1 scene.pbDisplay(_INTL("It had no effect.")) next false end @@ -866,13 +893,13 @@ ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR,proc { |item,pkmn,scene| end pkmn.setForm(1) { scene.pbRefresh - scene.pbDisplay(_INTL("{1} changed form!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed form!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:PINKNECTAR,proc { |item,pkmn,scene| - if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==2 +ItemHandlers::UseOnPokemon.add(:PINKNECTAR, proc { |item, pkmn, scene| + if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 2 scene.pbDisplay(_INTL("It had no effect.")) next false end @@ -881,13 +908,13 @@ ItemHandlers::UseOnPokemon.add(:PINKNECTAR,proc { |item,pkmn,scene| end pkmn.setForm(2) { scene.pbRefresh - scene.pbDisplay(_INTL("{1} changed form!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed form!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:PURPLENECTAR,proc { |item,pkmn,scene| - if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==3 +ItemHandlers::UseOnPokemon.add(:PURPLENECTAR, proc { |item, pkmn, scene| + if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 3 scene.pbDisplay(_INTL("It had no effect.")) next false end @@ -896,15 +923,15 @@ ItemHandlers::UseOnPokemon.add(:PURPLENECTAR,proc { |item,pkmn,scene| end pkmn.setForm(3) { scene.pbRefresh - scene.pbDisplay(_INTL("{1} changed form!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed form!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:REVEALGLASS,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:REVEALGLASS, proc { |item, pkmn, scene| if !pkmn.isSpecies?(:TORNADUS) && - !pkmn.isSpecies?(:THUNDURUS) && - !pkmn.isSpecies?(:LANDORUS) + !pkmn.isSpecies?(:THUNDURUS) && + !pkmn.isSpecies?(:LANDORUS) scene.pbDisplay(_INTL("It had no effect.")) next false end @@ -912,15 +939,15 @@ ItemHandlers::UseOnPokemon.add(:REVEALGLASS,proc { |item,pkmn,scene| scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon.")) next false end - newForm = (pkmn.form==0) ? 1 : 0 + newForm = (pkmn.form == 0) ? 1 : 0 pkmn.setForm(newForm) { scene.pbRefresh - scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE, proc { |item, pkmn, scene| if !pkmn.isSpecies?(:HOOPA) scene.pbDisplay(_INTL("It had no effect.")) next false @@ -928,16 +955,15 @@ ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE,proc { |item,pkmn,scene| if pkmn.fainted? scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon.")) end - newForm = (pkmn.form==0) ? 1 : 0 + newForm = (pkmn.form == 0) ? 1 : 0 pkmn.setForm(newForm) { scene.pbRefresh - scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) } next true }) - -ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:NSOLARIZER, proc { |item, pkmn, scene| if !pkmn.isSpecies?(:NECROZMA) || pkmn.form == 2 scene.pbDisplay(_INTL("It had no effect.")) next false @@ -949,9 +975,9 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene| # Fusing if pkmn.fused.nil? chosen = scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?")) - next false if chosen<0 + next false if chosen < 0 poke2 = $Trainer.party[chosen] - if pkmn==poke2 + if pkmn == poke2 scene.pbDisplay(_INTL("It cannot be fused with itself.")) next false elsif poke2.egg? @@ -968,7 +994,7 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene| pkmn.fused = poke2 $Trainer.remove_pokemon_at_index(chosen) scene.pbHardRefresh - scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) } next true end @@ -981,12 +1007,12 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene| $Trainer.party[$Trainer.party.length] = pkmn.fused pkmn.fused = nil scene.pbHardRefresh - scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:NLUNARIZER, proc { |item, pkmn, scene| if !pkmn.isSpecies?(:NECROZMA) || pkmn.form == 1 scene.pbDisplay(_INTL("It had no effect.")) next false @@ -998,9 +1024,9 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene| # Fusing if pkmn.fused.nil? chosen = scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?")) - next false if chosen<0 + next false if chosen < 0 poke2 = $Trainer.party[chosen] - if pkmn==poke2 + if pkmn == poke2 scene.pbDisplay(_INTL("It cannot be fused with itself.")) next false elsif poke2.egg? @@ -1017,7 +1043,7 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene| pkmn.fused = poke2 $Trainer.remove_pokemon_at_index(chosen) scene.pbHardRefresh - scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) } next true end @@ -1030,29 +1056,29 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene| $Trainer.party[$Trainer.party.length] = pkmn.fused pkmn.fused = nil scene.pbHardRefresh - scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name)) + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) } next true }) -ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE, proc { |item, pkmn, scene| abils = pkmn.getAbilityList abil1 = nil; abil2 = nil for i in abils - abil1 = i[0] if i[1]==0 - abil2 = i[0] if i[1]==1 + abil1 = i[0] if i[1] == 0 + abil2 = i[0] if i[1] == 1 end if abil1.nil? || abil2.nil? || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE) scene.pbDisplay(_INTL("It won't have any effect.")) next false end newabil = (pkmn.ability_index + 1) % 2 - newabilname = GameData::Ability.get((newabil==0) ? abil1 : abil2).name + newabilname = GameData::Ability.get((newabil == 0) ? abil1 : abil2).name if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?", - pkmn.name,newabilname)) + pkmn.name, newabilname)) pkmn.ability_index = newabil scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pkmn.name,newabilname)) + scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!", pkmn.name, newabilname)) next true end next false diff --git a/Data/Scripts/049_Compatibility/Constants.rb b/Data/Scripts/049_Compatibility/Constants.rb index 4ade50dc2..f3be2ead5 100644 --- a/Data/Scripts/049_Compatibility/Constants.rb +++ b/Data/Scripts/049_Compatibility/Constants.rb @@ -55,4 +55,12 @@ SINGLE_POKEMON_MODE_HEAD_SWITCH=791 SINGLE_POKEMON_MODE_BODY_SWITCH=792 SINGLE_POKEMON_MODE_RANDOM_SWITCH=793 FISHING_AUTOHOOK_SWITCH = 916 -ODDKEYSTONE_NB_VARIABLE=252 \ No newline at end of file +ODDKEYSTONE_NB_VARIABLE=252 + +RANDOMIZED_WILD_POKEMON_SWITCH=953 +FUSED_WILD_POKEMON_SWITCH=35 +FORCE_FUSE_NEXT_POKEMON_SWITCH=37 +FORCE_ALL_WILD_FUSIONS_SWITCH=828 +USED_AN_INCENSE_SWITCH=798 + +WILD_FUSION_RATE_VAR=210 diff --git a/Data/Scripts/050_AddOns/Trainers Rebattle.rb b/Data/Scripts/050_AddOns/Trainers Rebattle.rb index e0a7e88c2..e52f7f9bc 100644 --- a/Data/Scripts/050_AddOns/Trainers Rebattle.rb +++ b/Data/Scripts/050_AddOns/Trainers Rebattle.rb @@ -208,7 +208,9 @@ def getEvolution(species, halfToEvolve=nil) end def getFusionSpecies(body, head) - id = body * Settings::NB_POKEMON + head + body_num = dexNum(body) + head_num = dexNum(head) + id = body_num * Settings::NB_POKEMON + head_num return GameData::Species.get(id).species end diff --git a/Data/System.rxdata b/Data/System.rxdata index fb8154463..c838fc3f8 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ