diff --git a/Data/Scripts/010_Data/002_PBS data/006_Item.rb b/Data/Scripts/010_Data/002_PBS data/006_Item.rb index 388142b1b..fe74d788c 100644 --- a/Data/Scripts/010_Data/002_PBS data/006_Item.rb +++ b/Data/Scripts/010_Data/002_PBS data/006_Item.rb @@ -9,6 +9,7 @@ module GameData attr_reader :real_description attr_reader :field_use attr_reader :battle_use + attr_reader :consumable attr_reader :type attr_reader :move @@ -23,11 +24,12 @@ module GameData "SellPrice" => [:sell_price, "u"], "Description" => [:description, "q"], "FieldUse" => [:field_use, "e", {"OnPokemon" => 1, "Direct" => 2, "TM" => 3, - "HM" => 4, "OnPokemonReusable" => 5, "TR" => 6}], + "HM" => 4, "OnPokemonReusable" => 1, "TR" => 6}], "BattleUse" => [:battle_use, "e", {"OnPokemon" => 1, "OnMove" => 2, "OnBattler" => 3, - "OnFoe" => 4, "Direct" => 5, "OnPokemonReusable" => 6, - "OnMoveReusable" => 7, "OnBattlerReusable" => 8, - "OnFoeReusable" => 9, "DirectReusable" => 10}], + "OnFoe" => 4, "Direct" => 5, "OnPokemonReusable" => 1, + "OnMoveReusable" => 2, "OnBattlerReusable" => 3, + "OnFoeReusable" => 4, "DirectReusable" => 5}], + "Consumable" => [:consumable, "b"], "Type" => [:type, "e", {"Mail" => 1, "IconMail" => 2, "SnagBall" => 3, "PokeBall" => 4, "Berry" => 5, "KeyItem" => 6, "EvolutionStone" => 7, "Fossil" => 8, "Apricorn" => 9, @@ -94,6 +96,8 @@ module GameData @field_use = hash[:field_use] || 0 @battle_use = hash[:battle_use] || 0 @type = hash[:type] || 0 + @consumable = hash[:consumable] + @consumable = !is_important? if @consumable.nil? @move = hash[:move] end @@ -136,6 +140,10 @@ module GameData def can_hold?; return !is_important?; end + def consumed_after_use? + return !is_important? && @consumable + end + def unlosable?(species, ability) return false if species == :ARCEUS && ability != :MULTITYPE return false if species == :SILVALLY && ability != :RKSSYSTEM diff --git a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb index f7f0c9a05..b52a13838 100644 --- a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb +++ b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb @@ -186,7 +186,7 @@ class PokeBattle_Move target.damageState.totalHPLost += damage return end - # Disguise takes the damage + # Disguise/Ice Face takes the damage return if target.damageState.disguise || target.damageState.iceFace # Target takes the damage if damage>=target.hp @@ -305,6 +305,7 @@ class PokeBattle_Move end @battle.pbHideAbilitySplash(target) target.pbChangeForm(1,_INTL("{1}'s disguise was busted!",target.pbThis)) + target.pbReduceHP(target.totalhp / 8, false) if Settings::MECHANICS_GENERATION >= 8 elsif target.damageState.iceFace @battle.pbShowAbilitySplash(target) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH diff --git a/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb b/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb index 89bf02e25..881a5ec3f 100644 --- a/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb +++ b/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb @@ -2617,9 +2617,9 @@ end # accuracy if the target is Minimized. (Double Iron Bash) #=============================================================================== class PokeBattle_Move_175 < PokeBattle_FlinchMove - def multiHitMove?; return true; end - def pbNumHits(user,targets); return 2; end - def tramplesMinimize?(param=1); return true; end + def multiHitMove?; return true; end + def pbNumHits(user,targets); return 2; end + def tramplesMinimize?(param=1); return Settings::MECHANICS_GENERATION <= 7; end end diff --git a/Data/Scripts/011_Battle/003_Battle/007_Battle_Action_UseItem.rb b/Data/Scripts/011_Battle/003_Battle/007_Battle_Action_UseItem.rb index 801583ea6..b723e4148 100644 --- a/Data/Scripts/011_Battle/003_Battle/007_Battle_Action_UseItem.rb +++ b/Data/Scripts/011_Battle/003_Battle/007_Battle_Action_UseItem.rb @@ -41,8 +41,7 @@ class PokeBattle_Battle #============================================================================= def pbConsumeItemInBag(item,idxBattler) return if !item - useType = GameData::Item.get(item).battle_use - return if useType==0 || (useType>=6 && useType<=10) # Not consumed upon use + return if !GameData::Item.get(item).consumed_after_use? if pbOwnedByPlayer?(idxBattler) if !$PokemonBag.pbDeleteItem(item) raise _INTL("Tried to consume item that wasn't in the Bag somehow.") @@ -60,8 +59,7 @@ class PokeBattle_Battle def pbReturnUnusedItemToBag(item,idxBattler) return if !item - useType = GameData::Item.get(item).battle_use - return if useType==0 || (useType>=6 && useType<=10) # Not consumed upon use + return if !GameData::Item.get(item).consumed_after_use? if pbOwnedByPlayer?(idxBattler) if $PokemonBag && $PokemonBag.pbCanStore?(item) $PokemonBag.pbStoreItem(item) diff --git a/Data/Scripts/011_Battle/003_Battle/010_Battle_Phase_Command.rb b/Data/Scripts/011_Battle/003_Battle/010_Battle_Phase_Command.rb index 8e0ee5fdc..2a0dae167 100644 --- a/Data/Scripts/011_Battle/003_Battle/010_Battle_Phase_Command.rb +++ b/Data/Scripts/011_Battle/003_Battle/010_Battle_Phase_Command.rb @@ -107,21 +107,21 @@ class PokeBattle_Battle next false if !item battler = pkmn = nil case useType - when 1, 2, 6, 7 # Use on Pokémon/Pokémon's move + when 1, 2 # Use on Pokémon/Pokémon's move next false if !ItemHandlers.hasBattleUseOnPokemon(item) battler = pbFindBattler(idxPkmn,idxBattler) pkmn = pbParty(idxBattler)[idxPkmn] next false if !pbCanUseItemOnPokemon?(item,pkmn,battler,itemScene) - when 3, 8 # Use on battler + when 3 # Use on battler next false if !ItemHandlers.hasBattleUseOnBattler(item) battler = pbFindBattler(idxPkmn,idxBattler) pkmn = battler.pokemon if battler next false if !pbCanUseItemOnPokemon?(item,pkmn,battler,itemScene) - when 4, 9 # Poké Balls + when 4 # Poké Balls next false if idxPkmn<0 battler = @battlers[idxPkmn] pkmn = battler.pokemon if battler - when 5, 10 # No target (Poké Doll, Guard Spec., Launcher items) + when 5 # No target (Poké Doll, Guard Spec., Launcher items) battler = @battlers[idxBattler] pkmn = battler.pokemon if battler else diff --git a/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb b/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb index 07bcaf913..01d9890f7 100644 --- a/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb +++ b/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb @@ -71,13 +71,13 @@ class PokeBattle_Battle item = @choices[b.index][1] next if !item case GameData::Item.get(item).battle_use - when 1, 2, 6, 7 # Use on Pokémon/Pokémon's move + when 1, 2 # Use on Pokémon/Pokémon's move pbUseItemOnPokemon(item, @choices[b.index][2], b) if @choices[b.index][2] >= 0 - when 3, 8 # Use on battler + when 3 # Use on battler pbUseItemOnBattler(item, @choices[b.index][2], b) - when 4, 9 # Use Poké Ball + when 4 # Use Poké Ball pbUsePokeBallInBattle(item, @choices[b.index][2], b) - when 5, 10 # Use directly + when 5 # Use directly pbUseItemInBattle(item, @choices[b.index][2], b) else next diff --git a/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb b/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb index a4a771aa4..7f687fa3f 100644 --- a/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb +++ b/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb @@ -8,7 +8,7 @@ class PokeBattle_AI return false if !item # Determine target of item (always the Pokémon choosing the action) useType = GameData::Item.get(item).battle_use - if [1, 2, 3, 6, 7, 8].include?(useType) # Use on Pokémon + if [1, 2, 3].include?(useType) # Use on Pokémon idxTarget = @battle.battlers[idxTarget].pokemonIndex # Party Pokémon end # Register use of item diff --git a/Data/Scripts/011_Battle/005_Battle scene/008_Scene_Commands.rb b/Data/Scripts/011_Battle/005_Battle scene/008_Scene_Commands.rb index 8dc913198..d93f92703 100644 --- a/Data/Scripts/011_Battle/005_Battle scene/008_Scene_Commands.rb +++ b/Data/Scripts/011_Battle/005_Battle scene/008_Scene_Commands.rb @@ -221,26 +221,21 @@ class PokeBattle_Scene next unless cmdUse>=0 && command==cmdUse # Use # Use types: # 0 = not usable in battle - # 1 = use on Pokémon (lots of items), consumed - # 2 = use on Pokémon's move (Ethers), consumed - # 3 = use on battler (X items, Persim Berry), consumed - # 4 = use on opposing battler (Poké Balls), consumed - # 5 = use no target (Poké Doll, Guard Spec., Launcher items), consumed - # 6 = use on Pokémon (Blue Flute), not consumed - # 7 = use on Pokémon's move, not consumed - # 8 = use on battler (Red/Yellow Flutes), not consumed - # 9 = use on opposing battler, not consumed - # 10 = use no target (Poké Flute), not consumed + # 1 = use on Pokémon (lots of items, Blue Flute) + # 2 = use on Pokémon's move (Ethers) + # 3 = use on battler (X items, Persim Berry, Red/Yellow Flutes) + # 4 = use on opposing battler (Poké Balls) + # 5 = use no target (Poké Doll, Guard Spec., Poké Flute, Launcher items) case useType - when 1, 2, 3, 6, 7, 8 # Use on Pokémon/Pokémon's move/battler + when 1, 2, 3 # Use on Pokémon/Pokémon's move/battler # Auto-choose the Pokémon/battler whose action is being decided if they # are the only available Pokémon/battler to use the item on case useType - when 1, 6 # Use on Pokémon + when 1 # Use on Pokémon if @battle.pbTeamLengthFromBattlerIndex(idxBattler)==1 break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene end - when 3, 8 # Use on battler + when 3 # Use on battler if @battle.pbPlayerBattlerCount==1 break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene end @@ -273,7 +268,7 @@ class PokeBattle_Scene pkmn = party[idxPartyRet] next if !pkmn || pkmn.egg? idxMove = -1 - if useType==2 || useType==7 # Use on Pokémon's move + if useType==2 # Use on Pokémon's move idxMove = pkmnScreen.pbChooseMove(pkmn,_INTL("Restore which move?")) next if idxMove<0 end @@ -283,7 +278,7 @@ class PokeBattle_Scene break if idxParty>=0 # Cancelled choosing a Pokémon; show the Bag screen again itemScene.pbFadeInScene - when 4, 9 # Use on opposing battler (Poké Balls) + when 4 # Use on opposing battler (Poké Balls) idxTarget = -1 if @battle.pbOpposingBattlerCount(idxBattler)==1 @battle.eachOtherSideBattler(idxBattler) { |b| idxTarget = b.index } @@ -305,7 +300,7 @@ class PokeBattle_Scene pbFadeOutAndHide(@sprites) itemScene.pbFadeInScene end - when 5, 10 # Use with no target + when 5 # Use with no target break if yield item.id, useType, idxBattler, -1, itemScene end end diff --git a/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb b/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb index 6d71e87f8..97b5a6081 100644 --- a/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb +++ b/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb @@ -141,29 +141,38 @@ end class LightEffect_Basic < LightEffect + def initialize(event, viewport = nil, map = nil, filename = nil) + super + @light.ox = @light.bitmap.width / 2 + @light.oy = @light.bitmap.height / 2 + @light.opacity = 100 + end + def update return if !@light || !@event super - @light.opacity = 100 - @light.ox = 32 - @light.oy = 48 if (Object.const_defined?(:ScreenPosHelper) rescue false) @light.x = ScreenPosHelper.pbScreenX(@event) - @light.y = ScreenPosHelper.pbScreenY(@event) + @light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2 @light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event) + @light.zoom_y = @light.zoom_x else - @light.x = @event.screen_x - @light.y = @event.screen_y - @light.zoom_x = 1.0 + @light.x = @event.screen_x + @light.y = @event.screen_y - Game_Map::TILE_HEIGHT / 2 end - @light.zoom_y = @light.zoom_x - @light.tone = $game_screen.tone + @light.tone = $game_screen.tone end end class LightEffect_DayNight < LightEffect + def initialize(event, viewport = nil, map = nil, filename = nil) + super + @light.ox = @light.bitmap.width / 2 + @light.oy = @light.bitmap.height / 2 + end + def update return if !@light || !@event super @@ -177,18 +186,14 @@ class LightEffect_DayNight < LightEffect end @light.opacity = 255-shade if @light.opacity>0 - @light.ox = 32 - @light.oy = 48 if (Object.const_defined?(:ScreenPosHelper) rescue false) @light.x = ScreenPosHelper.pbScreenX(@event) - @light.y = ScreenPosHelper.pbScreenY(@event) + @light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2 @light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event) @light.zoom_y = ScreenPosHelper.pbScreenZoomY(@event) else - @light.x = @event.screen_x - @light.y = @event.screen_y - @light.zoom_x = 1.0 - @light.zoom_y = 1.0 + @light.x = @event.screen_x + @light.y = @event.screen_y - Game_Map::TILE_HEIGHT / 2 end @light.tone.set($game_screen.tone.red, $game_screen.tone.green, diff --git a/Data/Scripts/013_Items/001_Item_Utilities.rb b/Data/Scripts/013_Items/001_Item_Utilities.rb index 909df7772..fbfca870b 100644 --- a/Data/Scripts/013_Items/001_Item_Utilities.rb +++ b/Data/Scripts/013_Items/001_Item_Utilities.rb @@ -49,12 +49,12 @@ module ItemHandlers # 0 - Item not used # 1 - Item used, don't end screen # 2 - Item used, end screen - # 3 - Item used, don't end screen, consume item - # 4 - Item used, end screen, consume item def self.triggerUseFromBag(item) return UseFromBag.trigger(item) if UseFromBag[item] # No UseFromBag handler exists; check the UseInField handler if present - return UseInField.trigger(item) if UseInField[item] + if UseInField[item] + return (UseInField.trigger(item)) ? 1 : 0 + end return 0 end @@ -68,10 +68,9 @@ module ItemHandlers # -1 - Item effect not found # 0 - Item not used # 1 - Item used - # 3 - Item used, consume item def self.triggerUseInField(item) return -1 if !UseInField[item] - return UseInField.trigger(item) + return (UseInField.trigger(item)) ? 1 : 0 end # Returns whether item was used @@ -561,11 +560,11 @@ def pbUseItem(bag,item,bagscene=nil) if !pbConfirmMessage(_INTL("Do you want to teach {1} to a Pokémon?",movename)) return 0 elsif pbMoveTutorChoose(machine,nil,true,itm.is_TR?) - bag.pbDeleteItem(item) if itm.is_TR? + bag.pbDeleteItem(item) if itm.consumed_after_use? return 1 end return 0 - elsif useType==1 || useType==5 # Item is usable on a Pokémon + elsif useType==1 # Item is usable on a Pokémon if $Trainer.pokemon_count == 0 pbMessage(_INTL("There is no Pokémon.")) return 0 @@ -593,7 +592,7 @@ def pbUseItem(bag,item,bagscene=nil) pkmn = $Trainer.party[chosen] if pbCheckUseOnPokemon(item,pkmn,screen) ret = ItemHandlers.triggerUseOnPokemon(item,pkmn,screen) - if ret && useType==1 # Usable on Pokémon, consumed + if ret && itm.consumed_after_use? bag.pbDeleteItem(item) if !bag.pbHasItem?(item) pbMessage(_INTL("You used your last {1}.",itm.name)) { screen.pbUpdate } @@ -608,16 +607,9 @@ def pbUseItem(bag,item,bagscene=nil) return (ret) ? 1 : 0 elsif useType==2 # Item is usable from Bag intret = ItemHandlers.triggerUseFromBag(item) - case intret - when 0 then return 0 - when 1 then return 1 # Item used - when 2 then return 2 # Item used, end screen - when 3 # Item used, consume item - bag.pbDeleteItem(item) - return 1 - when 4 # Item used, end screen and consume item - bag.pbDeleteItem(item) - return 2 + if intret >= 0 + bag.pbDeleteItem(item) if intret == 1 && itm.consumed_after_use? + return intret end pbMessage(_INTL("Can't use that here.")) return 0 @@ -643,7 +635,7 @@ def pbUseItemOnPokemon(item,pkmn,scene) pbMessage(_INTL("\\se[PC access]You booted up {1}.\1",itm.name)) { scene.pbUpdate } if pbConfirmMessage(_INTL("Do you want to teach {1} to {2}?",movename,pkmn.name)) { scene.pbUpdate } if pbLearnMove(pkmn,machine,false,true) { scene.pbUpdate } - $PokemonBag.pbDeleteItem(item) if itm.is_TR? + $PokemonBag.pbDeleteItem(item) if itm.consumed_after_use? return true end end @@ -654,8 +646,7 @@ def pbUseItemOnPokemon(item,pkmn,scene) ret = ItemHandlers.triggerUseOnPokemon(item,pkmn,scene) scene.pbClearAnnotations scene.pbHardRefresh - useType = itm.field_use - if ret && useType==1 # Usable on Pokémon, consumed + if ret && itm.consumed_after_use? $PokemonBag.pbDeleteItem(item) if !$PokemonBag.pbHasItem?(item) pbMessage(_INTL("You used your last {1}.",itm.name)) { scene.pbUpdate } @@ -668,10 +659,10 @@ def pbUseKeyItemInField(item) ret = ItemHandlers.triggerUseInField(item) if ret==-1 # Item effect not found pbMessage(_INTL("Can't use that here.")) - elsif ret==3 # Item was used and consumed + elsif ret > 0 && GameData::Item.get(item).consumed_after_use? $PokemonBag.pbDeleteItem(item) end - return ret!=-1 && ret!=0 + return ret > 0 end def pbUseItemMessage(item) diff --git a/Data/Scripts/013_Items/002_Item_Effects.rb b/Data/Scripts/013_Items/002_Item_Effects.rb index 2785adf99..c8d3eac29 100644 --- a/Data/Scripts/013_Items/002_Item_Effects.rb +++ b/Data/Scripts/013_Items/002_Item_Effects.rb @@ -10,16 +10,14 @@ ItemHandlers::UseText.copy(:BICYCLE,:MACHBIKE,:ACROBIKE) #=============================================================================== # UseFromBag handlers # Return values: 0 = not used -# 1 = used, item not consumed -# 2 = close the Bag to use, item not consumed -# 3 = used, item consumed -# 4 = close the Bag to use, item consumed +# 1 = used +# 2 = close the Bag to use # If there is no UseFromBag handler for an item being used from the Bag (not on # a Pokémon and not a TM/HM), calls the UseInField handler for it instead. #=============================================================================== ItemHandlers::UseFromBag.add(:HONEY,proc { |item| - next 4 + next 2 }) ItemHandlers::UseFromBag.add(:ESCAPEROPE,proc { |item| @@ -28,7 +26,7 @@ ItemHandlers::UseFromBag.add(:ESCAPEROPE,proc { |item| next 0 end if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0 - next (GameData::Item.get(item).is_key_item?) ? 2 : 4 # End screen and use item + next 2 # End screen and use item end pbMessage(_INTL("Can't use that here.")) next 0 @@ -78,9 +76,8 @@ ItemHandlers::ConfirmUseInField.add(:ESCAPEROPE,proc { |item| #=============================================================================== # UseInField handlers -# Return values: 0 = not used -# 1 = used, item not consumed -# 3 = used, item consumed +# Return values: false = not used +# true = used # Called if an item is used from the Bag (not on a Pokémon and not a TM/HM) and # there is no UseFromBag handler above. # If an item has this handler, it can be registered to the Ready Menu. @@ -89,11 +86,11 @@ ItemHandlers::ConfirmUseInField.add(:ESCAPEROPE,proc { |item| def pbRepel(item,steps) if $PokemonGlobal.repel>0 pbMessage(_INTL("But a repellent's effect still lingers from earlier.")) - return 0 + return false end pbUseItemMessage(item) $PokemonGlobal.repel = steps - return 3 + return true end ItemHandlers::UseInField.add(:REPEL,proc { |item| @@ -138,7 +135,7 @@ ItemHandlers::UseInField.add(:BLACKFLUTE,proc { |item| pbMessage(_INTL("Wild Pokémon will be repelled.")) $PokemonMap.blackFluteUsed = true $PokemonMap.whiteFluteUsed = false - next 1 + next true }) ItemHandlers::UseInField.add(:WHITEFLUTE,proc { |item| @@ -146,24 +143,24 @@ ItemHandlers::UseInField.add(:WHITEFLUTE,proc { |item| pbMessage(_INTL("Wild Pokémon will be lured.")) $PokemonMap.blackFluteUsed = false $PokemonMap.whiteFluteUsed = true - next 1 + next true }) ItemHandlers::UseInField.add(:HONEY,proc { |item| pbUseItemMessage(item) pbSweetScent - next 3 + next true }) ItemHandlers::UseInField.add(:ESCAPEROPE,proc { |item| escape = ($PokemonGlobal.escapePoint rescue nil) if !escape || escape==[] pbMessage(_INTL("Can't use that here.")) - next 0 + next false end if $game_player.pbHasDependentEvents? pbMessage(_INTL("It can't be used when you have someone with you.")) - next 0 + next false end pbUseItemMessage(item) pbFadeOutIn { @@ -177,13 +174,13 @@ ItemHandlers::UseInField.add(:ESCAPEROPE,proc { |item| $game_map.refresh } pbEraseEscapePoint - next (GameData::Item.get(item).is_key_item?) ? 1 : 3 + next true }) ItemHandlers::UseInField.add(:SACREDASH,proc { |item| if $Trainer.pokemon_count == 0 pbMessage(_INTL("There is no Pokémon.")) - next 0 + next false end canrevive = false for i in $Trainer.pokemon_party @@ -192,7 +189,7 @@ ItemHandlers::UseInField.add(:SACREDASH,proc { |item| end if !canrevive pbMessage(_INTL("It won't have any effect.")) - next 0 + next false end revived = 0 pbFadeOutIn { @@ -212,7 +209,7 @@ ItemHandlers::UseInField.add(:SACREDASH,proc { |item| end screen.pbEndScene } - next (revived==0) ? 0 : 3 + next (revived > 0) }) ItemHandlers::UseInField.add(:BICYCLE,proc { |item| @@ -222,9 +219,9 @@ ItemHandlers::UseInField.add(:BICYCLE,proc { |item| else pbMountBike end - next 1 + next true end - next 0 + next false }) ItemHandlers::UseInField.copy(:BICYCLE,:MACHBIKE,:ACROBIKE) @@ -233,39 +230,39 @@ 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 + next false end encounter = $PokemonEncounters.has_encounter_type?(:OldRod) if pbFishing(encounter,1) pbEncounter(:OldRod) end - next 1 + next true }) 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 + next false end encounter = $PokemonEncounters.has_encounter_type?(:GoodRod) if pbFishing(encounter,2) pbEncounter(:GoodRod) end - next 1 + next true }) 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 + next false end encounter = $PokemonEncounters.has_encounter_type?(:SuperRod) if pbFishing(encounter,3) pbEncounter(:SuperRod) end - next 1 + next true }) ItemHandlers::UseInField.add(:ITEMFINDER,proc { |item| @@ -300,31 +297,31 @@ ItemHandlers::UseInField.add(:ITEMFINDER,proc { |item| pbMessage(_INTL("There's an item buried around here!")) end end - next 1 + next true }) ItemHandlers::UseInField.copy(:ITEMFINDER,:DOWSINGMCHN,:DOWSINGMACHINE) ItemHandlers::UseInField.add(:TOWNMAP,proc { |item| pbShowMap(-1,false) - next 1 + next true }) ItemHandlers::UseInField.add(:COINCASE,proc { |item| pbMessage(_INTL("Coins: {1}", $Trainer.coins.to_s_formatted)) - next 1 + next true }) ItemHandlers::UseInField.add(:EXPALL,proc { |item| $PokemonBag.pbChangeItem(:EXPALL,:EXPALLOFF) pbMessage(_INTL("The Exp Share was turned off.")) - next 1 + next true }) ItemHandlers::UseInField.add(:EXPALLOFF,proc { |item| $PokemonBag.pbChangeItem(:EXPALLOFF,:EXPALL) pbMessage(_INTL("The Exp Share was turned on.")) - next 1 + next true }) #=============================================================================== diff --git a/Data/Scripts/013_Items/005_Item_PokeRadar.rb b/Data/Scripts/013_Items/005_Item_PokeRadar.rb index 236e55eb4..4f2d4c65d 100644 --- a/Data/Scripts/013_Items/005_Item_PokeRadar.rb +++ b/Data/Scripts/013_Items/005_Item_PokeRadar.rb @@ -238,7 +238,7 @@ Events.onMapChange += proc { |_sender,_e| # Item handlers ################################################################################ ItemHandlers::UseInField.add(:POKERADAR,proc { |item| - next (pbUsePokeRadar) ? 1 : 0 + next pbUsePokeRadar }) ItemHandlers::UseFromBag.add(:POKERADAR,proc { |item| diff --git a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb index 354c0a50d..09fa17670 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb @@ -800,9 +800,9 @@ end #=============================================================================== def pbItemEditor field_use_array = [_INTL("Can't use in field")] - GameData::Item::SCHEMA["FieldUse"][2].each { |key, value| field_use_array[value] = key } + GameData::Item::SCHEMA["FieldUse"][2].each { |key, value| field_use_array[value] = key if !field_use_array[value] } battle_use_array = [_INTL("Can't use in battle")] - GameData::Item::SCHEMA["BattleUse"][2].each { |key, value| battle_use_array[value] = key } + GameData::Item::SCHEMA["BattleUse"][2].each { |key, value| battle_use_array[value] = key if !battle_use_array[value] } type_array = [_INTL("No special type")] GameData::Item::SCHEMA["Type"][2].each { |key, value| type_array[value] = key } item_properties = [ @@ -815,6 +815,7 @@ def pbItemEditor [_INTL("Description"), StringProperty, _INTL("Description of this item")], [_INTL("FieldUse"), EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")], [_INTL("BattleUse"), EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")], + [_INTL("Consumable"), BooleanProperty, _INTL("Whether this item is consumed after use.")], [_INTL("Type"), EnumProperty.new(type_array), _INTL("For special kinds of items.")], [_INTL("Move"), MoveProperty, _INTL("Move taught by this HM, TM or TR.")] ] @@ -842,6 +843,7 @@ def pbItemEditor itm.real_description, itm.field_use, itm.battle_use, + itm.consumable, itm.type, itm.move ] @@ -857,8 +859,9 @@ def pbItemEditor :description => data[6], :field_use => data[7], :battle_use => data[8], - :type => data[9], - :move => data[10] + :consumable => data[9], + :type => data[10], + :move => data[11] } # Add item's data to records GameData::Item.register(item_hash) diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index 297c514af..b3217d79c 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -458,6 +458,9 @@ module Compiler if GameData::Item.exists?(item_id) raise _INTL("Item ID '{1}' is used twice.\r\n{2}", item_id, FileLineData.linereport) end + consumable = !([3, 4, 5].include?(line[7]) || line[8] >= 6) + line[7] = 1 if line[7] == 5 + line[8] -= 5 if line[8] > 5 # Construct item hash item_hash = { :id => item_id, @@ -468,6 +471,7 @@ module Compiler :description => line[6], :field_use => line[7], :battle_use => line[8], + :consumable => consumable, :type => line[9], :move => line[10] } diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index f58cbb6fd..104678d68 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -215,6 +215,7 @@ module Compiler battle_use = GameData::Item::SCHEMA["BattleUse"][2].key(item.battle_use) f.write(sprintf("BattleUse = %s\r\n", battle_use)) if battle_use type = GameData::Item::SCHEMA["Type"][2].key(item.type) + f.write(sprintf("Consumable = false\r\n")) if !item.is_important? && !item.consumable f.write(sprintf("Type = %s\r\n", type)) if type f.write(sprintf("Move = %s\r\n", item.move)) if item.move f.write(sprintf("Description = %s\r\n", item.real_description)) diff --git a/Data/Scripts/Gen 8 notes.txt b/Data/Scripts/Gen 8 notes.txt index 6a9aaacf2..dfbad9593 100644 --- a/Data/Scripts/Gen 8 notes.txt +++ b/Data/Scripts/Gen 8 notes.txt @@ -29,15 +29,14 @@ Some moves have changed properties/effects: than the order in which they were Quashed. - Parting Shot is able to make the user switch out if its effect is redirected by Mirror Armor. Throat Spray is triggered and applies before the switch. -- Double Iron Bash no longer has a different effect if the target is Minimized. Some abilities have changed effects: -- Intimidate now triggers Rattled. +- Intimidate now triggers Rattled. Rattled needs a new ability handler just for + triggering this way. - If another Pokémon faints before a Pokémon with Analytic makes its move, Analytic calculates whether it would have moved before or after the fainted Pokémon. In Gen 8, speed- and priority-modifying effects aren't considered, but in earlier Gens they are. -- Disguise now reduces the damage taken to 1/8, rather than to 0. Some items have changed properties/effects: - Zygarde Cube now changes a Zygarde's ability. diff --git a/PBS/Gen 5/items.txt b/PBS/Gen 5/items.txt index 3b044ce8f..842920e4e 100644 --- a/PBS/Gen 5/items.txt +++ b/PBS/Gen 5/items.txt @@ -30,6 +30,7 @@ NamePlural = Black Flutes Pocket = 1 Price = 400 FieldUse = Direct +Consumable = false Description = A black flute made from blown glass. Its melody makes wild Pokémon less likely to appear. #------------------------------- [WHITEFLUTE] @@ -38,6 +39,7 @@ NamePlural = White Flutes Pocket = 1 Price = 500 FieldUse = Direct +Consumable = false Description = A white flute made from blown glass. Its melody makes wild Pokémon more likely to appear. #------------------------------- [HONEY] @@ -3996,8 +3998,9 @@ Name = Blue Flute NamePlural = Blue Flutes Pocket = 7 Price = 100 -FieldUse = OnPokemonReusable -BattleUse = OnPokemonReusable +FieldUse = OnPokemon +BattleUse = OnPokemon +Consumable = false Description = A blue flute made from blown glass. Its melody awakens a single Pokémon from sleep. #------------------------------- [YELLOWFLUTE] @@ -4005,7 +4008,8 @@ Name = Yellow Flute NamePlural = Yellow Flutes Pocket = 7 Price = 300 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A yellow flute made from blown glass. Its melody snaps a single Pokémon out of confusion. #------------------------------- [REDFLUTE] @@ -4013,7 +4017,8 @@ Name = Red Flute NamePlural = Red Flutes Pocket = 7 Price = 200 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A red flute made from blown glass. Its melody snaps a single Pokémon out of infatuation. #------------------------------- [POKEDOLL] @@ -4117,8 +4122,8 @@ Name = Poké Flute NamePlural = Poké Flutes Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable -BattleUse = DirectReusable +FieldUse = OnPokemon +BattleUse = Direct Type = KeyItem Description = A flute that is said to instantly awaken any Pokémon. It has a lovely tone. #------------------------------- @@ -4184,7 +4189,7 @@ Name = Gracidea NamePlural = Gracideas Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A flower sometimes bundled in bouquets to convey gratitude on special occasions like birthdays. #------------------------------- @@ -4209,7 +4214,7 @@ Name = DNA Splicers NamePlural = DNA Splicers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A splicer that fuses Kyurem and a certain Pokémon. They are said to have been one in the beginning. #------------------------------- @@ -4218,7 +4223,7 @@ Name = Reveal Glass NamePlural = Reveal Glasses Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A glass that reveals the truth. It is a mysterious glass that returns a Pokémon back to its original shape. #------------------------------- diff --git a/PBS/Gen 7/items.txt b/PBS/Gen 7/items.txt index 35d0d82ce..88d3a70b6 100644 --- a/PBS/Gen 7/items.txt +++ b/PBS/Gen 7/items.txt @@ -30,6 +30,7 @@ NamePlural = Black Flutes Pocket = 1 Price = 400 FieldUse = Direct +Consumable = false Description = A black flute made from blown glass. Its melody makes wild Pokémon less likely to appear. #------------------------------- [WHITEFLUTE] @@ -38,6 +39,7 @@ NamePlural = White Flutes Pocket = 1 Price = 500 FieldUse = Direct +Consumable = false Description = A white flute made from blown glass. Its melody makes wild Pokémon more likely to appear. #------------------------------- [HONEY] @@ -4797,8 +4799,9 @@ Name = Blue Flute NamePlural = Blue Flutes Pocket = 7 Price = 100 -FieldUse = OnPokemonReusable -BattleUse = OnPokemonReusable +FieldUse = OnPokemon +BattleUse = OnPokemon +Consumable = false Description = A blue flute made from blown glass. Its melody awakens a single Pokémon from sleep. #------------------------------- [YELLOWFLUTE] @@ -4806,7 +4809,8 @@ Name = Yellow Flute NamePlural = Yellow Flutes Pocket = 7 Price = 300 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A yellow flute made from blown glass. Its melody snaps a single Pokémon out of confusion. #------------------------------- [REDFLUTE] @@ -4814,7 +4818,8 @@ Name = Red Flute NamePlural = Red Flutes Pocket = 7 Price = 200 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A red flute made from blown glass. Its melody snaps a single Pokémon out of infatuation. #------------------------------- [POKEDOLL] @@ -4918,8 +4923,8 @@ Name = Poké Flute NamePlural = Poké Flutes Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable -BattleUse = DirectReusable +FieldUse = OnPokemon +BattleUse = Direct Type = KeyItem Description = A flute that is said to instantly awaken any Pokémon. It has a lovely tone. #------------------------------- @@ -4993,7 +4998,7 @@ Name = Gracidea NamePlural = Gracideas Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A flower sometimes bundled in bouquets to convey gratitude on special occasions like birthdays. #------------------------------- @@ -5002,7 +5007,7 @@ Name = Reveal Glass NamePlural = Reveal Glasses Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A glass that reveals the truth. It is a mysterious glass that returns a Pokémon back to its original shape. #------------------------------- @@ -5011,7 +5016,7 @@ Name = Prison Bottle NamePlural = Prison Bottles Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A bottle believed to have been used to seal away the power of a certain Pokémon long, long ago. #------------------------------- @@ -5020,7 +5025,7 @@ Name = DNA Splicers NamePlural = DNA Splicers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A splicer that fuses Kyurem and a certain Pokémon. They are said to have been one in the beginning. #------------------------------- @@ -5029,7 +5034,7 @@ Name = N-Solarizer NamePlural = N-Solarizers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A machine to fuse Necrozma, which needs light, and Solgaleo. #------------------------------- @@ -5038,7 +5043,7 @@ Name = N-Lunarizer NamePlural = N-Lunarizers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A machine to fuse Necrozma, which needs light, and Lunala. #------------------------------- diff --git a/PBS/Gen 8/items.txt b/PBS/Gen 8/items.txt index d2e63a062..2625c5211 100644 --- a/PBS/Gen 8/items.txt +++ b/PBS/Gen 8/items.txt @@ -30,6 +30,7 @@ NamePlural = Black Flutes Pocket = 1 Price = 20 FieldUse = Direct +Consumable = false Description = A black flute made from blown glass. Its melody makes wild Pokémon less likely to appear. #------------------------------- [WHITEFLUTE] @@ -38,6 +39,7 @@ NamePlural = White Flutes Pocket = 1 Price = 20 FieldUse = Direct +Consumable = false Description = A white flute made from blown glass. Its melody makes wild Pokémon more likely to appear. #------------------------------- [HONEY] @@ -6155,8 +6157,9 @@ Name = Blue Flute NamePlural = Blue Flutes Pocket = 7 Price = 20 -FieldUse = OnPokemonReusable -BattleUse = OnPokemonReusable +FieldUse = OnPokemon +BattleUse = OnPokemon +Consumable = false Description = A blue flute made from blown glass. Its melody awakens a single Pokémon from sleep. #------------------------------- [YELLOWFLUTE] @@ -6164,7 +6167,8 @@ Name = Yellow Flute NamePlural = Yellow Flutes Pocket = 7 Price = 20 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A yellow flute made from blown glass. Its melody snaps a single Pokémon out of confusion. #------------------------------- [REDFLUTE] @@ -6172,7 +6176,8 @@ Name = Red Flute NamePlural = Red Flutes Pocket = 7 Price = 20 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A red flute made from blown glass. Its melody snaps a single Pokémon out of infatuation. #------------------------------- [POKEDOLL] @@ -6294,8 +6299,8 @@ Name = Poké Flute NamePlural = Poké Flutes Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable -BattleUse = DirectReusable +FieldUse = OnPokemon +BattleUse = Direct Type = KeyItem Description = A flute that is said to instantly awaken any Pokémon. It has a lovely tone. #------------------------------- @@ -6360,7 +6365,7 @@ Name = Gracidea NamePlural = Gracideas Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A flower sometimes bundled in bouquets to convey gratitude on special occasions like birthdays. #------------------------------- @@ -6369,7 +6374,7 @@ Name = Reveal Glass NamePlural = Reveal Glasses Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A glass that reveals the truth. It is a mysterious glass that returns a Pokémon back to its original shape. #------------------------------- @@ -6378,7 +6383,7 @@ Name = Prison Bottle NamePlural = Prison Bottles Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A bottle believed to have been used to seal away the power of a certain Pokémon long, long ago. #------------------------------- @@ -6396,7 +6401,7 @@ Name = DNA Splicers NamePlural = DNA Splicers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A splicer that fuses Kyurem and a certain Pokémon. They are said to have been one in the beginning. #------------------------------- @@ -6405,7 +6410,7 @@ Name = N-Solarizer NamePlural = N-Solarizers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A machine to fuse Necrozma, which needs light, and Solgaleo. #------------------------------- @@ -6414,7 +6419,7 @@ Name = N-Lunarizer NamePlural = N-Lunarizers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A machine to fuse Necrozma, which needs light, and Lunala. #------------------------------- diff --git a/PBS/items.txt b/PBS/items.txt index d2e63a062..2625c5211 100644 --- a/PBS/items.txt +++ b/PBS/items.txt @@ -30,6 +30,7 @@ NamePlural = Black Flutes Pocket = 1 Price = 20 FieldUse = Direct +Consumable = false Description = A black flute made from blown glass. Its melody makes wild Pokémon less likely to appear. #------------------------------- [WHITEFLUTE] @@ -38,6 +39,7 @@ NamePlural = White Flutes Pocket = 1 Price = 20 FieldUse = Direct +Consumable = false Description = A white flute made from blown glass. Its melody makes wild Pokémon more likely to appear. #------------------------------- [HONEY] @@ -6155,8 +6157,9 @@ Name = Blue Flute NamePlural = Blue Flutes Pocket = 7 Price = 20 -FieldUse = OnPokemonReusable -BattleUse = OnPokemonReusable +FieldUse = OnPokemon +BattleUse = OnPokemon +Consumable = false Description = A blue flute made from blown glass. Its melody awakens a single Pokémon from sleep. #------------------------------- [YELLOWFLUTE] @@ -6164,7 +6167,8 @@ Name = Yellow Flute NamePlural = Yellow Flutes Pocket = 7 Price = 20 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A yellow flute made from blown glass. Its melody snaps a single Pokémon out of confusion. #------------------------------- [REDFLUTE] @@ -6172,7 +6176,8 @@ Name = Red Flute NamePlural = Red Flutes Pocket = 7 Price = 20 -BattleUse = OnBattlerReusable +BattleUse = OnBattler +Consumable = false Description = A red flute made from blown glass. Its melody snaps a single Pokémon out of infatuation. #------------------------------- [POKEDOLL] @@ -6294,8 +6299,8 @@ Name = Poké Flute NamePlural = Poké Flutes Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable -BattleUse = DirectReusable +FieldUse = OnPokemon +BattleUse = Direct Type = KeyItem Description = A flute that is said to instantly awaken any Pokémon. It has a lovely tone. #------------------------------- @@ -6360,7 +6365,7 @@ Name = Gracidea NamePlural = Gracideas Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A flower sometimes bundled in bouquets to convey gratitude on special occasions like birthdays. #------------------------------- @@ -6369,7 +6374,7 @@ Name = Reveal Glass NamePlural = Reveal Glasses Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A glass that reveals the truth. It is a mysterious glass that returns a Pokémon back to its original shape. #------------------------------- @@ -6378,7 +6383,7 @@ Name = Prison Bottle NamePlural = Prison Bottles Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A bottle believed to have been used to seal away the power of a certain Pokémon long, long ago. #------------------------------- @@ -6396,7 +6401,7 @@ Name = DNA Splicers NamePlural = DNA Splicers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A splicer that fuses Kyurem and a certain Pokémon. They are said to have been one in the beginning. #------------------------------- @@ -6405,7 +6410,7 @@ Name = N-Solarizer NamePlural = N-Solarizers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A machine to fuse Necrozma, which needs light, and Solgaleo. #------------------------------- @@ -6414,7 +6419,7 @@ Name = N-Lunarizer NamePlural = N-Lunarizers Pocket = 8 Price = 0 -FieldUse = OnPokemonReusable +FieldUse = OnPokemon Type = KeyItem Description = A machine to fuse Necrozma, which needs light, and Lunala. #-------------------------------