mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Added class GameData::Target
This commit is contained in:
@@ -1,70 +0,0 @@
|
|||||||
module PBTargets
|
|
||||||
# NOTE: These numbers are all over the place because of backwards
|
|
||||||
# compatibility. As untidy as they are, they need to be left like this.
|
|
||||||
None = 1 # Bide, Counter, Metal Burst, Mirror Coat (calculate a target)
|
|
||||||
User = 10
|
|
||||||
NearAlly = 100 # Aromatic Mist, Helping Hand, Hold Hands
|
|
||||||
UserOrNearAlly = 200 # Acupressure
|
|
||||||
UserAndAllies = 5 # Aromatherapy, Gear Up, Heal Bell, Life Dew, Magnetic Flux, Howl (in Gen 8+)
|
|
||||||
NearFoe = 400 # Me First
|
|
||||||
RandomNearFoe = 2 # Petal Dance, Outrage, Struggle, Thrash, Uproar
|
|
||||||
AllNearFoes = 4
|
|
||||||
Foe = 9 # For throwing a Poké Ball
|
|
||||||
AllFoes = 6 # Unused (for completeness)
|
|
||||||
NearOther = 0
|
|
||||||
AllNearOthers = 8
|
|
||||||
Other = 3 # Most Flying-type moves, pulse moves (hits non-near targets)
|
|
||||||
AllBattlers = 7 # Flower Shield, Perish Song, Rototiller, Teatime
|
|
||||||
UserSide = 40
|
|
||||||
FoeSide = 80 # Entry hazards
|
|
||||||
BothSides = 20
|
|
||||||
|
|
||||||
def self.noTargets?(target)
|
|
||||||
return target==None ||
|
|
||||||
target==User ||
|
|
||||||
target==UserSide ||
|
|
||||||
target==FoeSide ||
|
|
||||||
target==BothSides
|
|
||||||
end
|
|
||||||
|
|
||||||
# Used to determine if you are able to choose a target for the move.
|
|
||||||
def self.oneTarget?(target)
|
|
||||||
return !PBTargets.noTargets?(target) &&
|
|
||||||
!PBTargets.multipleTargets?(target)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.multipleTargets?(target)
|
|
||||||
return target==AllNearFoes ||
|
|
||||||
target==AllNearOthers ||
|
|
||||||
target==UserAndAllies ||
|
|
||||||
target==AllFoes ||
|
|
||||||
target==AllBattlers
|
|
||||||
end
|
|
||||||
|
|
||||||
# These moves do not target specific Pokémon but are still affected by Pressure.
|
|
||||||
def self.targetsFoeSide?(target)
|
|
||||||
return target==FoeSide ||
|
|
||||||
target==BothSides
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.canChooseDistantTarget?(target)
|
|
||||||
return target==Other
|
|
||||||
end
|
|
||||||
|
|
||||||
# These moves can be redirected to a different target.
|
|
||||||
def self.canChooseOneFoeTarget?(target)
|
|
||||||
return target==NearFoe ||
|
|
||||||
target==NearOther ||
|
|
||||||
target==Other ||
|
|
||||||
target==RandomNearFoe
|
|
||||||
end
|
|
||||||
|
|
||||||
# Used by the AI to avoid targeting an ally with a move if that move could
|
|
||||||
# target an opponent instead.
|
|
||||||
def self.canChooseFoeTarget?(target)
|
|
||||||
return target==NearFoe ||
|
|
||||||
target==NearOther ||
|
|
||||||
target==Other ||
|
|
||||||
target==RandomNearFoe
|
|
||||||
end
|
|
||||||
end
|
|
||||||
192
Data/Scripts/011_Data/002_Hardcoded data/012_Target.rb
Normal file
192
Data/Scripts/011_Data/002_Hardcoded data/012_Target.rb
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
# NOTE: If adding a new target, you will need to add code in several places to
|
||||||
|
# make them work properly:
|
||||||
|
# - def pbFindTargets
|
||||||
|
# - def pbMoveCanTarget?
|
||||||
|
# - def pbCreateTargetTexts
|
||||||
|
# - def pbFirstTarget
|
||||||
|
# - def pbTargetsMultiple?
|
||||||
|
module GameData
|
||||||
|
class Target
|
||||||
|
attr_reader :id
|
||||||
|
attr_reader :id_number
|
||||||
|
attr_reader :real_name
|
||||||
|
attr_reader :num_targets # 0, 1 or 2 (meaning 2+)
|
||||||
|
attr_reader :targets_foe # Is able to target one or more foes
|
||||||
|
attr_reader :targets_all # Crafty Shield can't protect from these moves
|
||||||
|
attr_reader :affects_foe_side # Pressure also affects these moves
|
||||||
|
attr_reader :long_range # Hits non-adjacent targets
|
||||||
|
|
||||||
|
DATA = {}
|
||||||
|
|
||||||
|
extend ClassMethods
|
||||||
|
include InstanceMethods
|
||||||
|
|
||||||
|
def self.load; end
|
||||||
|
def self.save; end
|
||||||
|
|
||||||
|
def initialize(hash)
|
||||||
|
@id = hash[:id]
|
||||||
|
@real_name = hash[:name] || "Unnamed"
|
||||||
|
@num_targets = hash[:num_targets] || 0
|
||||||
|
@targets_foe = hash[:targets_foe] || false
|
||||||
|
@targets_all = hash[:targets_all] || false
|
||||||
|
@affects_foe_side = hash[:affects_foe_side] || false
|
||||||
|
@long_range = hash[:long_range] || false
|
||||||
|
end
|
||||||
|
|
||||||
|
# @return [String] the translated name of this target
|
||||||
|
def name
|
||||||
|
return _INTL(@real_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def can_choose_distant_target?
|
||||||
|
return @num_targets == 1 && @long_range
|
||||||
|
end
|
||||||
|
|
||||||
|
def can_target_one_foe?
|
||||||
|
return @num_targets == 1 && @targets_foe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Bide, Counter, Metal Burst, Mirror Coat (calculate a target)
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :None,
|
||||||
|
:id_number => 1,
|
||||||
|
:name => _INTL("None")
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :User,
|
||||||
|
:id_number => 10,
|
||||||
|
:name => _INTL("User")
|
||||||
|
})
|
||||||
|
|
||||||
|
# Aromatic Mist, Helping Hand, Hold Hands
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :NearAlly,
|
||||||
|
:id_number => 100,
|
||||||
|
:name => _INTL("Near Ally"),
|
||||||
|
:num_targets => 1
|
||||||
|
})
|
||||||
|
|
||||||
|
# Acupressure
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :UserOrNearAlly,
|
||||||
|
:id_number => 200,
|
||||||
|
:name => _INTL("User or Near Ally"),
|
||||||
|
:num_targets => 1
|
||||||
|
})
|
||||||
|
|
||||||
|
# Aromatherapy, Gear Up, Heal Bell, Life Dew, Magnetic Flux, Howl (in Gen 8+)
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :UserAndAllies,
|
||||||
|
:id_number => 5,
|
||||||
|
:name => _INTL("User and Allies"),
|
||||||
|
:num_targets => 2,
|
||||||
|
:long_range => true
|
||||||
|
})
|
||||||
|
|
||||||
|
# Me First
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :NearFoe,
|
||||||
|
:id_number => 400,
|
||||||
|
:name => _INTL("Near Foe"),
|
||||||
|
:num_targets => 1,
|
||||||
|
:targets_foe => true
|
||||||
|
})
|
||||||
|
|
||||||
|
# Petal Dance, Outrage, Struggle, Thrash, Uproar
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :RandomNearFoe,
|
||||||
|
:id_number => 2,
|
||||||
|
:name => _INTL("Random Near Foe"),
|
||||||
|
:num_targets => 1,
|
||||||
|
:targets_foe => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :AllNearFoes,
|
||||||
|
:id_number => 4,
|
||||||
|
:name => _INTL("All Near Foes"),
|
||||||
|
:num_targets => 2,
|
||||||
|
:targets_foe => true
|
||||||
|
})
|
||||||
|
|
||||||
|
# For throwing a Poké Ball
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :Foe,
|
||||||
|
:id_number => 9,
|
||||||
|
:name => _INTL("Foe"),
|
||||||
|
:num_targets => 1,
|
||||||
|
:targets_foe => true,
|
||||||
|
:long_range => true
|
||||||
|
})
|
||||||
|
|
||||||
|
# Unused
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :AllFoes,
|
||||||
|
:id_number => 6,
|
||||||
|
:name => _INTL("All Foes"),
|
||||||
|
:num_targets => 2,
|
||||||
|
:targets_foe => true,
|
||||||
|
:long_range => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :NearOther,
|
||||||
|
:id_number => 0,
|
||||||
|
:name => _INTL("Near Other"),
|
||||||
|
:num_targets => 1,
|
||||||
|
:targets_foe => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :AllNearOthers,
|
||||||
|
:id_number => 8,
|
||||||
|
:name => _INTL("All Near Others"),
|
||||||
|
:num_targets => 2,
|
||||||
|
:targets_foe => true
|
||||||
|
})
|
||||||
|
|
||||||
|
# Most Flying-type moves, pulse moves (hits non-near targets)
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :Other,
|
||||||
|
:id_number => 3,
|
||||||
|
:name => _INTL("Other"),
|
||||||
|
:num_targets => 1,
|
||||||
|
:targets_foe => true,
|
||||||
|
:long_range => true
|
||||||
|
})
|
||||||
|
|
||||||
|
# Flower Shield, Perish Song, Rototiller, Teatime
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :AllBattlers,
|
||||||
|
:id_number => 7,
|
||||||
|
:name => _INTL("All Battlers"),
|
||||||
|
:num_targets => 2,
|
||||||
|
:targets_foe => true,
|
||||||
|
:targets_all => true,
|
||||||
|
:long_range => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :UserSide,
|
||||||
|
:id_number => 40,
|
||||||
|
:name => _INTL("User Side")
|
||||||
|
})
|
||||||
|
|
||||||
|
# Entry hazards
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :FoeSide,
|
||||||
|
:id_number => 80,
|
||||||
|
:name => _INTL("Foe Side"),
|
||||||
|
:affects_foe_side => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Target.register({
|
||||||
|
:id => :BothSides,
|
||||||
|
:id_number => 20,
|
||||||
|
:name => _INTL("Both Sides"),
|
||||||
|
:affects_foe_side => true
|
||||||
|
})
|
||||||
@@ -269,7 +269,7 @@ class PokeBattle_Battler
|
|||||||
PBDebug.log("[Ability triggered] #{b.pbThis}'s #{b.abilityName}")
|
PBDebug.log("[Ability triggered] #{b.pbThis}'s #{b.abilityName}")
|
||||||
user.pbReducePP(move)
|
user.pbReducePP(move)
|
||||||
end
|
end
|
||||||
if PBTargets.targetsFoeSide?(move.pbTarget(user))
|
if move.pbTarget(user).affects_foe_side
|
||||||
@battle.eachOtherSideBattler(user) do |b|
|
@battle.eachOtherSideBattler(user) do |b|
|
||||||
next unless b.hasActiveAbility?(:PRESSURE)
|
next unless b.hasActiveAbility?(:PRESSURE)
|
||||||
PBDebug.log("[Ability triggered] #{b.pbThis}'s #{b.abilityName}")
|
PBDebug.log("[Ability triggered] #{b.pbThis}'s #{b.abilityName}")
|
||||||
@@ -379,8 +379,7 @@ class PokeBattle_Battler
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
magicCoater = -1
|
magicCoater = -1
|
||||||
magicBouncer = -1
|
magicBouncer = -1
|
||||||
if targets.length==0 && !PBTargets.noTargets?(move.pbTarget(user)) &&
|
if targets.length == 0 && move.pbTarget(user).num_targets > 0 && !move.worksWithNoTargets?
|
||||||
!move.worksWithNoTargets?
|
|
||||||
# def pbFindTargets should have found a target(s), but it didn't because
|
# def pbFindTargets should have found a target(s), but it didn't because
|
||||||
# they were all fainted
|
# they were all fainted
|
||||||
# All target types except: None, User, UserSide, FoeSide, BothSides
|
# All target types except: None, User, UserSide, FoeSide, BothSides
|
||||||
|
|||||||
@@ -36,18 +36,21 @@ class PokeBattle_Battler
|
|||||||
preTarget = choice[3] # A target that was already chosen
|
preTarget = choice[3] # A target that was already chosen
|
||||||
targets = []
|
targets = []
|
||||||
# Get list of targets
|
# Get list of targets
|
||||||
case move.pbTarget(user) # Curse can change its target type
|
case move.pbTarget(user).id # Curse can change its target type
|
||||||
when PBTargets::NearAlly
|
when :NearAlly
|
||||||
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
||||||
if !pbAddTarget(targets,user,targetBattler,move)
|
if !pbAddTarget(targets,user,targetBattler,move)
|
||||||
pbAddTargetRandomAlly(targets,user,move)
|
pbAddTargetRandomAlly(targets,user,move)
|
||||||
end
|
end
|
||||||
when PBTargets::UserOrNearAlly
|
when :UserOrNearAlly
|
||||||
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
||||||
if !pbAddTarget(targets,user,targetBattler,move,true,true)
|
if !pbAddTarget(targets,user,targetBattler,move,true,true)
|
||||||
pbAddTarget(targets,user,user,move,true,true)
|
pbAddTarget(targets,user,user,move,true,true)
|
||||||
end
|
end
|
||||||
when PBTargets::NearFoe, PBTargets::NearOther
|
when :UserAndAllies
|
||||||
|
pbAddTarget(targets,user,user,move,true,true)
|
||||||
|
@battle.eachSameSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move,false,true) }
|
||||||
|
when :NearFoe, :NearOther
|
||||||
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
||||||
if !pbAddTarget(targets,user,targetBattler,move)
|
if !pbAddTarget(targets,user,targetBattler,move)
|
||||||
if preTarget>=0 && !user.opposes?(preTarget)
|
if preTarget>=0 && !user.opposes?(preTarget)
|
||||||
@@ -56,13 +59,11 @@ class PokeBattle_Battler
|
|||||||
pbAddTargetRandomFoe(targets,user,move)
|
pbAddTargetRandomFoe(targets,user,move)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when PBTargets::AllNearFoes
|
when :RandomNearFoe
|
||||||
@battle.eachOtherSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move) }
|
|
||||||
when PBTargets::RandomNearFoe
|
|
||||||
pbAddTargetRandomFoe(targets,user,move)
|
pbAddTargetRandomFoe(targets,user,move)
|
||||||
when PBTargets::AllNearOthers
|
when :AllNearFoes
|
||||||
@battle.eachBattler { |b| pbAddTarget(targets,user,b,move) }
|
@battle.eachOtherSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move) }
|
||||||
when PBTargets::Other
|
when :Foe, :Other
|
||||||
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
||||||
if !pbAddTarget(targets,user,targetBattler,move,false)
|
if !pbAddTarget(targets,user,targetBattler,move,false)
|
||||||
if preTarget>=0 && !user.opposes?(preTarget)
|
if preTarget>=0 && !user.opposes?(preTarget)
|
||||||
@@ -71,12 +72,11 @@ class PokeBattle_Battler
|
|||||||
pbAddTargetRandomFoe(targets,user,move,false)
|
pbAddTargetRandomFoe(targets,user,move,false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when PBTargets::UserAndAllies
|
when :AllFoes
|
||||||
pbAddTarget(targets,user,user,move,true,true)
|
|
||||||
@battle.eachSameSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move,false,true) }
|
|
||||||
when PBTargets::AllFoes
|
|
||||||
@battle.eachOtherSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move,false) }
|
@battle.eachOtherSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move,false) }
|
||||||
when PBTargets::AllBattlers
|
when :AllNearOthers
|
||||||
|
@battle.eachBattler { |b| pbAddTarget(targets,user,b,move) }
|
||||||
|
when :AllBattlers
|
||||||
@battle.eachBattler { |b| pbAddTarget(targets,user,b,move,false,true) }
|
@battle.eachBattler { |b| pbAddTarget(targets,user,b,move,false,true) }
|
||||||
else
|
else
|
||||||
# Used by Counter/Mirror Coat/Metal Burst/Bide
|
# Used by Counter/Mirror Coat/Metal Burst/Bide
|
||||||
@@ -89,12 +89,12 @@ class PokeBattle_Battler
|
|||||||
# Redirect attack to another target
|
# Redirect attack to another target
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbChangeTargets(move,user,targets)
|
def pbChangeTargets(move,user,targets)
|
||||||
targetType = move.pbTarget(user)
|
target_data = move.pbTarget(user)
|
||||||
return targets if @battle.switching # For Pursuit interrupting a switch
|
return targets if @battle.switching # For Pursuit interrupting a switch
|
||||||
return targets if move.cannotRedirect?
|
return targets if move.cannotRedirect?
|
||||||
return targets if !PBTargets.canChooseOneFoeTarget?(targetType) || targets.length!=1
|
return targets if !target_data.can_target_one_foe? || targets.length != 1
|
||||||
priority = @battle.pbPriority(true)
|
priority = @battle.pbPriority(true)
|
||||||
nearOnly = !PBTargets.canChooseDistantTarget?(move.target)
|
nearOnly = !target_data.can_choose_distant_target?
|
||||||
# Spotlight (takes priority over Follow Me/Rage Powder/Lightning Rod/Storm Drain)
|
# Spotlight (takes priority over Follow Me/Rage Powder/Lightning Rod/Storm Drain)
|
||||||
newTarget = nil; strength = 100 # Lower strength takes priority
|
newTarget = nil; strength = 100 # Lower strength takes priority
|
||||||
priority.each do |b|
|
priority.each do |b|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
# Crafty Shield
|
# Crafty Shield
|
||||||
if target.pbOwnSide.effects[PBEffects::CraftyShield] && user.index!=target.index &&
|
if target.pbOwnSide.effects[PBEffects::CraftyShield] && user.index!=target.index &&
|
||||||
move.statusMove? && move.pbTarget(user)!=PBTargets::AllBattlers
|
move.statusMove? && !move.pbTarget(user).targets_all
|
||||||
@battle.pbCommonAnimation("CraftyShield",target)
|
@battle.pbCommonAnimation("CraftyShield",target)
|
||||||
@battle.pbDisplay(_INTL("Crafty Shield protected {1}!",target.pbThis(true)))
|
@battle.pbDisplay(_INTL("Crafty Shield protected {1}!",target.pbThis(true)))
|
||||||
target.damageState.protected = true
|
target.damageState.protected = true
|
||||||
@@ -311,7 +311,7 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
# Wide Guard
|
# Wide Guard
|
||||||
if target.pbOwnSide.effects[PBEffects::WideGuard] && user.index!=target.index &&
|
if target.pbOwnSide.effects[PBEffects::WideGuard] && user.index!=target.index &&
|
||||||
PBTargets.multipleTargets?(move.pbTarget(user)) &&
|
move.pbTarget(user).num_targets > 1 &&
|
||||||
(Settings::MECHANICS_GENERATION >= 7 || move.damagingMove?)
|
(Settings::MECHANICS_GENERATION >= 7 || move.damagingMove?)
|
||||||
@battle.pbCommonAnimation("WideGuard",target)
|
@battle.pbCommonAnimation("WideGuard",target)
|
||||||
@battle.pbDisplay(_INTL("Wide Guard protected {1}!",target.pbThis(true)))
|
@battle.pbDisplay(_INTL("Wide Guard protected {1}!",target.pbThis(true)))
|
||||||
@@ -527,8 +527,7 @@ class PokeBattle_Battler
|
|||||||
# Message shown when a move fails the per-hit success check above.
|
# Message shown when a move fails the per-hit success check above.
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbMissMessage(move,user,target)
|
def pbMissMessage(move,user,target)
|
||||||
tar = move.pbTarget(user)
|
if move.pbTarget(user).num_targets > 1
|
||||||
if PBTargets.multipleTargets?(tar)
|
|
||||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||||
elsif target.effects[PBEffects::TwoTurnAttack]
|
elsif target.effects[PBEffects::TwoTurnAttack]
|
||||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class PokeBattle_Move
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# About the move
|
# About the move
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbTarget(_user); return @target; end
|
def pbTarget(_user); return GameData::Target.get(@target); end
|
||||||
|
|
||||||
def total_pp
|
def total_pp
|
||||||
return @total_pp if @total_pp && @total_pp>0 # Usually undefined
|
return @total_pp if @total_pp && @total_pp>0 # Usually undefined
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ class PokeBattle_Move_019 < PokeBattle_Move
|
|||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
# Cure all Pokémon in battle on the user's side. For the benefit of the Gen
|
# Cure all Pokémon in battle on the user's side. For the benefit of the Gen
|
||||||
# 5 version of this move, to make Pokémon out in battle get cured first.
|
# 5 version of this move, to make Pokémon out in battle get cured first.
|
||||||
if pbTarget(user)!=PBTargets::UserAndAllies
|
if pbTarget(user) == :UserSide
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
@battle.eachSameSideBattler(user) do |b|
|
||||||
next if b.status == :NONE
|
next if b.status == :NONE
|
||||||
pbAromatherapyHeal(b.pokemon,b)
|
pbAromatherapyHeal(b.pokemon,b)
|
||||||
|
|||||||
@@ -261,8 +261,8 @@ class PokeBattle_Move_10D < PokeBattle_Move
|
|||||||
def ignoresSubstitute?(user); return true; end
|
def ignoresSubstitute?(user); return true; end
|
||||||
|
|
||||||
def pbTarget(user)
|
def pbTarget(user)
|
||||||
return PBTargets::NearFoe if user.pbHasType?(:GHOST)
|
return GameData::Target.get(:NearFoe) if user.pbHasType?(:GHOST)
|
||||||
super
|
return super
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
@@ -1132,7 +1132,7 @@ class PokeBattle_Move_137 < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
return if pbTarget(user)==PBTargets::UserAndAllies
|
return if pbTarget(user) != :UserSide
|
||||||
@validTargets.each { |b| pbEffectAgainstTarget(user,b) }
|
@validTargets.each { |b| pbEffectAgainstTarget(user,b) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1978,7 +1978,7 @@ class PokeBattle_Move_15C < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
return if pbTarget(user)==PBTargets::UserAndAllies
|
return if pbTarget(user) != :UserSide
|
||||||
@validTargets.each { |b| pbEffectAgainstTarget(user,b) }
|
@validTargets.each { |b| pbEffectAgainstTarget(user,b) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2423,8 +2423,8 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokeBattle_Move_16F < PokeBattle_Move
|
class PokeBattle_Move_16F < PokeBattle_Move
|
||||||
def pbTarget(user)
|
def pbTarget(user)
|
||||||
return PBTargets::NearFoe if user.effects[PBEffects::HealBlock]>0
|
return GameData::Target.get(:NearFoe) if user.effects[PBEffects::HealBlock]>0
|
||||||
super
|
return super
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbOnStartUse(user,targets)
|
def pbOnStartUse(user,targets)
|
||||||
|
|||||||
@@ -99,31 +99,31 @@ class PokeBattle_Battle
|
|||||||
@choices[idxBattler][3] = idxTarget # Set target of move
|
@choices[idxBattler][3] = idxTarget # Set target of move
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether the idxTarget will be targeted by a move with targetType
|
# Returns whether the idxTarget will be targeted by a move with target_data
|
||||||
# used by a battler in idxUser.
|
# used by a battler in idxUser.
|
||||||
def pbMoveCanTarget?(idxUser,idxTarget,targetType)
|
def pbMoveCanTarget?(idxUser,idxTarget,target_data)
|
||||||
return false if PBTargets.noTargets?(targetType)
|
return false if target_data.num_targets == 0
|
||||||
case targetType
|
case target_data.id
|
||||||
when PBTargets::NearAlly
|
when :NearAlly
|
||||||
return false if opposes?(idxUser,idxTarget)
|
return false if opposes?(idxUser,idxTarget)
|
||||||
return false if !nearBattlers?(idxUser,idxTarget)
|
return false if !nearBattlers?(idxUser,idxTarget)
|
||||||
when PBTargets::UserOrNearAlly
|
when :UserOrNearAlly
|
||||||
return true if idxUser==idxTarget
|
return true if idxUser==idxTarget
|
||||||
return false if opposes?(idxUser,idxTarget)
|
return false if opposes?(idxUser,idxTarget)
|
||||||
return false if !nearBattlers?(idxUser,idxTarget)
|
return false if !nearBattlers?(idxUser,idxTarget)
|
||||||
when PBTargets::NearFoe, PBTargets::AllNearFoes, PBTargets::RandomNearFoe
|
when :UserAndAllies
|
||||||
return false if !opposes?(idxUser,idxTarget)
|
|
||||||
return false if !nearBattlers?(idxUser,idxTarget)
|
|
||||||
when PBTargets::Foe
|
|
||||||
return false if !opposes?(idxUser,idxTarget)
|
|
||||||
when PBTargets::NearOther, PBTargets::AllNearOthers
|
|
||||||
return false if !nearBattlers?(idxUser,idxTarget)
|
|
||||||
when PBTargets::Other
|
|
||||||
return false if idxUser==idxTarget
|
|
||||||
when PBTargets::UserAndAllies
|
|
||||||
return false if opposes?(idxUser,idxTarget)
|
return false if opposes?(idxUser,idxTarget)
|
||||||
when PBTargets::AllFoes
|
when :NearFoe, :RandomNearFoe, :AllNearFoes
|
||||||
return false if !opposes?(idxUser,idxTarget)
|
return false if !opposes?(idxUser,idxTarget)
|
||||||
|
return false if !nearBattlers?(idxUser,idxTarget)
|
||||||
|
when :Foe
|
||||||
|
return false if !opposes?(idxUser,idxTarget)
|
||||||
|
when :AllFoes
|
||||||
|
return false if !opposes?(idxUser,idxTarget)
|
||||||
|
when :NearOther, :AllNearOthers
|
||||||
|
return false if !nearBattlers?(idxUser,idxTarget)
|
||||||
|
when :Other
|
||||||
|
return false if idxUser==idxTarget
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ class PokeBattle_Battle
|
|||||||
def pbAutoFightMenu(idxBattler); return false; end
|
def pbAutoFightMenu(idxBattler); return false; end
|
||||||
|
|
||||||
def pbChooseTarget(battler,move)
|
def pbChooseTarget(battler,move)
|
||||||
targetType = move.pbTarget(battler)
|
target_data = move.pbTarget(battler)
|
||||||
idxTarget = @scene.pbChooseTarget(battler.index,targetType)
|
idxTarget = @scene.pbChooseTarget(battler.index,target_data)
|
||||||
return false if idxTarget<0
|
return false if idxTarget<0
|
||||||
pbRegisterTarget(battler.index,idxTarget)
|
pbRegisterTarget(battler.index,idxTarget)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class PokeBattle_Battle
|
|||||||
next if b.fainted? || !b.opposes?(idxSwitcher) # Shouldn't hit an ally
|
next if b.fainted? || !b.opposes?(idxSwitcher) # Shouldn't hit an ally
|
||||||
next if b.movedThisRound? || !pbChoseMoveFunctionCode?(b.index,"088") # Pursuit
|
next if b.movedThisRound? || !pbChoseMoveFunctionCode?(b.index,"088") # Pursuit
|
||||||
# Check whether Pursuit can be used
|
# Check whether Pursuit can be used
|
||||||
next unless pbMoveCanTarget?(b.index,idxSwitcher,@choices[b.index][2].target)
|
next unless pbMoveCanTarget?(b.index,idxSwitcher,@choices[b.index][2].pbTarget(b))
|
||||||
next unless pbCanChooseMove?(b.index,@choices[b.index][1],false)
|
next unless pbCanChooseMove?(b.index,@choices[b.index][1],false)
|
||||||
next if b.status == :SLEEP || b.status == :FROZEN
|
next if b.status == :SLEEP || b.status == :FROZEN
|
||||||
next if b.effects[PBEffects::SkyDrop]>=0
|
next if b.effects[PBEffects::SkyDrop]>=0
|
||||||
|
|||||||
@@ -118,17 +118,17 @@ class PokeBattle_AI
|
|||||||
# Trainer Pokémon calculate how much they want to use each of their moves.
|
# Trainer Pokémon calculate how much they want to use each of their moves.
|
||||||
def pbRegisterMoveTrainer(user,idxMove,choices,skill)
|
def pbRegisterMoveTrainer(user,idxMove,choices,skill)
|
||||||
move = user.moves[idxMove]
|
move = user.moves[idxMove]
|
||||||
targetType = move.pbTarget(user)
|
target_data = move.pbTarget(user)
|
||||||
if PBTargets.multipleTargets?(targetType)
|
if target_data.num_targets > 1
|
||||||
# If move affects multiple battlers and you don't choose a particular one
|
# If move affects multiple battlers and you don't choose a particular one
|
||||||
totalScore = 0
|
totalScore = 0
|
||||||
@battle.eachBattler do |b|
|
@battle.eachBattler do |b|
|
||||||
next if !@battle.pbMoveCanTarget?(user.index,b.index,targetType)
|
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
|
||||||
score = pbGetMoveScore(move,user,b,skill)
|
score = pbGetMoveScore(move,user,b,skill)
|
||||||
totalScore += ((user.opposes?(b)) ? score : -score)
|
totalScore += ((user.opposes?(b)) ? score : -score)
|
||||||
end
|
end
|
||||||
choices.push([idxMove,totalScore,-1]) if totalScore>0
|
choices.push([idxMove,totalScore,-1]) if totalScore>0
|
||||||
elsif PBTargets.noTargets?(targetType)
|
elsif target_data.num_targets == 0
|
||||||
# If move has no targets, affects the user, a side or the whole field
|
# If move has no targets, affects the user, a side or the whole field
|
||||||
score = pbGetMoveScore(move,user,user,skill)
|
score = pbGetMoveScore(move,user,user,skill)
|
||||||
choices.push([idxMove,score,-1]) if score>0
|
choices.push([idxMove,score,-1]) if score>0
|
||||||
@@ -136,8 +136,8 @@ class PokeBattle_AI
|
|||||||
# If move affects one battler and you have to choose which one
|
# If move affects one battler and you have to choose which one
|
||||||
scoresAndTargets = []
|
scoresAndTargets = []
|
||||||
@battle.eachBattler do |b|
|
@battle.eachBattler do |b|
|
||||||
next if !@battle.pbMoveCanTarget?(user.index,b.index,targetType)
|
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
|
||||||
next if PBTargets.canChooseFoeTarget?(targetType) && !user.opposes?(b)
|
next if target_data.targets_foe && !user.opposes?(b)
|
||||||
score = pbGetMoveScore(move,user,b,skill)
|
score = pbGetMoveScore(move,user,b,skill)
|
||||||
scoresAndTargets.push([score,b.index]) if score>0
|
scoresAndTargets.push([score,b.index]) if score>0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1775,10 +1775,10 @@ class PokeBattle_AI
|
|||||||
else
|
else
|
||||||
moveData = GameData::Move.get(target.lastRegularMoveUsed)
|
moveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||||
if moveData.category == 2 && # Status move
|
if moveData.category == 2 && # Status move
|
||||||
[PBTargets::User, PBTargets::BothSides].include?(moveData.target)
|
[:User, :BothSides].include?(moveData.target)
|
||||||
score += 60
|
score += 60
|
||||||
elsif moveData.category != 2 && # Damaging move
|
elsif moveData.category != 2 && # Damaging move
|
||||||
moveData.target == PBTargets::NearOther &&
|
moveData.target == :NearOther &&
|
||||||
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||||
score += 60
|
score += 60
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,25 +3,22 @@ class PokeBattle_AI
|
|||||||
#
|
#
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbTargetsMultiple?(move,user)
|
def pbTargetsMultiple?(move,user)
|
||||||
numTargets = 0
|
target_data = move.pbTarget(user)
|
||||||
case move.pbTarget(user)
|
return false if target_data.num_targets <= 1
|
||||||
when PBTargets::AllNearFoes
|
num_targets = 0
|
||||||
@battle.eachOtherSideBattler(user) { |b| numTargets += 1 if b.near?(user) }
|
case target_data.id
|
||||||
return numTargets>1
|
when :UserAndAllies
|
||||||
when PBTargets::AllNearOthers
|
@battle.eachSameSideBattler(user) { |_b| num_targets += 1 }
|
||||||
@battle.eachBattler { |b| numTargets += 1 if b.near?(user) }
|
when :AllNearFoes
|
||||||
return numTargets>1
|
@battle.eachOtherSideBattler(user) { |b| num_targets += 1 if b.near?(user) }
|
||||||
when PBTargets::UserAndAllies
|
when :AllFoes
|
||||||
@battle.eachSameSideBattler(user) { |_b| numTargets += 1 }
|
@battle.eachOtherSideBattler(user) { |_b| num_targets += 1 }
|
||||||
return numTargets>1
|
when :AllNearOthers
|
||||||
when PBTargets::AllFoes
|
@battle.eachBattler { |b| num_targets += 1 if b.near?(user) }
|
||||||
@battle.eachOtherSideBattler(user) { |_b| numTargets += 1 }
|
when :AllBattlers
|
||||||
return numTargets>1
|
@battle.eachBattler { |_b| num_targets += 1 }
|
||||||
when PBTargets::AllBattlers
|
|
||||||
@battle.eachBattler { |_b| numTargets += 1 }
|
|
||||||
return numTargets>1
|
|
||||||
end
|
end
|
||||||
return false
|
return num_targets > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ class PokeBattle_Scene
|
|||||||
tempVisibleSprites = visibleSprites.clone
|
tempVisibleSprites = visibleSprites.clone
|
||||||
tempVisibleSprites["commandWindow"] = false
|
tempVisibleSprites["commandWindow"] = false
|
||||||
tempVisibleSprites["targetWindow"] = true
|
tempVisibleSprites["targetWindow"] = true
|
||||||
idxTarget = pbChooseTarget(idxBattler,PBTargets::Foe,tempVisibleSprites)
|
idxTarget = pbChooseTarget(idxBattler,GameData::Target.get(:Foe),tempVisibleSprites)
|
||||||
if idxTarget>=0
|
if idxTarget>=0
|
||||||
break if yield item.id, useType, idxTarget, -1, self
|
break if yield item.id, useType, idxTarget, -1, self
|
||||||
end
|
end
|
||||||
@@ -326,21 +326,24 @@ class PokeBattle_Scene
|
|||||||
# target.
|
# target.
|
||||||
# nil means can't select that position, "" means can select that position but
|
# nil means can't select that position, "" means can select that position but
|
||||||
# there is no battler there, otherwise is a battler's name.
|
# there is no battler there, otherwise is a battler's name.
|
||||||
def pbCreateTargetTexts(idxBattler,targetType)
|
def pbCreateTargetTexts(idxBattler,target_data)
|
||||||
texts = Array.new(@battle.battlers.length) do |i|
|
texts = Array.new(@battle.battlers.length) do |i|
|
||||||
next nil if !@battle.battlers[i]
|
next nil if !@battle.battlers[i]
|
||||||
showName = false
|
showName = false
|
||||||
case targetType
|
# NOTE: Targets listed here are ones with num_targets of 0, plus
|
||||||
when PBTargets::None, PBTargets::User, PBTargets::RandomNearFoe
|
# RandomNearFoe which should look like it targets the user. All
|
||||||
|
# other targets are handled by the "else" part.
|
||||||
|
case target_data.id
|
||||||
|
when :None, :User, :RandomNearFoe
|
||||||
showName = (i==idxBattler)
|
showName = (i==idxBattler)
|
||||||
when PBTargets::UserSide, PBTargets::UserAndAllies
|
when :UserSide
|
||||||
showName = !@battle.opposes?(i,idxBattler)
|
showName = !@battle.opposes?(i,idxBattler)
|
||||||
when PBTargets::FoeSide, PBTargets::AllFoes
|
when :FoeSide
|
||||||
showName = @battle.opposes?(i,idxBattler)
|
showName = @battle.opposes?(i,idxBattler)
|
||||||
when PBTargets::BothSides, PBTargets::AllBattlers
|
when :BothSides
|
||||||
showName = true
|
showName = true
|
||||||
else
|
else
|
||||||
showName = @battle.pbMoveCanTarget?(i,idxBattler,targetType)
|
showName = @battle.pbMoveCanTarget?(i,idxBattler,target_data)
|
||||||
end
|
end
|
||||||
next nil if !showName
|
next nil if !showName
|
||||||
next (@battle.battlers[i].fainted?) ? "" : @battle.battlers[i].name
|
next (@battle.battlers[i].fainted?) ? "" : @battle.battlers[i].name
|
||||||
@@ -350,9 +353,9 @@ class PokeBattle_Scene
|
|||||||
|
|
||||||
# Returns the initial position of the cursor when choosing a target for a move
|
# Returns the initial position of the cursor when choosing a target for a move
|
||||||
# in a non-single battle.
|
# in a non-single battle.
|
||||||
def pbFirstTarget(idxBattler,targetType)
|
def pbFirstTarget(idxBattler,target_data)
|
||||||
case targetType
|
case target_data.id
|
||||||
when PBTargets::NearAlly
|
when :NearAlly
|
||||||
@battle.eachSameSideBattler(idxBattler) do |b|
|
@battle.eachSameSideBattler(idxBattler) do |b|
|
||||||
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
||||||
next if b.fainted?
|
next if b.fainted?
|
||||||
@@ -362,27 +365,27 @@ class PokeBattle_Scene
|
|||||||
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
||||||
return b.index
|
return b.index
|
||||||
end
|
end
|
||||||
when PBTargets::NearFoe, PBTargets::NearOther
|
when :NearFoe, :NearOther
|
||||||
indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)
|
indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)
|
||||||
indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) && !@battle.battlers[i].fainted? }
|
indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) && !@battle.battlers[i].fainted? }
|
||||||
indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) }
|
indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) }
|
||||||
when PBTargets::Foe, PBTargets::Other
|
when :Foe, :Other
|
||||||
indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)
|
indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)
|
||||||
indices.each { |i| return i if !@battle.battlers[i].fainted? }
|
indices.each { |i| return i if !@battle.battlers[i].fainted? }
|
||||||
indices.each { |i| return i }
|
indices.each { |i| return i }
|
||||||
end
|
end
|
||||||
return idxBattler
|
return idxBattler # Target the user initially
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseTarget(idxBattler,targetType,visibleSprites=nil)
|
def pbChooseTarget(idxBattler,target_data,visibleSprites=nil)
|
||||||
pbShowWindow(TARGET_BOX)
|
pbShowWindow(TARGET_BOX)
|
||||||
cw = @sprites["targetWindow"]
|
cw = @sprites["targetWindow"]
|
||||||
# Create an array of battler names (only valid targets are named)
|
# Create an array of battler names (only valid targets are named)
|
||||||
texts = pbCreateTargetTexts(idxBattler,targetType)
|
texts = pbCreateTargetTexts(idxBattler,target_data)
|
||||||
# Determine mode based on targetType
|
# Determine mode based on target_data
|
||||||
mode = (PBTargets.oneTarget?(targetType)) ? 0 : 1
|
mode = (target_data.num_targets == 1) ? 0 : 1
|
||||||
cw.setDetails(texts,mode)
|
cw.setDetails(texts,mode)
|
||||||
cw.index = pbFirstTarget(idxBattler,targetType)
|
cw.index = pbFirstTarget(idxBattler,target_data)
|
||||||
pbSelectBattler((mode==0) ? cw.index : texts,2) # Select initial battler/data box
|
pbSelectBattler((mode==0) ? cw.index : texts,2) # Select initial battler/data box
|
||||||
pbFadeInAndShow(@sprites,visibleSprites) if visibleSprites
|
pbFadeInAndShow(@sprites,visibleSprites) if visibleSprites
|
||||||
ret = -1
|
ret = -1
|
||||||
|
|||||||
@@ -409,12 +409,11 @@ class PokeBattle_Scene
|
|||||||
return anim if anim
|
return anim if anim
|
||||||
# Actual animation not found, get the default animation for the move's type
|
# Actual animation not found, get the default animation for the move's type
|
||||||
moveData = GameData::Move.get(moveID)
|
moveData = GameData::Move.get(moveID)
|
||||||
|
target_data = moveData.pbTarget(@battle.battlers[idxUser])
|
||||||
moveType = moveData.type
|
moveType = moveData.type
|
||||||
moveKind = moveData.category
|
moveKind = moveData.category
|
||||||
moveKind += 3 if PBTargets.multipleTargets?(moveData.target) ||
|
moveKind += 3 if target_data.num_targets > 1 || target_data.affects_foe_side
|
||||||
PBTargets.targetsFoeSide?(moveData.target)
|
moveKind += 3 if moveKind == 2 && target_data.num_targets > 0
|
||||||
moveKind += 3 if moveKind == 2 && moveData.target != PBTargets::User &&
|
|
||||||
moveData.target != PBTargets::UserSide
|
|
||||||
# [one target physical, one target special, user status,
|
# [one target physical, one target special, user status,
|
||||||
# multiple targets physical, multiple targets special, non-user status]
|
# multiple targets physical, multiple targets special, non-user status]
|
||||||
typeDefaultAnim = {
|
typeDefaultAnim = {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbMoveCategory(move)
|
def pbMoveCategory(move)
|
||||||
if move.target==PBTargets::User || move.function=="0D4" # Bide
|
if move.target == :User || move.function == "0D4" # Bide
|
||||||
return 1
|
return 1
|
||||||
elsif move.statusMove? ||
|
elsif move.statusMove? ||
|
||||||
move.function == "071" || move.function == "072" # Counter, Mirror Coat
|
move.function == "071" || move.function == "072" # Counter, Mirror Coat
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class PokeBattle_DebugSceneNoLogging
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseTarget(idxBattler,targetType,visibleSprites=nil)
|
def pbChooseTarget(idxBattler,target_data,visibleSprites=nil)
|
||||||
targets = []
|
targets = []
|
||||||
@battle.eachOtherSideBattler(idxBattler) { |b| targets.push(b.index) }
|
@battle.eachOtherSideBattler(idxBattler) { |b| targets.push(b.index) }
|
||||||
return -1 if targets.length==0
|
return -1 if targets.length==0
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ module Compiler
|
|||||||
pbCompilerEachPreppedLine("PBS/moves.txt") { |line, line_no|
|
pbCompilerEachPreppedLine("PBS/moves.txt") { |line, line_no|
|
||||||
line = pbGetCsvRecord(line, line_no, [0, "vnssueeuuuyiss",
|
line = pbGetCsvRecord(line, line_no, [0, "vnssueeuuuyiss",
|
||||||
nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"],
|
nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"],
|
||||||
nil, nil, nil, PBTargets, nil, nil, nil
|
nil, nil, nil, :Target, nil, nil, nil
|
||||||
])
|
])
|
||||||
move_number = line[0]
|
move_number = line[0]
|
||||||
move_symbol = line[1].to_sym
|
move_symbol = line[1].to_sym
|
||||||
@@ -279,7 +279,7 @@ module Compiler
|
|||||||
:accuracy => line[7],
|
:accuracy => line[7],
|
||||||
:total_pp => line[8],
|
:total_pp => line[8],
|
||||||
:effect_chance => line[9],
|
:effect_chance => line[9],
|
||||||
:target => line[10],
|
:target => GameData::Target.get(line[10]).id,
|
||||||
:priority => line[11],
|
:priority => line[11],
|
||||||
:flags => line[12],
|
:flags => line[12],
|
||||||
:description => line[13]
|
:description => line[13]
|
||||||
@@ -477,7 +477,7 @@ module Compiler
|
|||||||
:height => contents["Height"],
|
:height => contents["Height"],
|
||||||
:weight => contents["Weight"],
|
:weight => contents["Weight"],
|
||||||
:color => contents["Color"],
|
:color => contents["Color"],
|
||||||
:shape => contents["Shape"],
|
:shape => GameData::BodyShape.get(contents["Shape"]).id,
|
||||||
:habitat => contents["Habitat"],
|
:habitat => contents["Habitat"],
|
||||||
:generation => contents["Generation"],
|
:generation => contents["Generation"],
|
||||||
:back_sprite_x => contents["BattlerPlayerX"],
|
:back_sprite_x => contents["BattlerPlayerX"],
|
||||||
@@ -668,7 +668,7 @@ module Compiler
|
|||||||
:height => contents["Height"] || base_data.height,
|
:height => contents["Height"] || base_data.height,
|
||||||
:weight => contents["Weight"] || base_data.weight,
|
:weight => contents["Weight"] || base_data.weight,
|
||||||
:color => contents["Color"] || base_data.color,
|
:color => contents["Color"] || base_data.color,
|
||||||
:shape => contents["Shape"] || base_data.shape,
|
:shape => (contents["Shape"]) ? GameData::BodyShape.get(contents["Shape"]).id : base_data.shape,
|
||||||
:habitat => contents["Habitat"] || base_data.habitat,
|
:habitat => contents["Habitat"] || base_data.habitat,
|
||||||
:generation => contents["Generation"] || base_data.generation,
|
:generation => contents["Generation"] || base_data.generation,
|
||||||
:mega_stone => contents["MegaStone"],
|
:mega_stone => contents["MegaStone"],
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ module Compiler
|
|||||||
m.accuracy,
|
m.accuracy,
|
||||||
m.total_pp,
|
m.total_pp,
|
||||||
m.effect_chance,
|
m.effect_chance,
|
||||||
(getConstantName(PBTargets, m.target) rescue sprintf("%d", m.target)),
|
m.target,
|
||||||
m.priority,
|
m.priority,
|
||||||
csvQuote(m.flags),
|
csvQuote(m.flags),
|
||||||
csvQuoteAlways(m.real_description)
|
csvQuoteAlways(m.real_description)
|
||||||
@@ -301,7 +301,7 @@ module Compiler
|
|||||||
f.write(sprintf("Height = %.1f\r\n", species.height / 10.0))
|
f.write(sprintf("Height = %.1f\r\n", species.height / 10.0))
|
||||||
f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0))
|
f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0))
|
||||||
f.write(sprintf("Color = %s\r\n", species.color))
|
f.write(sprintf("Color = %s\r\n", species.color))
|
||||||
f.write(sprintf("Shape = %s\r\n", GameData::BodyShape.get(species.shape).id))
|
f.write(sprintf("Shape = %s\r\n", species.shape))
|
||||||
f.write(sprintf("Habitat = %s\r\n", species.habitat)) if species.habitat != :None
|
f.write(sprintf("Habitat = %s\r\n", species.habitat)) if species.habitat != :None
|
||||||
f.write(sprintf("Kind = %s\r\n", species.real_category))
|
f.write(sprintf("Kind = %s\r\n", species.real_category))
|
||||||
f.write(sprintf("Pokedex = %s\r\n", species.real_pokedex_entry))
|
f.write(sprintf("Pokedex = %s\r\n", species.real_pokedex_entry))
|
||||||
@@ -397,9 +397,7 @@ module Compiler
|
|||||||
f.write(sprintf("Height = %.1f\r\n", species.height / 10.0)) if species.height != base_species.height
|
f.write(sprintf("Height = %.1f\r\n", species.height / 10.0)) if species.height != base_species.height
|
||||||
f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0)) if species.weight != base_species.weight
|
f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0)) if species.weight != base_species.weight
|
||||||
f.write(sprintf("Color = %s\r\n", species.color)) if species.color != base_species.color
|
f.write(sprintf("Color = %s\r\n", species.color)) if species.color != base_species.color
|
||||||
if GameData::BodyShape.get(species.shape).id != GameData::BodyShape.get(base_species.shape).id
|
f.write(sprintf("Shape = %s\r\n", species.shape)) if species.shape != base_species.shape
|
||||||
f.write(sprintf("Shape = %s\r\n", GameData::BodyShape.get(species.shape).id))
|
|
||||||
end
|
|
||||||
if species.habitat != :None && species.habitat != base_species.habitat
|
if species.habitat != :None && species.habitat != base_species.habitat
|
||||||
f.write(sprintf("Habitat = %s\r\n", species.habitat))
|
f.write(sprintf("Habitat = %s\r\n", species.habitat))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user