Tweaks to comments, Destiny Knot no longer affects breeding in Gen 5 mechanics

This commit is contained in:
Maruno17
2022-05-17 23:52:53 +01:00
parent e12b6fde1d
commit 04f3b29fe3
14 changed files with 36 additions and 33 deletions

View File

@@ -20,8 +20,8 @@ class Battle
# battlers will move to the centre position at the end of a round, but # 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 # because they cannot move into a position owned by a different
# trainer, it's possible that battlers will be unable to move close # trainer, it's possible that battlers will be unable to move close
# enough to hit each other if there are multiple trainers on each # enough to hit each other if there are multiple trainers on both
# side. # sides.
if trainerBattle? && (@sideSizes[0] > 2 || @sideSizes[1] > 2) && if trainerBattle? && (@sideSizes[0] > 2 || @sideSizes[1] > 2) &&
@player.length > 1 && @opponent.length > 1 @player.length > 1 && @opponent.length > 1
raise _INTL("Can't have battles larger than 2v2 where both sides have multiple trainers") raise _INTL("Can't have battles larger than 2v2 where both sides have multiple trainers")

View File

@@ -215,14 +215,12 @@ class Battle
@priority.each do |entry| @priority.each do |entry|
entry[0].effects[PBEffects::PriorityAbility] = false entry[0].effects[PBEffects::PriorityAbility] = false
entry[0].effects[PBEffects::PriorityItem] = 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 subpri = entry[2] # Sub-priority from ability
if (subpri == 0 && entry[3] != 0) || # Ability has no effect, item has effect 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 < 0 && entry[3] >= 1) # Ability makes it slower, item makes it faster
subpri = entry[3] # Sub-priority from item subpri = entry[3] # Sub-priority from item
entry[0].effects[PBEffects::PriorityItem] = true 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 entry[0].effects[PBEffects::PriorityAbility] = true
end end
entry[4] = subpri # Final sub-priority entry[4] = subpri # Final sub-priority

View File

@@ -302,7 +302,7 @@ class Battle::Battler
def pbLowerAttackStatStageIntimidate(user) def pbLowerAttackStatStageIntimidate(user)
return false if fainted? 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 @effects[PBEffects::Substitute] > 0
if Battle::Scene::USE_ABILITY_SPLASH if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} is protected by its substitute!", pbThis)) @battle.pbDisplay(_INTL("{1} is protected by its substitute!", pbThis))

View File

@@ -71,7 +71,7 @@ class Battle::Battler
# NOTE: In Gen 5 only, Trace only triggers upon the Trace bearer switching # 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 # in and not at any later times, even if a traceable ability turns
# up later. Essentials ignores this, and allows Trace to trigger # 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| choices = @battle.allOtherSideBattlers(@index).select { |b|
next !b.ungainableAbility? && next !b.ungainableAbility? &&
![:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id) ![:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id)

View File

@@ -98,7 +98,7 @@ class Battle::Battler
end end
# Destiny Bond # Destiny Bond
# NOTE: Although Destiny Bond is similar to Grudge, they don't apply at # 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). # to trigger at the same time as Grudge).
if user.effects[PBEffects::DestinyBondTarget] >= 0 && !user.fainted? if user.effects[PBEffects::DestinyBondTarget] >= 0 && !user.fainted?
dbName = @battle.battlers[user.effects[PBEffects::DestinyBondTarget]].pbThis dbName = @battle.battlers[user.effects[PBEffects::DestinyBondTarget]].pbThis

View File

@@ -1313,9 +1313,9 @@ class Battle::Move::TypeDependsOnUserIVs < Battle::Move
end end
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) 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 iv = pkmn.iv
idxType = 0 idxType = 0
power = 60 power = 60
@@ -1363,9 +1363,9 @@ class Battle::Move::TypeAndPowerDependOnUserBerry < Battle::Move
return false return false
end end
# NOTE: The AI calls this method via pbCalcType, but it involves user.item # NOTE: The AI calls this method via pbCalcType, and this method returns a
# which here is assumed to be not nil (because item.id is called). Since # type assuming user has an item even though it might not. Since the AI
# the AI won't want to use it if the user has no item anyway, perhaps # won't want to use this move if the user has no item, though, perhaps
# this is good enough. # this is good enough.
def pbBaseType(user) def pbBaseType(user)
item = user.item item = user.item

View File

@@ -477,7 +477,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
@buttons = Array.new(maxIndex + 1) do |i| @buttons = Array.new(maxIndex + 1) do |i|
numButtons = @sideSizes[i % 2] numButtons = @sideSizes[i % 2]
next if numButtons <= 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 # that side's trainer, so inc is different for each side for the
# same value of i/2. # same value of i/2.
inc = (i.even?) ? i / 2 : numButtons - 1 - (i / 2) inc = (i.even?) ? i / 2 : numButtons - 1 - (i / 2)

View File

@@ -455,6 +455,10 @@ module Battle::Scene::Animation::BallAnimationMixin
end end
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 = { BALL_BURST_CAPTURE_VARIANCES = {
# [top glare filename, top particle start tone, top particle end tone, # [top glare filename, top particle start tone, top particle end tone,
# middle glare filename, middle glare start tone, middle glare end tone, # middle glare filename, middle glare start tone, middle glare end tone,

View File

@@ -539,7 +539,7 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio
def createBallTrajectory(ball, destX, destY) def createBallTrajectory(ball, destX, destY)
# NOTE: In HGSS, there isn't a Poké Ball arc under any circumstance (neither # 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 # 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) ball.setXY(0, destX, destY - 4)
end end
end end
@@ -745,6 +745,8 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
ballBurstCapture(delay, ball, ballEndX, ballEndY, @poke_ball) ballBurstCapture(delay, ball, ballEndX, ballEndY, @poke_ball)
# NOTE: The Pokémon does not change color while being absorbed into a Poké # 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. # 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.setSE(delay, "Battle jump to ball")
battler.moveXY(delay, 5, ballEndX, ballEndY) battler.moveXY(delay, 5, ballEndX, ballEndY)
battler.moveZoom(delay, 5, 0) battler.moveZoom(delay, 5, 0)

View File

@@ -1199,13 +1199,14 @@ Battle::AbilityEffects::DamageCalcFromUser.copy(:AERILATE, :PIXILATE, :REFRIGERA
Battle::AbilityEffects::DamageCalcFromUser.add(:ANALYTIC, Battle::AbilityEffects::DamageCalcFromUser.add(:ANALYTIC,
proc { |ability, user, target, move, mults, baseDmg, type| proc { |ability, user, target, move, mults, baseDmg, type|
# NOTE: If another battler faints earlier in the round, but it would have # NOTE: In the official games, if another battler faints earlier in the
# moved after the user, then Analytic would not power up the move. # round but it would have moved after the user, then Analytic does not
# However, this makes the determination so much more complicated # power up the move. However, this makes the determination so much
# (involving pbPriority and counting or not counting speed/priority # more complicated (involving pbPriority and counting or not counting
# modifiers depending on which Generation's mechanics are being used), # speed/priority modifiers depending on which Generation's mechanics
# so I'm choosing to ignore it. The effect is thus: "power up the move # are being used), so I'm choosing to ignore it. The effect is thus:
# if all other battlers on the field right now have already moved". # "power up the move if all other battlers on the field right now have
# already moved".
if move.pbMoveFailedLastInRound?(user, false) if move.pbMoveFailedLastInRound?(user, false)
mults[:base_damage_multiplier] *= 1.3 mults[:base_damage_multiplier] *= 1.3
end end
@@ -2213,7 +2214,7 @@ Battle::AbilityEffects::AfterMoveUseFromTarget.add(:COLORCHANGE,
Battle::AbilityEffects::AfterMoveUseFromTarget.add(:PICKPOCKET, Battle::AbilityEffects::AfterMoveUseFromTarget.add(:PICKPOCKET,
proc { |ability, target, user, move, switched_battlers, battle| proc { |ability, target, user, move, switched_battlers, battle|
# NOTE: According to Bulbapedia, this can still trigger to steal the user's # 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. # sense, so this code doesn't do it.
next if target.wild? next if target.wild?
next if switched_battlers.include?(user.index) # User was switched out next if switched_battlers.include?(user.index) # User was switched out

View File

@@ -1079,10 +1079,10 @@ Battle::ItemEffects::DamageCalcFromUser.add(:WISEGLASSES,
#=============================================================================== #===============================================================================
# DamageCalcFromTarget handlers # DamageCalcFromTarget handlers
#===============================================================================
# NOTE: Species-specific held items consider the original species, not the # NOTE: Species-specific held items consider the original species, not the
# transformed species, and still work while transformed. The exceptions # transformed species, and still work while transformed. The exceptions
# are Metal/Quick Powder, which don't work if the holder is transformed. # are Metal/Quick Powder, which don't work if the holder is transformed.
#===============================================================================
Battle::ItemEffects::DamageCalcFromTarget.add(:ASSAULTVEST, Battle::ItemEffects::DamageCalcFromTarget.add(:ASSAULTVEST,
proc { |item, user, target, move, mults, baseDmg, type| proc { |item, user, target, move, mults, baseDmg, type|

View File

@@ -173,15 +173,15 @@ class DayCare
end end
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) def inherit_IVs(egg, mother, father)
# Get all stats # Get all stats
stats = [] stats = []
GameData::Stat.each_main { |s| stats.push(s) } GameData::Stat.each_main { |s| stats.push(s) }
# Get the number of stats to inherit # Get the number of stats to inherit
inherit_count = 3 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, # Inherit IV because of Power items (if both parents have a Power item,
# then only a random one of them is inherited) # then only a random one of them is inherited)
power_items = [ power_items = [

View File

@@ -176,7 +176,6 @@ class PokemonRegionMap_Scene
return point[1] > 0 && $game_switches[point[1]] return point[1] > 0 && $game_switches[point[1]]
end end
# TODO: Why is this PBS file writer here?
def pbSaveMapData def pbSaveMapData
File.open("PBS/town_map.txt", "wb") { |f| File.open("PBS/town_map.txt", "wb") { |f|
Compiler.add_PBS_header_to_file(f) Compiler.add_PBS_header_to_file(f)
@@ -185,8 +184,8 @@ class PokemonRegionMap_Scene
next if !map next if !map
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
f.write(sprintf("[%d]\r\n", i)) f.write(sprintf("[%d]\r\n", i))
f.write(sprintf("Name = %s\r\nFilename = %s\r\n", f.write(sprintf("Name = %s\r\n", Compiler.csvQuote(map[0])))
Compiler.csvQuote(map[0]), Compiler.csvQuote(map[1]))) f.write(sprintf("Filename = %s\r\n", Compiler.csvQuote(map[1])))
map[2].each do |loc| map[2].each do |loc|
f.write("Point = ") f.write("Point = ")
Compiler.pbWriteCsvRecord(loc, f, [nil, "uussUUUU"]) Compiler.pbWriteCsvRecord(loc, f, [nil, "uussUUUU"])

View File

@@ -27,9 +27,8 @@ module Compiler
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
f.write(sprintf("[%d]\r\n", i)) f.write(sprintf("[%d]\r\n", i))
rname = pbGetMessage(MessageTypes::RegionNames, i) rname = pbGetMessage(MessageTypes::RegionNames, i)
f.write(sprintf("Name = %s\r\nFilename = %s\r\n", f.write(sprintf("Name = %s\r\n", (rname && rname != "") ? rname : _INTL("Unnamed")))
(rname && rname != "") ? rname : _INTL("Unnamed"), f.write(sprintf("Filename = %s\r\n", csvQuote((map[1].is_a?(Array)) ? map[1][0] : map[1])))
csvQuote((map[1].is_a?(Array)) ? map[1][0] : map[1])))
map[2].each do |loc| map[2].each do |loc|
f.write("Point = ") f.write("Point = ")
pbWriteCsvRecord(loc, f, [nil, "uussUUUU"]) pbWriteCsvRecord(loc, f, [nil, "uussUUUU"])