From 4749bd52015b2e8eca8f14c25185d60d41574115 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 5 Feb 2023 18:59:30 +0000 Subject: [PATCH] Fixed Bug Bite/Pluck and Fling not enabling Belch/triggering Symbiosis when a berry is consumed --- .../011_Battle/003_Move/011_MoveEffects_Items.rb | 15 +++++++++++---- .../001_Pokemon-related/001_FormHandlers.rb | 7 +++++-- Data/Scripts/016_UI/015_UI_Options.rb | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb b/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb index 4c02d025d..cf83b10ce 100644 --- a/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb +++ b/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb @@ -325,7 +325,7 @@ class Battle::Move::UserConsumeBerryRaiseDefense2 < Battle::Move::StatUpMove @battle.pbDisplay(_INTL("{1} ate its {2}!", user.pbThis, user.itemName)) item = user.item user.pbConsumeItem(true, false) # Don't trigger Symbiosis yet - user.pbHeldItemTriggerCheck(item, false) + user.pbHeldItemTriggerCheck(item.id, false) end end @@ -367,7 +367,7 @@ class Battle::Move::AllBattlersConsumeBerry < Battle::Move @battle.pbCommonAnimation("EatBerry", target) item = target.item target.pbConsumeItem(true, false) # Don't trigger Symbiosis yet - target.pbHeldItemTriggerCheck(item, false) + target.pbHeldItemTriggerCheck(item.id, false) end end @@ -382,9 +382,11 @@ class Battle::Move::UserConsumeTargetBerry < Battle::Move return if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker item = target.item itemName = target.itemName + user.setBelched target.pbRemoveItem @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!", user.pbThis, itemName)) - user.pbHeldItemTriggerCheck(item, false) + user.pbHeldItemTriggerCheck(item.id, false) + user.pbSymbiosis end end @@ -442,8 +444,13 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move when :KINGSROCK, :RAZORFANG target.pbFlinch(user) else - target.pbHeldItemTriggerCheck(user.item, true) + target.pbHeldItemTriggerCheck(user.item_id, true) end + # NOTE: The official games only let the target use Belch if the berry flung + # at it has some kind of effect (i.e. it isn't an effectless berry). I + # think this isn't in the spirit of "consuming a berry", so I've said + # that Belch is usable after having any kind of berry flung at you. + target.setBelched if user.item.is_berry? end def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb index 9078bbf50..316dacbf3 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb @@ -45,8 +45,8 @@ def drawSpot(bitmap, spotpattern, x, y, red, green, blue) spot = spotpattern[yy] width.times do |xx| next if spot[xx] != 1 - xOrg = (x + xx) << 1 - yOrg = (y + yy) << 1 + xOrg = (x + xx) * 2 + yOrg = (y + yy) * 2 color = bitmap.get_pixel(xOrg, yOrg) r = color.red + red g = color.green + green @@ -63,6 +63,7 @@ def drawSpot(bitmap, spotpattern, x, y, red, green, blue) end def pbSpindaSpots(pkmn, bitmap) + # NOTE: These spots are doubled in size when drawing them. spot1 = [ [0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0], @@ -123,6 +124,8 @@ def pbSpindaSpots(pkmn, bitmap) c = (id >> 8) & 15 b = (id >> 4) & 15 a = (id) & 15 + # NOTE: The coordinates below (b + 33, a + 25 and so on) are doubled when + # drawing the spot. if pkmn.shiny? drawSpot(bitmap, spot1, b + 33, a + 25, -75, -10, -150) drawSpot(bitmap, spot2, d + 21, c + 24, -75, -10, -150) diff --git a/Data/Scripts/016_UI/015_UI_Options.rb b/Data/Scripts/016_UI/015_UI_Options.rb index 8abc46c1b..7698e544a 100644 --- a/Data/Scripts/016_UI/015_UI_Options.rb +++ b/Data/Scripts/016_UI/015_UI_Options.rb @@ -195,14 +195,14 @@ class Window_PokemonOption < Window_DrawableCommand when EnumOption if @options[index].values.length > 1 totalwidth = 0 - @options[index].each_value do |value| + @options[index].values.each do |value| totalwidth += self.contents.text_size(value).width end spacing = (rect.width - rect.x - optionwidth - totalwidth) / (@options[index].values.length - 1) spacing = 0 if spacing < 0 xpos = optionwidth + rect.x ivalue = 0 - @options[index].each_value do |value| + @options[index].values.each do |value| pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value, (ivalue == self[index]) ? SEL_VALUE_BASE_COLOR : self.baseColor, (ivalue == self[index]) ? SEL_VALUE_SHADOW_COLOR : self.shadowColor)