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
# 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")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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 = [

View File

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

View File

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