Bug fixes: interacting with a follower in the same tile as the player; underline/strikethrough line mispositionings and added shadows to those lines; Toxic/Flame Orb replacing existing status problems; grown berry plants looking like sprouts; pbShowCommandsWithHelp not deactivating message windows it creates

This commit is contained in:
Maruno17
2022-10-02 14:59:59 +01:00
parent 1ccbafb499
commit 88dc215417
5 changed files with 64 additions and 60 deletions

View File

@@ -278,14 +278,8 @@ class Game_FollowerFactory
facing_tile = $map_factory.getFacingTile
# Assumes player is 1x1 tile in size
each_follower do |event, follower|
if event.at_coordinate?($game_player.x, $game_player.y) # Underneath player
next if !event.over_trigger?
elsif facing_tile && event.map.map_id == facing_tile[0] &&
event.at_coordinate?(facing_tile[1], facing_tile[2]) # On facing tile
next if event.over_trigger?
else # Somewhere else
next
end
next if !facing_tile || event.map.map_id != facing_tile[0] ||
!event.at_coordinate?(facing_tile[1], facing_tile[2]) # Not on facing tile
next if event.jumping?
follower.interact(event)
end

View File

@@ -935,58 +935,67 @@ def drawBitmapBuffer(chars)
end
def drawSingleFormattedChar(bitmap, ch)
if ch[5] # If a graphic
if ch[5] # If a graphic
graphic = Bitmap.new(ch[0])
graphicRect = ch[15]
bitmap.blt(ch[1], ch[2], graphic, graphicRect, ch[8].alpha)
graphic.dispose
return
end
bitmap.font.bold = ch[6] if bitmap.font.bold != ch[6]
bitmap.font.italic = ch[7] if bitmap.font.italic != ch[7]
bitmap.font.name = ch[12] if bitmap.font.name != ch[12]
bitmap.font.size = ch[13] if bitmap.font.size != ch[13]
if ch[9] # shadow
if ch[10] # underline
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2,
ch[3], 4, ch[9])
end
if ch[11] # strikeout
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3], 4, ch[9])
end
end
if ch[0] == "\n" || ch[0] == "\r" || ch[0] == " " || isWaitChar(ch[0])
bitmap.font.color = ch[8] if bitmap.font.color != ch[8]
else
bitmap.font.size = ch[13] if bitmap.font.size != ch[13]
if ch[0] != "\n" && ch[0] != "\r" && ch[0] != " " && !isWaitChar(ch[0])
bitmap.font.bold = ch[6] if bitmap.font.bold != ch[6]
bitmap.font.italic = ch[7] if bitmap.font.italic != ch[7]
bitmap.font.name = ch[12] if bitmap.font.name != ch[12]
offset = 0
if ch[9] # shadow
bitmap.font.color = ch[9]
if (ch[16] & 1) != 0 # outline
offset = 1
bitmap.draw_text(ch[1], ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 1, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 2, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 1, ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 1, ch[2] + 2, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 1, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 2, ch[3] + 2, ch[4], ch[0])
elsif (ch[16] & 2) != 0 # outline 2
offset = 2
bitmap.draw_text(ch[1], ch[2], ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 2, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 4, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2], ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 4, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 4, ch[2], ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 4, ch[2] + 2, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 4, ch[2] + 4, ch[3] + 4, ch[4], ch[0])
else
bitmap.draw_text(ch[1] + 2, ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 2, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 2, ch[3] + 2, ch[4], ch[0])
end
offset = 0
if ch[9] # shadow
bitmap.font.color = ch[9]
if (ch[16] & 1) != 0 # outline
offset = 1
bitmap.draw_text(ch[1], ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 1, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 2, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 1, ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 1, ch[2] + 2, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 1, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 2, ch[3] + 2, ch[4], ch[0])
elsif (ch[16] & 2) != 0 # outline 2
offset = 2
bitmap.draw_text(ch[1], ch[2], ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 2, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 4, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2], ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 4, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 4, ch[2], ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 4, ch[2] + 2, ch[3] + 4, ch[4], ch[0])
bitmap.draw_text(ch[1] + 4, ch[2] + 4, ch[3] + 4, ch[4], ch[0])
else
bitmap.draw_text(ch[1] + 2, ch[2], ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1], ch[2] + 2, ch[3] + 2, ch[4], ch[0])
bitmap.draw_text(ch[1] + 2, ch[2] + 2, ch[3] + 2, ch[4], ch[0])
end
bitmap.font.color = ch[8] if bitmap.font.color != ch[8]
bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0])
elsif bitmap.font.color != ch[8]
bitmap.font.color = ch[8]
end
if ch[10] # underline
bitmap.fill_rect(ch[1], ch[2] + ch[4] - 4 - [(ch[4] - bitmap.font.size) / 2, 0].max - 2,
ch[3] - 2, 2, ch[8])
end
if ch[11] # strikeout
bitmap.fill_rect(ch[1], ch[2] + (ch[4] / 2) - 4, ch[3] - 2, 2, ch[8])
end
bitmap.font.color = ch[8] if bitmap.font.color != ch[8]
bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0])
end
if ch[10] # underline
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2,
ch[3] - 2, 2, ch[8])
end
if ch[11] # strikeout
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3] - 2, 2, ch[8])
end
end

View File

@@ -819,7 +819,7 @@ def pbShowCommandsWithHelp(msgwindow, commands, help, cmdIfCancel = 0, defaultCm
Input.update
end
msgwin.letterbyletter = oldlbl
msgwin.dispose if !msgwindow
pbDisposeMessageWindow(msgwin) if !msgwindow
return ret
end

View File

@@ -24,7 +24,7 @@ class Battle::Battler
def pbCanInflictStatus?(newStatus, user, showMessages, move = nil, ignoreStatus = false)
return false if fainted?
selfInflicted = (user && user.index == @index)
self_inflicted = (user && user.index == @index) # Rest and Flame Orb/Toxic Orb only
# Already have that status problem
if self.status == newStatus && !ignoreStatus
if showMessages
@@ -41,13 +41,13 @@ class Battle::Battler
return false
end
# Trying to replace a status problem with another one
if self.status != :NONE && !ignoreStatus && !selfInflicted
if self.status != :NONE && !ignoreStatus && !(self_inflicted && move) # Rest can replace a status problem
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) if showMessages
return false
end
# Trying to inflict a status problem on a Pokémon behind a substitute
if @effects[PBEffects::Substitute] > 0 && !(move && move.ignoresSubstitute?(user)) &&
!selfInflicted
!self_inflicted
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) if showMessages
return false
end
@@ -105,7 +105,7 @@ class Battle::Battler
immAlly = nil
if Battle::AbilityEffects.triggerStatusImmunityNonIgnorable(self.ability, self, newStatus)
immuneByAbility = true
elsif selfInflicted || !@battle.moldBreaker
elsif self_inflicted || !@battle.moldBreaker
if abilityActive? && Battle::AbilityEffects.triggerStatusImmunity(self.ability, self, newStatus)
immuneByAbility = true
else
@@ -163,7 +163,7 @@ class Battle::Battler
return false
end
# Safeguard immunity
if pbOwnSide.effects[PBEffects::Safeguard] > 0 && !selfInflicted && move &&
if pbOwnSide.effects[PBEffects::Safeguard] > 0 && !self_inflicted && move &&
!(user && user.hasActiveAbility?(:INFILTRATOR))
@battle.pbDisplay(_INTL("{1}'s team is protected by Safeguard!", pbThis)) if showMessages
return false

View File

@@ -259,7 +259,8 @@ class BerryPlantSprite
when 2 then @event.turn_down # X sprouted
when 3 then @event.turn_left # X taller
when 4 then @event.turn_right # X flowering
when 5 then @event.turn_up # X berries
else
@event.turn_up if berry_plant.growth_stage >= 5 # X berries
end
else
@event.character_name = "Object ball"