From 04f3b29fe3f3a8eb11fa67e7be11ff19b1fcab74 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Tue, 17 May 2022 23:52:53 +0100 Subject: [PATCH] Tweaks to comments, Destiny Knot no longer affects breeding in Gen 5 mechanics --- .../001_Battle/002_Battle_StartAndEnd.rb | 4 ++-- .../004_Battle_ActionAttacksPriority.rb | 4 +--- .../002_Battler/005_Battler_StatStages.rb | 2 +- .../002_Battler/006_Battler_AbilityAndItem.rb | 2 +- .../010_Battler_UseMoveTriggerEffects.rb | 2 +- .../003_Move/008_MoveEffects_MoveAttributes.rb | 10 +++++----- .../004_Scene/005_Battle_Scene_Menus.rb | 2 +- .../004_Scene/007_Battle_Scene_BaseAnimation.rb | 4 ++++ .../004_Scene/008_Battle_Scene_Animations.rb | 4 +++- .../008_Battle_AbilityEffects.rb | 17 +++++++++-------- .../009_Battle_ItemEffects.rb | 2 +- .../012_Overworld/007_Overworld_DayCare.rb | 6 +++--- Data/Scripts/016_UI/009_UI_RegionMap.rb | 5 ++--- .../021_Compiler/003_Compiler_WritePBS.rb | 5 ++--- 14 files changed, 36 insertions(+), 33 deletions(-) diff --git a/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb b/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb index 2b570fb7e..d88b34e96 100644 --- a/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb +++ b/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb @@ -20,8 +20,8 @@ class Battle # battlers will move to the centre position at the end of a round, but # because they cannot move into a position owned by a different # trainer, it's possible that battlers will be unable to move close - # enough to hit each other if there are multiple trainers on each - # side. + # enough to hit each other if there are multiple trainers on both + # sides. if trainerBattle? && (@sideSizes[0] > 2 || @sideSizes[1] > 2) && @player.length > 1 && @opponent.length > 1 raise _INTL("Can't have battles larger than 2v2 where both sides have multiple trainers") diff --git a/Data/Scripts/011_Battle/001_Battle/004_Battle_ActionAttacksPriority.rb b/Data/Scripts/011_Battle/001_Battle/004_Battle_ActionAttacksPriority.rb index b58b67ae4..938284f7d 100644 --- a/Data/Scripts/011_Battle/001_Battle/004_Battle_ActionAttacksPriority.rb +++ b/Data/Scripts/011_Battle/001_Battle/004_Battle_ActionAttacksPriority.rb @@ -215,14 +215,12 @@ class Battle @priority.each do |entry| entry[0].effects[PBEffects::PriorityAbility] = false entry[0].effects[PBEffects::PriorityItem] = false - # TODO: Set b.effects[PBEffects::PriorityAbility] and the other one depending - # on the sub-priorities. Calculate final sub-priorities for each battler. subpri = entry[2] # Sub-priority from ability if (subpri == 0 && entry[3] != 0) || # Ability has no effect, item has effect (subpri < 0 && entry[3] >= 1) # Ability makes it slower, item makes it faster subpri = entry[3] # Sub-priority from item entry[0].effects[PBEffects::PriorityItem] = true - elsif subpri != 0 # Ability has effect, item had no/superfluous effect + elsif subpri != 0 # Ability has effect, item had superfluous/no effect entry[0].effects[PBEffects::PriorityAbility] = true end entry[4] = subpri # Final sub-priority diff --git a/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb b/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb index b8849df1c..1f6e66d6f 100644 --- a/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb +++ b/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb @@ -302,7 +302,7 @@ class Battle::Battler def pbLowerAttackStatStageIntimidate(user) return false if fainted? - # NOTE: Substitute intentially blocks Intimidate even if self has Contrary. + # NOTE: Substitute intentionally blocks Intimidate even if self has Contrary. if @effects[PBEffects::Substitute] > 0 if Battle::Scene::USE_ABILITY_SPLASH @battle.pbDisplay(_INTL("{1} is protected by its substitute!", pbThis)) diff --git a/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb b/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb index 23199df64..02fa3e9fa 100644 --- a/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb +++ b/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb @@ -71,7 +71,7 @@ class Battle::Battler # NOTE: In Gen 5 only, Trace only triggers upon the Trace bearer switching # in and not at any later times, even if a traceable ability turns # up later. Essentials ignores this, and allows Trace to trigger - # whenever it can even in the old battle mechanics. + # whenever it can even in Gen 5 battle mechanics. choices = @battle.allOtherSideBattlers(@index).select { |b| next !b.ungainableAbility? && ![:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id) diff --git a/Data/Scripts/011_Battle/002_Battler/010_Battler_UseMoveTriggerEffects.rb b/Data/Scripts/011_Battle/002_Battler/010_Battler_UseMoveTriggerEffects.rb index 1ae15248b..982df6037 100644 --- a/Data/Scripts/011_Battle/002_Battler/010_Battler_UseMoveTriggerEffects.rb +++ b/Data/Scripts/011_Battle/002_Battler/010_Battler_UseMoveTriggerEffects.rb @@ -98,7 +98,7 @@ class Battle::Battler end # Destiny Bond # NOTE: Although Destiny Bond is similar to Grudge, they don't apply at - # the same time (although Destiny Bond does check whether it's going + # the same time (however, Destiny Bond does check whether it's going # to trigger at the same time as Grudge). if user.effects[PBEffects::DestinyBondTarget] >= 0 && !user.fainted? dbName = @battle.battlers[user.effects[PBEffects::DestinyBondTarget]].pbThis diff --git a/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb b/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb index a138b1a93..71cd0e56a 100644 --- a/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb +++ b/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb @@ -1313,9 +1313,9 @@ class Battle::Move::TypeDependsOnUserIVs < Battle::Move end end +# NOTE: This allows Hidden Power to be Fairy-type (if you have that type in your +# game). I don't care that the official games don't work like that. def pbHiddenPower(pkmn) - # NOTE: This allows Hidden Power to be Fairy-type (if you have that type in - # your game). I don't care that the official games don't work like that. iv = pkmn.iv idxType = 0 power = 60 @@ -1363,9 +1363,9 @@ class Battle::Move::TypeAndPowerDependOnUserBerry < Battle::Move return false end - # NOTE: The AI calls this method via pbCalcType, but it involves user.item - # which here is assumed to be not nil (because item.id is called). Since - # the AI won't want to use it if the user has no item anyway, perhaps + # NOTE: The AI calls this method via pbCalcType, and this method returns a + # type assuming user has an item even though it might not. Since the AI + # won't want to use this move if the user has no item, though, perhaps # this is good enough. def pbBaseType(user) item = user.item diff --git a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb index ee06be229..720b4065d 100644 --- a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb +++ b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb @@ -477,7 +477,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase @buttons = Array.new(maxIndex + 1) do |i| numButtons = @sideSizes[i % 2] next if numButtons <= i / 2 - # NOTE: Battler indexes go from left to right from the perspective of + # NOTE: Battler indices go from left to right from the perspective of # that side's trainer, so inc is different for each side for the # same value of i/2. inc = (i.even?) ? i / 2 : numButtons - 1 - (i / 2) diff --git a/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb b/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb index 8b55fe44c..174592840 100644 --- a/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb +++ b/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb @@ -455,6 +455,10 @@ module Battle::Scene::Animation::BallAnimationMixin end end + # NOTE: This array makes the Ball Burst capture animation differ between types + # of Poké Ball in certain simple ways. The HGSS animations occasionally + # have additional differences, which haven't been coded yet in + # Essentials as they're more complex and I couldn't be bothered. BALL_BURST_CAPTURE_VARIANCES = { # [top glare filename, top particle start tone, top particle end tone, # middle glare filename, middle glare start tone, middle glare end tone, diff --git a/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb b/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb index 74641a254..03d1e4e61 100644 --- a/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb +++ b/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb @@ -539,7 +539,7 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio def createBallTrajectory(ball, destX, destY) # NOTE: In HGSS, there isn't a Poké Ball arc under any circumstance (neither # when throwing out the first Pokémon nor when switching/replacing a - # fainted Pokémon). This is probably worth changing. + # fainted Pokémon). You may choose to change this. ball.setXY(0, destX, destY - 4) end end @@ -745,6 +745,8 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation ballBurstCapture(delay, ball, ballEndX, ballEndY, @poke_ball) # NOTE: The Pokémon does not change color while being absorbed into a Poké # Ball during a capture attempt. This may be an oversight in HGSS. + # It's hard to spot due to the ball burst animation being played on + # top of it. battler.setSE(delay, "Battle jump to ball") battler.moveXY(delay, 5, ballEndX, ballEndY) battler.moveZoom(delay, 5, 0) diff --git a/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb b/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb index ea668b677..ae8fb5231 100644 --- a/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb +++ b/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb @@ -1199,13 +1199,14 @@ Battle::AbilityEffects::DamageCalcFromUser.copy(:AERILATE, :PIXILATE, :REFRIGERA Battle::AbilityEffects::DamageCalcFromUser.add(:ANALYTIC, proc { |ability, user, target, move, mults, baseDmg, type| - # NOTE: If another battler faints earlier in the round, but it would have - # moved after the user, then Analytic would not power up the move. - # However, this makes the determination so much more complicated - # (involving pbPriority and counting or not counting speed/priority - # modifiers depending on which Generation's mechanics are being used), - # so I'm choosing to ignore it. The effect is thus: "power up the move - # if all other battlers on the field right now have already moved". + # NOTE: In the official games, if another battler faints earlier in the + # round but it would have moved after the user, then Analytic does not + # power up the move. However, this makes the determination so much + # more complicated (involving pbPriority and counting or not counting + # speed/priority modifiers depending on which Generation's mechanics + # are being used), so I'm choosing to ignore it. The effect is thus: + # "power up the move if all other battlers on the field right now have + # already moved". if move.pbMoveFailedLastInRound?(user, false) mults[:base_damage_multiplier] *= 1.3 end @@ -2213,7 +2214,7 @@ Battle::AbilityEffects::AfterMoveUseFromTarget.add(:COLORCHANGE, Battle::AbilityEffects::AfterMoveUseFromTarget.add(:PICKPOCKET, proc { |ability, target, user, move, switched_battlers, battle| # NOTE: According to Bulbapedia, this can still trigger to steal the user's - # item even if it was switched out by a Red Card. This doesn't make + # item even if it was switched out by a Red Card. That doesn't make # sense, so this code doesn't do it. next if target.wild? next if switched_battlers.include?(user.index) # User was switched out diff --git a/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb b/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb index 530d79172..6a45ab439 100644 --- a/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb +++ b/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb @@ -1079,10 +1079,10 @@ Battle::ItemEffects::DamageCalcFromUser.add(:WISEGLASSES, #=============================================================================== # DamageCalcFromTarget handlers -#=============================================================================== # NOTE: Species-specific held items consider the original species, not the # transformed species, and still work while transformed. The exceptions # are Metal/Quick Powder, which don't work if the holder is transformed. +#=============================================================================== Battle::ItemEffects::DamageCalcFromTarget.add(:ASSAULTVEST, proc { |item, user, target, move, mults, baseDmg, type| diff --git a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb index ecc82c368..58b4dd7fb 100644 --- a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb +++ b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb @@ -173,15 +173,15 @@ class DayCare end end - # NOTE: Destiny Bond's effect is only in Gen 6+, but I don't think it's - # worth excluding it if the mechanics generation is 5 or lower. def inherit_IVs(egg, mother, father) # Get all stats stats = [] GameData::Stat.each_main { |s| stats.push(s) } # Get the number of stats to inherit inherit_count = 3 - inherit_count = 5 if mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT) + if Settings::MECHANICS_GENERATION >= 6 + inherit_count = 5 if mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT) + end # Inherit IV because of Power items (if both parents have a Power item, # then only a random one of them is inherited) power_items = [ diff --git a/Data/Scripts/016_UI/009_UI_RegionMap.rb b/Data/Scripts/016_UI/009_UI_RegionMap.rb index 916b35bc7..131c169ab 100644 --- a/Data/Scripts/016_UI/009_UI_RegionMap.rb +++ b/Data/Scripts/016_UI/009_UI_RegionMap.rb @@ -176,7 +176,6 @@ class PokemonRegionMap_Scene return point[1] > 0 && $game_switches[point[1]] end - # TODO: Why is this PBS file writer here? def pbSaveMapData File.open("PBS/town_map.txt", "wb") { |f| Compiler.add_PBS_header_to_file(f) @@ -185,8 +184,8 @@ class PokemonRegionMap_Scene next if !map f.write("\#-------------------------------\r\n") f.write(sprintf("[%d]\r\n", i)) - f.write(sprintf("Name = %s\r\nFilename = %s\r\n", - Compiler.csvQuote(map[0]), Compiler.csvQuote(map[1]))) + f.write(sprintf("Name = %s\r\n", Compiler.csvQuote(map[0]))) + f.write(sprintf("Filename = %s\r\n", Compiler.csvQuote(map[1]))) map[2].each do |loc| f.write("Point = ") Compiler.pbWriteCsvRecord(loc, f, [nil, "uussUUUU"]) diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index fda33b553..1c64d9519 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -27,9 +27,8 @@ module Compiler f.write("\#-------------------------------\r\n") f.write(sprintf("[%d]\r\n", i)) rname = pbGetMessage(MessageTypes::RegionNames, i) - f.write(sprintf("Name = %s\r\nFilename = %s\r\n", - (rname && rname != "") ? rname : _INTL("Unnamed"), - csvQuote((map[1].is_a?(Array)) ? map[1][0] : map[1]))) + f.write(sprintf("Name = %s\r\n", (rname && rname != "") ? rname : _INTL("Unnamed"))) + f.write(sprintf("Filename = %s\r\n", csvQuote((map[1].is_a?(Array)) ? map[1][0] : map[1]))) map[2].each do |loc| f.write("Point = ") pbWriteCsvRecord(loc, f, [nil, "uussUUUU"])