Fixed Bug Bite/Pluck and Fling not enabling Belch/triggering Symbiosis when a berry is consumed

This commit is contained in:
Maruno17
2023-02-05 18:59:30 +00:00
parent c233841bb6
commit 4749bd5201
3 changed files with 18 additions and 8 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)