Fixed play time carrying over to new games, fixed Eerie Spell thinking it's a status move, fixed text positionings in Pokédex and naming screen, fixed Channeler typo

This commit is contained in:
Maruno17
2022-08-07 14:21:30 +01:00
parent 757798c8a8
commit 3c748c9d68
11 changed files with 58 additions and 48 deletions

View File

@@ -20,6 +20,7 @@ module SaveData
@id = id
@loaded = false
@load_in_bootup = false
@reset_on_new_game = false
instance_eval(&block)
raise "No save_value defined for save value #{id.inspect}" if @save_proc.nil?
raise "No load_value defined for save value #{id.inspect}" if @load_proc.nil?
@@ -70,6 +71,14 @@ module SaveData
return @load_in_bootup
end
def reset_on_new_game
@reset_on_new_game = true
end
def reset_on_new_game?
return @reset_on_new_game
end
# @return [Boolean] whether the value has been loaded
def loaded?
return @loaded
@@ -171,7 +180,6 @@ module SaveData
# save_value { $foo }
# load_value { |value| $foo = value }
# new_game_value { Foo.new }
# from_old_format { |old_format| old_format[16] if old_format[16].is_a?(Foo) }
# end
# @example Registering a value to be loaded on bootup
# SaveData.register(:bar) do
@@ -190,6 +198,11 @@ module SaveData
@values << Value.new(id, &block)
end
def self.unregister(id)
validate id => Symbol
@values.delete_if { |value| value.id == id }
end
# @param save_data [Hash] save data to validate
# @return [Boolean] whether the given save data is valid
def self.valid?(save_data)
@@ -229,7 +242,7 @@ module SaveData
# Marks all values that aren't loaded on bootup as unloaded.
def self.mark_values_as_unloaded
@values.each do |value|
value.mark_as_unloaded unless value.load_in_bootup?
value.mark_as_unloaded if !value.load_in_bootup? || value.reset_on_new_game?
end
end
@@ -255,7 +268,7 @@ module SaveData
# new game.
def self.load_new_game_values
@values.each do |value|
value.load_new_game_value if value.has_new_game_proc? && !value.loaded?
value.load_new_game_value if value.has_new_game_proc? && (!value.loaded? || value.reset_on_new_game?)
end
end

View File

@@ -140,4 +140,5 @@ SaveData.register(:stats) do
save_value { $stats }
load_value { |value| $stats = value }
new_game_value { GameStats.new }
reset_on_new_game
end

View File

@@ -655,21 +655,13 @@ class Battle::Move::HigherPriorityInGrassyTerrain < Battle::Move
end
#===============================================================================
# Decreases the PP of the last attack used by the target by 3 (or as much as
# possible). (Eerie Spell)
# Target's last move used loses 3 PP. Damaging move. (Eerie Spell)
#===============================================================================
class Battle::Move::LowerPPOfTargetLastMoveBy3 < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
if !last_move || last_move.pp == 0 || last_move.total_pp <= 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user, target)
return if target.fainted?
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
return if !last_move || last_move.pp == 0 || last_move.total_pp <= 0
reduction = [3, last_move.pp].min
target.pbSetPP(last_move, last_move.pp - reduction)
@battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",
@@ -678,7 +670,7 @@ class Battle::Move::LowerPPOfTargetLastMoveBy3 < Battle::Move
end
#===============================================================================
# Target's last move used loses 4 PP. (Spite)
# Target's last move used loses 4 PP. Status move. (Spite)
#===============================================================================
class Battle::Move::LowerPPOfTargetLastMoveBy4 < Battle::Move
def ignoresSubstitute?(user); return true; end

View File

@@ -44,12 +44,16 @@ class Window_Pokedex < Window_DrawableCommand
else
pbCopyBitmap(self.contents, @pokeballSeen.bitmap, rect.x - 6, rect.y + 10)
end
text = sprintf("%03d%s %s", indexNumber, " ", @commands[index][1])
num_text = sprintf("%03d", indexNumber)
name_text = @commands[index][1]
else
text = sprintf("%03d ----------", indexNumber)
num_text = sprintf("%03d", indexNumber)
name_text = "----------"
end
pbDrawShadowText(self.contents, rect.x + 36, rect.y + 6, rect.width, rect.height,
text, self.baseColor, self.shadowColor)
num_text, self.baseColor, self.shadowColor)
pbDrawShadowText(self.contents, rect.x + 84, rect.y + 6, rect.width, rect.height,
name_text, self.baseColor, self.shadowColor)
end
def refresh

View File

@@ -516,9 +516,9 @@ class PokemonEntryScene2
[@helptext, 160, 18, false, Color.new(16, 24, 32), Color.new(168, 184, 184)]
]
chars = @helper.textChars
x = 166
x = 172
chars.each do |ch|
textPositions.push([ch, x, 54, false, Color.new(16, 24, 32), Color.new(168, 184, 184)])
textPositions.push([ch, x, 54, 2, Color.new(16, 24, 32), Color.new(168, 184, 184)])
x += 24
end
pbDrawTextPositions(bgoverlay, textPositions)