mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-06-14 07:49:28 +00:00
Implemented GameData::Move
This commit is contained in:
@@ -217,8 +217,5 @@ end
|
||||
|
||||
|
||||
|
||||
class MoveHandlerHash < HandlerHash
|
||||
def initialize
|
||||
super(:PBMoves)
|
||||
end
|
||||
class MoveHandlerHash < HandlerHash2
|
||||
end
|
||||
|
||||
@@ -179,7 +179,7 @@ end
|
||||
def pbLoadSpeciesTMData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesTMData
|
||||
$PokemonTemp.speciesTMData = load_data("Data/tm.dat") || []
|
||||
$PokemonTemp.speciesTMData = load_data("Data/tm.dat") || {}
|
||||
end
|
||||
return $PokemonTemp.speciesTMData
|
||||
end
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
module GameData
|
||||
class Move
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :function_code
|
||||
attr_reader :base_damage
|
||||
attr_reader :type
|
||||
attr_reader :category
|
||||
attr_reader :accuracy
|
||||
attr_reader :total_pp
|
||||
attr_reader :effect_chance
|
||||
attr_reader :target
|
||||
attr_reader :priority
|
||||
attr_reader :flags
|
||||
attr_reader :real_description
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "moves.dat"
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
validate hash => Hash, hash[:id] => Symbol
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@function_code = hash[:function_code]
|
||||
@base_damage = hash[:base_damage]
|
||||
@type = hash[:type]
|
||||
@category = hash[:category]
|
||||
@accuracy = hash[:accuracy]
|
||||
@total_pp = hash[:total_pp]
|
||||
@effect_chance = hash[:effect_chance]
|
||||
@target = hash[:target]
|
||||
@priority = hash[:priority]
|
||||
@flags = hash[:flags]
|
||||
@real_description = hash[:description] || "???"
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this move
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Moves, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this move
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::MoveDescriptions, @id_number)
|
||||
end
|
||||
|
||||
def hidden_move?
|
||||
GameData::Item.each do |i|
|
||||
return true if i.is_HM? && i.move == @id
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
module MoveData
|
||||
ID = 0
|
||||
INTERNAL_NAME = 1
|
||||
NAME = 2
|
||||
FUNCTION_CODE = 3
|
||||
BASE_DAMAGE = 4
|
||||
TYPE = 5
|
||||
CATEGORY = 6
|
||||
ACCURACY = 7
|
||||
TOTAL_PP = 8
|
||||
EFFECT_CHANCE = 9
|
||||
TARGET = 10
|
||||
PRIORITY = 11
|
||||
FLAGS = 12
|
||||
DESCRIPTION = 13
|
||||
end
|
||||
|
||||
def pbGetMoveData(move_id, move_data_type = -1)
|
||||
Deprecation.warn_method('pbGetMoveData', 'v20', 'GameData::Move.get(move_id)')
|
||||
return GameData::Move.get(move_id)
|
||||
end
|
||||
|
||||
def pbIsHiddenMove?(move)
|
||||
Deprecation.warn_method('pbIsHiddenMove?', 'v20', 'GameData::Move.get(move).hidden_move?')
|
||||
return GameData::Move.get(move).hidden_move?
|
||||
end
|
||||
@@ -84,7 +84,7 @@ module SpeciesData
|
||||
"Weight" => [WEIGHT, "f"],
|
||||
"Color" => [COLOR, "e", :PBColors],
|
||||
"Shape" => [SHAPE, "u"],
|
||||
"Moves" => [0, "*ue", nil, :PBMoves],
|
||||
"Moves" => [0, "*ue", nil, :Move],
|
||||
"Kind" => [0, "s"],
|
||||
"Pokedex" => [0, "q"]
|
||||
}
|
||||
@@ -114,14 +114,14 @@ module SpeciesData
|
||||
"BattlerAltitude" => [METRIC_ALTITUDE, "i"],
|
||||
"BattlerShadowX" => [METRIC_SHADOW_X, "i"],
|
||||
"BattlerShadowSize" => [METRIC_SHADOW_SIZE, "u"],
|
||||
"EggMoves" => [0, "*e", :PBMoves],
|
||||
"EggMoves" => [0, "*e", :Move],
|
||||
"FormName" => [0, "q"],
|
||||
"Evolutions" => [0, "*ses", nil, :PBEvolution, nil]
|
||||
}
|
||||
if compilingForms
|
||||
ret["PokedexForm"] = [POKEDEX_FORM, "u"]
|
||||
ret["MegaStone"] = [MEGA_STONE, "e", :Item]
|
||||
ret["MegaMove"] = [MEGA_MOVE, "e", :PBMoves]
|
||||
ret["MegaMove"] = [MEGA_MOVE, "e", :Move]
|
||||
ret["UnmegaForm"] = [UNMEGA_FORM, "u"]
|
||||
ret["MegaMessage"] = [MEGA_MESSAGE, "u"]
|
||||
else
|
||||
|
||||
@@ -1,111 +1,43 @@
|
||||
module MoveData
|
||||
ID = 0
|
||||
INTERNAL_NAME = 1
|
||||
NAME = 2
|
||||
FUNCTION_CODE = 3
|
||||
BASE_DAMAGE = 4
|
||||
TYPE = 5
|
||||
CATEGORY = 6
|
||||
ACCURACY = 7
|
||||
TOTAL_PP = 8
|
||||
EFFECT_CHANCE = 9
|
||||
TARGET = 10
|
||||
PRIORITY = 11
|
||||
FLAGS = 12
|
||||
DESCRIPTION = 13
|
||||
end
|
||||
|
||||
class PokemonTemp
|
||||
attr_accessor :movesData
|
||||
end
|
||||
|
||||
def pbLoadMovesData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.movesData
|
||||
if pbRgssExists?("Data/moves.dat")
|
||||
$PokemonTemp.movesData = load_data("Data/moves.dat")
|
||||
else
|
||||
$PokemonTemp.movesData = []
|
||||
end
|
||||
end
|
||||
return $PokemonTemp.movesData
|
||||
end
|
||||
|
||||
def pbGetMoveData(move_id, move_data_type = -1)
|
||||
meta = pbLoadMovesData
|
||||
if move_data_type < 0
|
||||
return meta[move_id] || []
|
||||
end
|
||||
return meta[move_id][move_data_type] if meta[move_id]
|
||||
return nil
|
||||
end
|
||||
|
||||
alias __moveData__pbClearData pbClearData
|
||||
def pbClearData
|
||||
$PokemonTemp.movesData = nil if $PokemonTemp
|
||||
__moveData__pbClearData
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Move objects known by Pokémon.
|
||||
#===============================================================================
|
||||
class PBMove
|
||||
attr_reader(:id) # This move's ID
|
||||
attr_accessor(:pp) # The amount of PP remaining for this move
|
||||
attr_accessor(:ppup) # The number of PP Ups used for this move
|
||||
attr_reader :id # This move's ID
|
||||
attr_accessor :pp # The amount of PP remaining for this move
|
||||
attr_accessor :ppup # The number of PP Ups used on this move
|
||||
|
||||
# Initializes this object to the specified move ID.
|
||||
def initialize(move_id)
|
||||
@id = move_id
|
||||
@pp = pbGetMoveData(move_id, MoveData::TOTAL_PP) || 0
|
||||
@id = GameData::Move.get(move_id).id
|
||||
@ppup = 0
|
||||
@pp = total_pp
|
||||
end
|
||||
|
||||
# Changes this move's ID, and caps the PP amount if it is now greater than the
|
||||
# new move's total PP.
|
||||
def id=(value)
|
||||
old_id = @id
|
||||
@id = value
|
||||
@pp = [@pp, totalpp].min if old_id > 0
|
||||
end
|
||||
|
||||
# Gets this move's type.
|
||||
def type
|
||||
return pbGetMoveData(@id, MoveData::TYPE) || 0
|
||||
@id = GameData::Move.get(value).id
|
||||
@pp = [@pp, total_pp].min
|
||||
end
|
||||
|
||||
# Gets the maximum PP for this move.
|
||||
def totalpp
|
||||
max_pp = pbGetMoveData(@id, MoveData::TOTAL_PP) || 0
|
||||
def total_pp
|
||||
max_pp = GameData::Move.get(@id).total_pp
|
||||
return max_pp + max_pp * @ppup / 5
|
||||
end
|
||||
end
|
||||
alias totalpp total_pp
|
||||
|
||||
#===============================================================================
|
||||
# Object containing move data. Not used for much.
|
||||
#===============================================================================
|
||||
class PBMoveData
|
||||
attr_reader :function, :basedamage, :type, :accuracy, :category
|
||||
attr_reader :totalpp, :addlEffect, :target, :priority, :flags
|
||||
|
||||
def initialize(move_id)
|
||||
move_data = pbGetMoveData(move_id)
|
||||
@function = move_data[MoveData::FUNCTION_CODE]
|
||||
@basedamage = move_data[MoveData::BASE_DAMAGE]
|
||||
@type = move_data[MoveData::TYPE]
|
||||
@category = move_data[MoveData::CATEGORY]
|
||||
@accuracy = move_data[MoveData::ACCURACY]
|
||||
@totalpp = move_data[MoveData::TOTAL_PP]
|
||||
@addlEffect = move_data[MoveData::EFFECT_CHANCE]
|
||||
@target = move_data[MoveData::TARGET]
|
||||
@priority = move_data[MoveData::PRIORITY]
|
||||
@flags = move_data[MoveData::FLAGS]
|
||||
end
|
||||
end
|
||||
|
||||
def pbIsHiddenMove?(move)
|
||||
GameData::Item.each do |i|
|
||||
return true if i.is_HM? && move == i.move
|
||||
end
|
||||
return false
|
||||
def function_code; return GameData::Move.get(@id).function_code; end
|
||||
def base_damage; return GameData::Move.get(@id).base_damage; end
|
||||
def type; return GameData::Move.get(@id).type; end
|
||||
def category; return GameData::Move.get(@id).category; end
|
||||
def accuracy; return GameData::Move.get(@id).accuracy; end
|
||||
def effect_chance; return GameData::Move.get(@id).effect_chance; end
|
||||
def target; return GameData::Move.get(@id).target; end
|
||||
def priority; return GameData::Move.get(@id).priority; end
|
||||
def flags; return GameData::Move.get(@id).flags; end
|
||||
def name; return GameData::Move.get(@id).name; end
|
||||
def description; return GameData::Move.get(@id).description; end
|
||||
def hidden_move?; return GameData::Move.get(@id).hidden_move?; end
|
||||
end
|
||||
|
||||
@@ -429,16 +429,15 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def eachMove
|
||||
@moves.each { |m| yield m if m && m.id != 0 }
|
||||
@moves.each { |m| yield m }
|
||||
end
|
||||
|
||||
def eachMoveWithIndex
|
||||
@moves.each_with_index { |m, i| yield m, i if m && m.id != 0 }
|
||||
@moves.each_with_index { |m, i| yield m, i }
|
||||
end
|
||||
|
||||
def pbHasMove?(move_id)
|
||||
move_id = getID(PBMoves, move_id)
|
||||
return false if !move_id || move_id <= 0
|
||||
return false if !move_id
|
||||
eachMove { |m| return true if m.id == move_id }
|
||||
return false
|
||||
end
|
||||
@@ -574,7 +573,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def usingMultiTurnAttack?
|
||||
return true if @effects[PBEffects::TwoTurnAttack]>0
|
||||
return true if @effects[PBEffects::TwoTurnAttack]
|
||||
return true if @effects[PBEffects::HyperBeam]>0
|
||||
return true if @effects[PBEffects::Rollout]>0
|
||||
return true if @effects[PBEffects::Outrage]>0
|
||||
@@ -584,8 +583,8 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def inTwoTurnAttack?(*arg)
|
||||
return false if @effects[PBEffects::TwoTurnAttack]==0
|
||||
ttaFunction = pbGetMoveData(@effects[PBEffects::TwoTurnAttack],MoveData::FUNCTION_CODE)
|
||||
return false if !@effects[PBEffects::TwoTurnAttack]
|
||||
ttaFunction = GameData::Move.get(@effects[PBEffects::TwoTurnAttack]).function_code
|
||||
arg.each { |a| return true if a==ttaFunction }
|
||||
return false
|
||||
end
|
||||
@@ -595,7 +594,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def pbEncoredMoveIndex
|
||||
return -1 if @effects[PBEffects::Encore]==0 || @effects[PBEffects::EncoreMove]==0
|
||||
return -1 if @effects[PBEffects::Encore]==0 || !@effects[PBEffects::EncoreMove]
|
||||
ret = -1
|
||||
eachMoveWithIndex do |m,i|
|
||||
next if m.id!=@effects[PBEffects::EncoreMove]
|
||||
|
||||
@@ -147,9 +147,9 @@ class PokeBattle_Battler
|
||||
@lastHPLostFromFoe = 0
|
||||
@tookDamage = false
|
||||
@tookPhysicalHit = false
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
@lastRegularMoveUsed = -1
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastRoundMoved = -1
|
||||
@lastMoveFailed = false
|
||||
@@ -167,7 +167,7 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::BideTarget] = -1
|
||||
@effects[PBEffects::BurnUp] = false
|
||||
@effects[PBEffects::Charge] = 0
|
||||
@effects[PBEffects::ChoiceBand] = -1
|
||||
@effects[PBEffects::ChoiceBand] = nil
|
||||
@effects[PBEffects::Counter] = -1
|
||||
@effects[PBEffects::CounterTarget] = -1
|
||||
@effects[PBEffects::Dancer] = false
|
||||
@@ -176,10 +176,10 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::DestinyBondPrevious] = false
|
||||
@effects[PBEffects::DestinyBondTarget] = -1
|
||||
@effects[PBEffects::Disable] = 0
|
||||
@effects[PBEffects::DisableMove] = 0
|
||||
@effects[PBEffects::DisableMove] = nil
|
||||
@effects[PBEffects::Electrify] = false
|
||||
@effects[PBEffects::Encore] = 0
|
||||
@effects[PBEffects::EncoreMove] = 0
|
||||
@effects[PBEffects::EncoreMove] = nil
|
||||
@effects[PBEffects::Endure] = false
|
||||
@effects[PBEffects::FirstPledge] = 0
|
||||
@effects[PBEffects::FlashFire] = false
|
||||
@@ -240,7 +240,6 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::Quash] = 0
|
||||
@effects[PBEffects::Rage] = false
|
||||
@effects[PBEffects::RagePowder] = false
|
||||
@effects[PBEffects::Revenge] = 0
|
||||
@effects[PBEffects::Rollout] = 0
|
||||
@effects[PBEffects::Roost] = false
|
||||
@effects[PBEffects::SkyDrop] = -1
|
||||
@@ -262,7 +261,7 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::Transform] = false
|
||||
@effects[PBEffects::TransformSpecies] = 0
|
||||
@effects[PBEffects::Trapping] = 0
|
||||
@effects[PBEffects::TrappingMove] = 0
|
||||
@effects[PBEffects::TrappingMove] = nil
|
||||
@effects[PBEffects::TrappingUser] = -1
|
||||
@battle.eachBattler do |b| # Other battlers no longer trapped by self
|
||||
next if b.effects[PBEffects::TrappingUser]!=@index
|
||||
@@ -270,7 +269,7 @@ class PokeBattle_Battler
|
||||
b.effects[PBEffects::TrappingUser] = -1
|
||||
end
|
||||
@effects[PBEffects::Truant] = false
|
||||
@effects[PBEffects::TwoTurnAttack] = 0
|
||||
@effects[PBEffects::TwoTurnAttack] = nil
|
||||
@effects[PBEffects::Type3] = -1
|
||||
@effects[PBEffects::Unburden] = false
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
|
||||
@@ -94,9 +94,9 @@ class PokeBattle_Battler
|
||||
|
||||
def pbReducePP(move)
|
||||
return true if usingMultiTurnAttack?
|
||||
return true if move.pp<0 # Don't reduce PP for special calls of moves
|
||||
return true if move.totalpp<=0 # Infinite PP, can always be used
|
||||
return false if move.pp==0 # Ran out of PP, couldn't reduce
|
||||
return true if move.pp<0 # Don't reduce PP for special calls of moves
|
||||
return true if move.total_pp<=0 # Infinite PP, can always be used
|
||||
return false if move.pp==0 # Ran out of PP, couldn't reduce
|
||||
pbSetPP(move,move.pp-1) if move.pp>0
|
||||
return true
|
||||
end
|
||||
@@ -284,11 +284,11 @@ class PokeBattle_Battler
|
||||
@moves.clear
|
||||
target.moves.each_with_index do |m,i|
|
||||
@moves[i] = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(m.id))
|
||||
@moves[i].pp = 5
|
||||
@moves[i].totalpp = 5
|
||||
@moves[i].pp = 5
|
||||
@moves[i].total_pp = 5
|
||||
end
|
||||
@effects[PBEffects::Disable] = 0
|
||||
@effects[PBEffects::DisableMove] = 0
|
||||
@effects[PBEffects::DisableMove] = nil
|
||||
@effects[PBEffects::WeightChange] = target.effects[PBEffects::WeightChange]
|
||||
@battle.scene.pbRefreshOne(@index)
|
||||
@battle.pbDisplay(_INTL("{1} transformed into {2}!",pbThis,target.pbThis(true)))
|
||||
|
||||
@@ -261,7 +261,7 @@ class PokeBattle_Battler
|
||||
# disabled/anything else). This behaviour was tested in Gen 5.
|
||||
if @status==PBStatuses::SLEEP && @effects[PBEffects::Outrage]>0
|
||||
@effects[PBEffects::Outrage] = 0
|
||||
@currentMove = 0
|
||||
@currentMove = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class PokeBattle_Battler
|
||||
# permanent is whether the item is lost even after battle. Is false for Knock
|
||||
# Off.
|
||||
def pbRemoveItem(permanent = true)
|
||||
@effects[PBEffects::ChoiceBand] = -1
|
||||
@effects[PBEffects::ChoiceBand] = nil
|
||||
@effects[PBEffects::Unburden] = true if self.item
|
||||
setInitialItem(nil) if permanent && self.item == self.initialItem
|
||||
self.item = nil
|
||||
|
||||
@@ -80,7 +80,7 @@ class PokeBattle_Battler
|
||||
# Encore's effect ends if the encored move is no longer available
|
||||
if @effects[PBEffects::Encore]>0 && pbEncoredMoveIndex<0
|
||||
@effects[PBEffects::Encore] = 0
|
||||
@effects[PBEffects::EncoreMove] = 0
|
||||
@effects[PBEffects::EncoreMove] = nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,23 +96,23 @@ class PokeBattle_Battler
|
||||
pbConfuse(_INTL("{1} became confused due to fatigue!",pbThis))
|
||||
end
|
||||
# Cancel usage of most multi-turn moves
|
||||
@effects[PBEffects::TwoTurnAttack] = 0
|
||||
@effects[PBEffects::TwoTurnAttack] = nil
|
||||
@effects[PBEffects::Rollout] = 0
|
||||
@effects[PBEffects::Outrage] = 0
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
@effects[PBEffects::Bide] = 0
|
||||
@currentMove = 0
|
||||
@currentMove = nil
|
||||
# Reset counters for moves which increase them when used in succession
|
||||
@effects[PBEffects::FuryCutter] = 0
|
||||
end
|
||||
|
||||
def pbEndTurn(_choice)
|
||||
@lastRoundMoved = @battle.turnCount # Done something this round
|
||||
if @effects[PBEffects::ChoiceBand]<0 &&
|
||||
if !@effects[PBEffects::ChoiceBand] &&
|
||||
hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF])
|
||||
if @lastMoveUsed>=0 && pbHasMove?(@lastMoveUsed)
|
||||
if @lastMoveUsed && pbHasMove?(@lastMoveUsed)
|
||||
@effects[PBEffects::ChoiceBand] = @lastMoveUsed
|
||||
elsif @lastRegularMoveUsed>=0 && pbHasMove?(@lastRegularMoveUsed)
|
||||
elsif @lastRegularMoveUsed && pbHasMove?(@lastRegularMoveUsed)
|
||||
@effects[PBEffects::ChoiceBand] = @lastRegularMoveUsed
|
||||
end
|
||||
end
|
||||
@@ -184,14 +184,14 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Labels the move being used as "move"
|
||||
move = choice[2]
|
||||
return if !move || move.id==0 # if move was not chosen somehow
|
||||
return if !move # if move was not chosen somehow
|
||||
# Try to use the move (inc. disobedience)
|
||||
@lastMoveFailed = false
|
||||
if !pbTryUseMove(choice,move,specialUsage,skipAccuracyCheck)
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
if !specialUsage
|
||||
@lastRegularMoveUsed = -1
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
end
|
||||
@battle.pbGainExp # In case self is KO'd due to confusion
|
||||
@@ -200,15 +200,15 @@ class PokeBattle_Battler
|
||||
return
|
||||
end
|
||||
move = choice[2] # In case disobedience changed the move to be used
|
||||
return if !move || move.id==0 # if move was not chosen somehow
|
||||
return if !move # if move was not chosen somehow
|
||||
# Subtract PP
|
||||
if !specialUsage
|
||||
if !pbReducePP(move)
|
||||
@battle.pbDisplay(_INTL("{1} used {2}!",pbThis,move.name))
|
||||
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
@lastRegularMoveUsed = -1
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
@@ -220,7 +220,7 @@ class PokeBattle_Battler
|
||||
if isSpecies?(:AEGISLASH) && self.ability == :STANCECHANGE
|
||||
if move.damagingMove?
|
||||
pbChangeForm(1,_INTL("{1} changed to Blade Forme!",pbThis))
|
||||
elsif isConst?(move.id,PBMoves,:KINGSSHIELD)
|
||||
elsif move.id == :KINGSSHIELD
|
||||
pbChangeForm(0,_INTL("{1} changed to Shield Forme!",pbThis))
|
||||
end
|
||||
end
|
||||
@@ -234,13 +234,13 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::TwoTurnAttack] = move.id
|
||||
@currentMove = move.id
|
||||
else
|
||||
@effects[PBEffects::TwoTurnAttack] = 0 # Cancel use of two-turn attack
|
||||
@effects[PBEffects::TwoTurnAttack] = nil # Cancel use of two-turn attack
|
||||
end
|
||||
# Add to counters for moves which increase them when used in succession
|
||||
move.pbChangeUsageCounters(self,specialUsage)
|
||||
# Charge up Metronome item
|
||||
if hasActiveItem?(:METRONOME) && !move.callsAnotherMove?
|
||||
if @lastMoveUsed==move.id && !@lastMoveFailed
|
||||
if @lastMoveUsed && @lastMoveUsed==move.id && !@lastMoveFailed
|
||||
@effects[PBEffects::Metronome] += 1
|
||||
else
|
||||
@effects[PBEffects::Metronome] = 0
|
||||
@@ -516,7 +516,7 @@ class PokeBattle_Battler
|
||||
pbEndTurn(choice)
|
||||
# Instruct
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::Instruct]
|
||||
next if !b.effects[PBEffects::Instruct] || !b.lastMoveUsed
|
||||
b.effects[PBEffects::Instruct] = false
|
||||
idxMove = -1
|
||||
b.eachMoveWithIndex { |m,i| idxMove = i if m.id==b.lastMoveUsed }
|
||||
|
||||
@@ -41,19 +41,19 @@ class PokeBattle_Battler
|
||||
return false
|
||||
end
|
||||
# Choice Band
|
||||
if @effects[PBEffects::ChoiceBand]>=0
|
||||
if @effects[PBEffects::ChoiceBand]
|
||||
if hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF]) &&
|
||||
pbHasMove?(@effects[PBEffects::ChoiceBand])
|
||||
if move.id!=@effects[PBEffects::ChoiceBand]
|
||||
if showMessages
|
||||
msg = _INTL("{1} allows the use of only {2}!",itemName,
|
||||
PBMoves.getName(@effects[PBEffects::ChoiceBand]))
|
||||
GameData::Move.get(@effects[PBEffects::ChoiceBand]).name)
|
||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||
end
|
||||
return false
|
||||
end
|
||||
else
|
||||
@effects[PBEffects::ChoiceBand] = -1
|
||||
@effects[PBEffects::ChoiceBand] = nil
|
||||
end
|
||||
end
|
||||
# Taunt
|
||||
@@ -66,7 +66,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Torment
|
||||
if @effects[PBEffects::Torment] && !@effects[PBEffects::Instructed] &&
|
||||
move.id==@lastMoveUsed && move.id!=@battle.struggle.id
|
||||
@lastMoveUsed && move.id==@lastMoveUsed && move.id!=@battle.struggle.id
|
||||
if showMessages
|
||||
msg = _INTL("{1} can't use the same move twice in a row due to the torment!",pbThis)
|
||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||
@@ -138,7 +138,7 @@ class PokeBattle_Battler
|
||||
otherMoves = []
|
||||
eachMoveWithIndex do |_m,i|
|
||||
next if i==choice[1]
|
||||
otherMoves[otherMoves.length] = i if @battle.pbCanChooseMove?(@index,i,false)
|
||||
otherMoves.push(i) if @battle.pbCanChooseMove?(@index,i,false)
|
||||
end
|
||||
return false if otherMoves.length==0 # No other move to use; do nothing
|
||||
newChoice = otherMoves[@battle.pbRandom(otherMoves.length)]
|
||||
@@ -291,7 +291,7 @@ class PokeBattle_Battler
|
||||
typeMod = move.pbCalcTypeMod(move.calcType,user,target)
|
||||
target.damageState.typeMod = typeMod
|
||||
# Two-turn attacks can't fail here in the charging turn
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]>0
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]
|
||||
# Move-specific failures
|
||||
return false if move.pbFailsAgainstTarget?(user,target)
|
||||
# Immunity to priority moves because of Psychic Terrain
|
||||
@@ -479,7 +479,7 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
def pbSuccessCheckPerHit(move,user,target,skipAccuracyCheck)
|
||||
# Two-turn attacks can't fail here in the charging turn
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]>0
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]
|
||||
# Lock-On
|
||||
return true if user.effects[PBEffects::LockOn]>0 &&
|
||||
user.effects[PBEffects::LockOnPos]==target.index
|
||||
@@ -495,7 +495,7 @@ class PokeBattle_Battler
|
||||
hitsInvul = true if move.function=="09C"
|
||||
if !hitsInvul
|
||||
# Semi-invulnerable moves
|
||||
if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
if target.effects[PBEffects::TwoTurnAttack]
|
||||
if target.inTwoTurnAttack?("0C9","0CC","0CE") # Fly, Bounce, Sky Drop
|
||||
miss = true if !move.hitsFlyingTargets?
|
||||
elsif target.inTwoTurnAttack?("0CA") # Dig
|
||||
@@ -529,7 +529,7 @@ class PokeBattle_Battler
|
||||
tar = move.pbTarget(user)
|
||||
if PBTargets.multipleTargets?(tar)
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||
elsif target.effects[PBEffects::TwoTurnAttack]>0
|
||||
elsif target.effects[PBEffects::TwoTurnAttack]
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||
elsif !move.pbMissMessage(user,target)
|
||||
@battle.pbDisplay(_INTL("{1}'s attack missed!",user.pbThis))
|
||||
|
||||
@@ -9,7 +9,7 @@ class PokeBattle_Move
|
||||
attr_reader :category
|
||||
attr_reader :accuracy
|
||||
attr_accessor :pp
|
||||
attr_writer :totalpp
|
||||
attr_writer :total_pp
|
||||
attr_reader :addlEffect
|
||||
attr_reader :target
|
||||
attr_reader :priority
|
||||
@@ -23,23 +23,22 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
# Creating a move
|
||||
#=============================================================================
|
||||
def initialize(battle,move)
|
||||
def initialize(battle, move)
|
||||
@battle = battle
|
||||
@realMove = move
|
||||
@id = move.id
|
||||
@name = PBMoves.getName(@id) # Get the move's name
|
||||
@name = move.name # Get the move's name
|
||||
# Get data on the move
|
||||
moveData = pbGetMoveData(@id)
|
||||
@function = moveData[MoveData::FUNCTION_CODE]
|
||||
@baseDamage = moveData[MoveData::BASE_DAMAGE]
|
||||
@type = moveData[MoveData::TYPE]
|
||||
@category = moveData[MoveData::CATEGORY]
|
||||
@accuracy = moveData[MoveData::ACCURACY]
|
||||
@function = move.function_code
|
||||
@baseDamage = move.base_damage
|
||||
@type = move.type
|
||||
@category = move.category
|
||||
@accuracy = move.accuracy
|
||||
@pp = move.pp # Can be changed with Mimic/Transform
|
||||
@addlEffect = moveData[MoveData::EFFECT_CHANCE]
|
||||
@target = moveData[MoveData::TARGET]
|
||||
@priority = moveData[MoveData::PRIORITY]
|
||||
@flags = moveData[MoveData::FLAGS]
|
||||
@addlEffect = move.effect_chance
|
||||
@target = move.target
|
||||
@priority = move.priority
|
||||
@flags = move.flags
|
||||
@calcType = -1
|
||||
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
|
||||
@snatched = false
|
||||
@@ -48,14 +47,14 @@ class PokeBattle_Move
|
||||
# This is the code actually used to generate a PokeBattle_Move object. The
|
||||
# object generated is a subclass of this one which depends on the move's
|
||||
# function code (found in the script section PokeBattle_MoveEffect).
|
||||
def PokeBattle_Move.pbFromPBMove(battle,move)
|
||||
move = PBMove.new(0) if !move
|
||||
moveFunction = pbGetMoveData(move.id,MoveData::FUNCTION_CODE) || "000"
|
||||
className = sprintf("PokeBattle_Move_%s",moveFunction)
|
||||
def PokeBattle_Move.pbFromPBMove(battle, move)
|
||||
validate move => PBMove
|
||||
moveFunction = move.function_code || "000"
|
||||
className = sprintf("PokeBattle_Move_%s", moveFunction)
|
||||
if Object.const_defined?(className)
|
||||
return Object.const_get(className).new(battle,move)
|
||||
return Object.const_get(className).new(battle, move)
|
||||
end
|
||||
return PokeBattle_UnimplementedMove.new(battle,move)
|
||||
return PokeBattle_UnimplementedMove.new(battle, move)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -63,9 +62,9 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
def pbTarget(_user); return @target; end
|
||||
|
||||
def totalpp
|
||||
return @totalpp if @totalpp && @totalpp>0 # Usually undefined
|
||||
return @realMove.totalpp if @realMove
|
||||
def total_pp
|
||||
return @total_pp if @total_pp && @total_pp>0 # Usually undefined
|
||||
return @realMove.total_pp if @realMove
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class PokeBattle_Move
|
||||
# Is false if Power Herb or another effect lets a two turn move charge and
|
||||
# attack in the same turn.
|
||||
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID during the
|
||||
# charging turn, and is 0 during the attack turn.
|
||||
# charging turn, and is nil during the attack turn.
|
||||
def pbIsChargingTurn?(user); return false; end
|
||||
def pbDamagingMove?; return damagingMove?; end
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ class PokeBattle_Struggle < PokeBattle_Move
|
||||
def initialize(battle,move)
|
||||
@battle = battle
|
||||
@realMove = nil # Not associated with a move
|
||||
@id = (move) ? move.id : -1 # Doesn't work if 0
|
||||
@name = (move) ? PBMoves.getName(@id) : _INTL("Struggle")
|
||||
@id = (move) ? move.id : :STRUGGLE
|
||||
@name = (move) ? move.name : _INTL("Struggle")
|
||||
@function = "002"
|
||||
@baseDamage = 50
|
||||
@type = -1
|
||||
@@ -410,14 +410,14 @@ class PokeBattle_TwoTurnMove < PokeBattle_Move
|
||||
def chargingTurnMove?; return true; end
|
||||
|
||||
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID if this
|
||||
# method returns true, or 0 if false.
|
||||
# Non-zero means the charging turn. 0 means the attacking turn.
|
||||
# method returns true, or nil if false.
|
||||
# Non-nil means the charging turn. nil means the attacking turn.
|
||||
def pbIsChargingTurn?(user)
|
||||
@powerHerb = false
|
||||
@chargingTurn = false # Assume damaging turn by default
|
||||
@damagingTurn = true
|
||||
# 0 at start of charging turn, move's ID at start of damaging turn
|
||||
if user.effects[PBEffects::TwoTurnAttack]==0
|
||||
if !user.effects[PBEffects::TwoTurnAttack]
|
||||
@powerHerb = user.hasActiveItem?(:POWERHERB)
|
||||
@chargingTurn = true
|
||||
@damagingTurn = @powerHerb
|
||||
@@ -643,7 +643,7 @@ class PokeBattle_PledgeMove < PokeBattle_Move
|
||||
user.eachAlly do |b|
|
||||
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
|
||||
move = @battle.choices[b.index][2]
|
||||
next if !move || move.id<=0
|
||||
next if !move
|
||||
@combos.each do |i|
|
||||
next if i[0]!=move.function
|
||||
@pledgeSetup = true
|
||||
@@ -708,7 +708,7 @@ class PokeBattle_PledgeMove < PokeBattle_Move
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
return if @pledgeSetup # No animation for setting up
|
||||
id = @overrideAnim if @overrideAnim!=nil
|
||||
id = @overrideAnim if @overrideAnim
|
||||
return super
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_003 < PokeBattle_SleepMove
|
||||
def pbMoveFailed?(user,targets)
|
||||
if NEWEST_BATTLE_MECHANICS && isConst?(@id,PBMoves,:DARKVOID)
|
||||
if NEWEST_BATTLE_MECHANICS && @id == :DARKVOID
|
||||
if !user.isSpecies?(:DARKRAI) &&
|
||||
!isConst?(user.effects[PBEffects::TransformSpecies],PBSpecies,:DARKRAI)
|
||||
@battle.pbDisplay(_INTL("But {1} can't use the move!",user.pbThis))
|
||||
@@ -45,7 +45,7 @@ class PokeBattle_Move_003 < PokeBattle_SleepMove
|
||||
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
|
||||
return if numHits==0
|
||||
return if user.fainted? || user.effects[PBEffects::Transform]
|
||||
return if !isConst?(@id,PBMoves,:RELICSONG)
|
||||
return if @id != :RELICSONG
|
||||
return if !user.isSpecies?(:MELOETTA)
|
||||
return if user.hasActiveAbility?(:SHEERFORCE) && @addlEffect>0
|
||||
newForm = (oldForm+1)%2
|
||||
@@ -108,12 +108,12 @@ end
|
||||
class PokeBattle_Move_007 < PokeBattle_ParalysisMove
|
||||
def tramplesMinimize?(param=1)
|
||||
# Perfect accuracy and double damage (for Body Slam only)
|
||||
return NEWEST_BATTLE_MECHANICS if isConst?(@id,PBMoves,:BODYSLAM)
|
||||
return NEWEST_BATTLE_MECHANICS if @id == :BODYSLAM
|
||||
return super
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if isConst?(@id,PBMoves,:THUNDERWAVE) && PBTypes.ineffective?(target.damageState.typeMod)
|
||||
if @id == :THUNDERWAVE && PBTypes.ineffective?(target.damageState.typeMod)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return true
|
||||
end
|
||||
@@ -242,7 +242,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_010 < PokeBattle_FlinchMove
|
||||
def tramplesMinimize?(param=1)
|
||||
return super if isConst?(@id,PBMoves,:DRAGONRUSH) && !NEWEST_BATTLE_MECHANICS
|
||||
return super if @id == :DRAGONRUSH && !NEWEST_BATTLE_MECHANICS
|
||||
return true if param==1 && NEWEST_BATTLE_MECHANICS # Perfect accuracy
|
||||
return true if param==2 # Double damage
|
||||
return super
|
||||
@@ -492,9 +492,9 @@ class PokeBattle_Move_019 < PokeBattle_Move
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
super
|
||||
if isConst?(@id,PBMoves,:AROMATHERAPY)
|
||||
if @id == :AROMATHERAPY
|
||||
@battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
|
||||
elsif isConst?(@id,PBMoves,:HEALBELL)
|
||||
elsif @id == :HEALBELL
|
||||
@battle.pbDisplay(_INTL("A bell chimed!"))
|
||||
end
|
||||
end
|
||||
@@ -1217,7 +1217,7 @@ class PokeBattle_Move_044 < PokeBattle_TargetStatDownMove
|
||||
end
|
||||
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
if isConst?(@id,PBMoves,:BULLDOZE) && @battle.field.terrain==PBBattleTerrains::Grassy
|
||||
if @id == :BULLDOZE && @battle.field.terrain==PBBattleTerrains::Grassy
|
||||
baseDmg = (baseDmg/2.0).round
|
||||
end
|
||||
return baseDmg
|
||||
@@ -1406,7 +1406,7 @@ class PokeBattle_Move_04D < PokeBattle_TargetStatDownMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
inc = 2
|
||||
inc = 1 if isConst?(@id,PBMoves,:STRINGSHOT) && !NEWEST_BATTLE_MECHANICS
|
||||
inc = 1 if @id == :STRINGSHOT && !NEWEST_BATTLE_MECHANICS
|
||||
@statDown = [PBStats::SPEED,inc]
|
||||
end
|
||||
end
|
||||
@@ -1705,11 +1705,11 @@ class PokeBattle_Move_05C < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if target.lastRegularMoveUsed<=0 ||
|
||||
lastMoveData = GameData::Move.try_get(target.lastRegularMoveUsed)
|
||||
if !lastMoveData ||
|
||||
user.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
@moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
|
||||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
|
||||
@moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1721,8 +1721,7 @@ class PokeBattle_Move_05C < PokeBattle_Move
|
||||
next if m.id!=@id
|
||||
newMove = PBMove.new(target.lastRegularMoveUsed)
|
||||
user.moves[i] = PokeBattle_Move.pbFromPBMove(@battle,newMove)
|
||||
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,
|
||||
PBMoves.getName(target.lastRegularMoveUsed)))
|
||||
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
|
||||
user.pbCheckFormOnMovesetChange
|
||||
break
|
||||
end
|
||||
@@ -1756,11 +1755,11 @@ class PokeBattle_Move_05D < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if target.lastRegularMoveUsed<=0 ||
|
||||
lastMoveData = GameData::Move.try_get(target.lastRegularMoveUsed)
|
||||
if !lastMoveData ||
|
||||
user.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
@moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
|
||||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
|
||||
@moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1773,8 +1772,7 @@ class PokeBattle_Move_05D < PokeBattle_Move
|
||||
newMove = PBMove.new(target.lastRegularMoveUsed)
|
||||
user.pokemon.moves[i] = newMove
|
||||
user.moves[i] = PokeBattle_Move.pbFromPBMove(@battle,newMove)
|
||||
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,
|
||||
PBMoves.getName(target.lastRegularMoveUsed)))
|
||||
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
|
||||
user.pbCheckFormOnMovesetChange
|
||||
break
|
||||
end
|
||||
@@ -1835,9 +1833,8 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.lastMoveUsed<=0 ||
|
||||
target.lastMoveUsedType<0 ||
|
||||
PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MoveData::TYPE))
|
||||
if !target.lastMoveUsed || target.lastMoveUsedType < 0 ||
|
||||
PBTypes.isPseudoType?(GameData::Move.get(target.lastMoveUsed).type)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2347,7 +2344,7 @@ end
|
||||
# OHKO. Accuracy increases by difference between levels of user and target.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_070 < PokeBattle_FixedDamageMove
|
||||
def hitsDiggingTargets?; return isConst?(@id,PBMoves,:FISSURE); end
|
||||
def hitsDiggingTargets?; return @id == :FISSURE; end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.level>user.level
|
||||
@@ -2375,8 +2372,7 @@ class PokeBattle_Move_070 < PokeBattle_FixedDamageMove
|
||||
|
||||
def pbAccuracyCheck(user,target)
|
||||
acc = @accuracy+user.level-target.level
|
||||
acc -= 10 if NEWEST_BATTLE_MECHANICS && isConst?(@id,PBMoves,:SHEERCOLD) &&
|
||||
!user.pbHasType?(:ICE)
|
||||
acc -= 10 if NEWEST_BATTLE_MECHANICS && @id == :SHEERCOLD && !user.pbHasType?(:ICE)
|
||||
return @battle.pbRandom(100)<acc
|
||||
end
|
||||
|
||||
|
||||
@@ -714,7 +714,7 @@ end
|
||||
class PokeBattle_Move_09F < PokeBattle_Move
|
||||
def initialize(battle,move)
|
||||
super
|
||||
if isConst?(@id,PBMoves,:JUDGMENT)
|
||||
if @id == :JUDGMENT
|
||||
@itemTypes = {
|
||||
:FISTPLATE => :FIGHTING,
|
||||
:SKYPLATE => :FLYING,
|
||||
@@ -734,14 +734,14 @@ class PokeBattle_Move_09F < PokeBattle_Move
|
||||
:DREADPLATE => :DARK,
|
||||
:PIXIEPLATE => :FAIRY
|
||||
}
|
||||
elsif isConst?(@id,PBMoves,:TECHNOBLAST)
|
||||
elsif @id == :TECHNOBLAST
|
||||
@itemTypes = {
|
||||
:SHOCKDRIVE => :ELECTRIC,
|
||||
:BURNDRIVE => :FIRE,
|
||||
:CHILLDRIVE => :ICE,
|
||||
:DOUSEDRIVE => :WATER
|
||||
}
|
||||
elsif isConst?(@id,PBMoves,:MULTIATTACK)
|
||||
elsif @id == :MULTIATTACK
|
||||
@itemTypes = {
|
||||
:FIGHTINGMEMORY => :FIGHTING,
|
||||
:FLYINGMEMORY => :FLYING,
|
||||
@@ -778,7 +778,7 @@ class PokeBattle_Move_09F < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
if isConst?(@id,PBMoves,:TECHNOBLAST) # Type-specific anim
|
||||
if @id == :TECHNOBLAST # Type-specific anim
|
||||
t = pbBaseType(user)
|
||||
hitNum = 0
|
||||
hitNum = 1 if isConst?(t,PBTypes,:ELECTRIC)
|
||||
@@ -956,22 +956,22 @@ class PokeBattle_Move_0A4 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
id = getConst(PBMoves,:BODYSLAM) # Environment-specific anim
|
||||
id = :BODYSLAM # Environment-specific anim
|
||||
case @secretPower
|
||||
when 1; id = getConst(PBMoves,:THUNDERSHOCK) || id
|
||||
when 2; id = getConst(PBMoves,:VINEWHIP) || id
|
||||
when 3; id = getConst(PBMoves,:FAIRYWIND) || id
|
||||
when 4; id = getConst(PBMoves,:CONFUSION) || id
|
||||
when 5; id = getConst(PBMoves,:WATERPULSE) || id
|
||||
when 6; id = getConst(PBMoves,:MUDSHOT) || id
|
||||
when 7; id = getConst(PBMoves,:ROCKTHROW) || id
|
||||
when 8; id = getConst(PBMoves,:MUDSLAP) || id
|
||||
when 9; id = getConst(PBMoves,:ICESHARD) || id
|
||||
when 10; id = getConst(PBMoves,:INCINERATE) || id
|
||||
when 11; id = getConst(PBMoves,:SHADOWSNEAK) || id
|
||||
when 12; id = getConst(PBMoves,:GUST) || id
|
||||
when 13; id = getConst(PBMoves,:SWIFT) || id
|
||||
when 14; id = getConst(PBMoves,:PSYWAVE) || id
|
||||
when 1; id = :THUNDERSHOCK if GameData::Move.exists?(:THUNDERSHOCK)
|
||||
when 2; id = :VINEWHIP if GameData::Move.exists?(:VINEWHIP)
|
||||
when 3; id = :FAIRYWIND if GameData::Move.exists?(:FAIRYWIND)
|
||||
when 4; id = :CONFUSIO if GameData::Move.exists?(:CONFUSION)
|
||||
when 5; id = :WATERPULSE if GameData::Move.exists?(:WATERPULSE)
|
||||
when 6; id = :MUDSHOT if GameData::Move.exists?(:MUDSHOT)
|
||||
when 7; id = :ROCKTHROW if GameData::Move.exists?(:ROCKTHROW)
|
||||
when 8; id = :MUDSLAP if GameData::Move.exists?(:MUDSLAP)
|
||||
when 9; id = :ICESHARD if GameData::Move.exists?(:ICESHARD)
|
||||
when 10; id = :INCINERATE if GameData::Move.exists?(:INCINERATE)
|
||||
when 11; id = :SHADOWSNEAK if GameData::Move.exists?(:SHADOWSNEAK)
|
||||
when 12; id = :GUST if GameData::Move.exists?(:GUST)
|
||||
when 13; id = :SWIFT if GameData::Move.exists?(:SWIFT)
|
||||
when 14; id = :PSYWAVE if GameData::Move.exists?(:PSYWAVE)
|
||||
end
|
||||
super
|
||||
end
|
||||
@@ -1116,8 +1116,8 @@ class PokeBattle_Move_0AE < PokeBattle_Move
|
||||
def callsAnotherMove?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.lastRegularMoveUsed<=0 ||
|
||||
!pbGetMoveData(target.lastRegularMoveUsed,MoveData::FLAGS)[/e/] # Not copyable by Mirror Move
|
||||
if !target.lastRegularMoveUsed ||
|
||||
!GameData::Move.get(target.lastRegularMoveUsed).flags[/e/] # Not copyable by Mirror Move
|
||||
@battle.pbDisplay(_INTL("The mirror move failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1207,8 +1207,8 @@ class PokeBattle_Move_0AF < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.lastMoveUsed<=0 ||
|
||||
@moveBlacklist.include?(pbGetMoveData(@battle.lastMoveUsed,MoveData::FUNCTION_CODE))
|
||||
if !@battle.lastMoveUsed ||
|
||||
@moveBlacklist.include?(GameData::Move.get(@battle.lastMoveUsed).function_code)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1252,8 +1252,7 @@ class PokeBattle_Move_0B0 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
return true if pbMoveFailedTargetAlreadyMoved?(target)
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove || oppMove.id<=0 ||
|
||||
oppMove.statusMove? || @moveBlacklist.include?(oppMove.function)
|
||||
if !oppMove || oppMove.statusMove? || @moveBlacklist.include?(oppMove.function)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1311,71 +1310,71 @@ class PokeBattle_Move_0B3 < PokeBattle_Move
|
||||
# NOTE: It's possible in theory to not have the move Nature Power wants to
|
||||
# turn into, but what self-respecting game wouldn't at least have Tri
|
||||
# Attack in it?
|
||||
@npMove = getID(PBMoves,:TRIATTACK)
|
||||
@npMove = :TRIATTACK
|
||||
case @battle.field.terrain
|
||||
when PBBattleTerrains::Electric
|
||||
@npMove = getConst(PBMoves,:THUNDERBOLT) || @npMove
|
||||
@npMove = :THUNDERBOLT if GameData::Move.exists?(:THUNDERBOLT)
|
||||
when PBBattleTerrains::Grassy
|
||||
@npMove = getConst(PBMoves,:ENERGYBALL) || @npMove
|
||||
@npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL)
|
||||
when PBBattleTerrains::Misty
|
||||
@npMove = getConst(PBMoves,:MOONBLAST) || @npMove
|
||||
@npMove = :MOONBLAST if GameData::Move.exists?(:MOONBLAST)
|
||||
when PBBattleTerrains::Psychic
|
||||
@npMove = getConst(PBMoves,:PSYCHIC) || @npMove
|
||||
@npMove = :PSYCHIC if GameData::Move.exists?(:PSYCHIC)
|
||||
else
|
||||
case @battle.environment
|
||||
when PBEnvironment::Grass, PBEnvironment::TallGrass,
|
||||
PBEnvironment::Forest, PBEnvironment::ForestGrass
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
@npMove = getConst(PBMoves,:ENERGYBALL) || @npMove
|
||||
@npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL)
|
||||
else
|
||||
@npMove = getConst(PBMoves,:SEEDBOMB) || @npMove
|
||||
@npMove = :SEEDBOMB if GameData::Move.exists?(:SEEDBOMB)
|
||||
end
|
||||
when PBEnvironment::MovingWater, PBEnvironment::StillWater, PBEnvironment::Underwater
|
||||
@npMove = getConst(PBMoves,:HYDROPUMP) || @npMove
|
||||
@npMove = :HYDROPUMP if GameData::Move.exists?(:HYDROPUMP)
|
||||
when PBEnvironment::Puddle
|
||||
@npMove = getConst(PBMoves,:MUDBOMB) || @npMove
|
||||
@npMove = :MUDBOMB if GameData::Move.exists?(:MUDBOMB)
|
||||
when PBEnvironment::Cave
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
@npMove = getConst(PBMoves,:POWERGEM) || @npMove
|
||||
@npMove = :POWERGEM if GameData::Move.exists?(:POWERGEM)
|
||||
else
|
||||
@npMove = getConst(PBMoves,:ROCKSLIDE) || @npMove
|
||||
@npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE)
|
||||
end
|
||||
when PBEnvironment::Rock
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
@npMove = getConst(PBMoves,:EARTHPOWER) || @npMove
|
||||
@npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER)
|
||||
else
|
||||
@npMove = getConst(PBMoves,:ROCKSLIDE) || @npMove
|
||||
@npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE)
|
||||
end
|
||||
when PBEnvironment::Sand
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
@npMove = getConst(PBMoves,:EARTHPOWER) || @npMove
|
||||
@npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER)
|
||||
else
|
||||
@npMove = getConst(PBMoves,:EARTHQUAKE) || @npMove
|
||||
@npMove = :EARTHQUAKE if GameData::Move.exists?(:EARTHQUAKE)
|
||||
end
|
||||
# Ice tiles in Gen 6 should be Ice Beam
|
||||
when PBEnvironment::Snow, PBEnvironment::Ice
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
@npMove = getConst(PBMoves,:FROSTBREATH) || @npMove
|
||||
@npMove = :FROSTBREATH if GameData::Move.exists?(:FROSTBREATH)
|
||||
else
|
||||
@npMove = getConst(PBMoves,:ICEBEAM) || @npMove
|
||||
@npMove = :ICEBEAM if GameData::Move.exists?(:ICEBEAM)
|
||||
end
|
||||
when PBEnvironment::Volcano
|
||||
@npMove = getConst(PBMoves,:LAVAPLUME) || @npMove
|
||||
@npMove = :LAVAPLUME if GameData::Move.exists?(:LAVAPLUME)
|
||||
when PBEnvironment::Graveyard
|
||||
@npMove = getConst(PBMoves,:SHADOWBALL) || @npMove
|
||||
@npMove = :SHADOWBALL if GameData::Move.exists?(:SHADOWBALL)
|
||||
when PBEnvironment::Sky
|
||||
@npMove = getConst(PBMoves,:AIRSLASH) || @npMove
|
||||
@npMove = :AIRSLASH if GameData::Move.exists?(:AIRSLASH)
|
||||
when PBEnvironment::Space
|
||||
@npMove = getConst(PBMoves,:DRACOMETEOR) || @npMove
|
||||
@npMove = :DRACOMETEOR if GameData::Move.exists?(:DRACOMETEOR)
|
||||
when PBEnvironment::UltraSpace
|
||||
@npMove = getConst(PBMoves,:PSYSHOCK) || @npMove
|
||||
@npMove = :PSYSHOCK if GameData::Move.exists?(:PSYSHOCK)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
@battle.pbDisplay(_INTL("{1} turned into {2}!",@name,PBMoves.getName(@npMove)))
|
||||
user.pbUseMoveSimple(@npMove,target.index)
|
||||
@battle.pbDisplay(_INTL("{1} turned into {2}!", @name, GameData::Move.get(@npMove).name))
|
||||
user.pbUseMoveSimple(@npMove, target.index)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1551,8 +1550,7 @@ class PokeBattle_Move_0B5 < PokeBattle_Move
|
||||
next if !pkmn || i==user.pokemonIndex
|
||||
next if NEWEST_BATTLE_MECHANICS && pkmn.egg?
|
||||
pkmn.moves.each do |move|
|
||||
next if !move || move.id<=0
|
||||
next if @moveBlacklist.include?(pbGetMoveData(move.id,MoveData::FUNCTION_CODE))
|
||||
next if @moveBlacklist.include?(move.function_code)
|
||||
next if isConst?(move.type,PBTypes,:SHADOW)
|
||||
@assistMoves.push(move.id)
|
||||
end
|
||||
@@ -1663,25 +1661,20 @@ class PokeBattle_Move_0B6 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
movesData = pbLoadMovesData
|
||||
@metronomeMove = 0
|
||||
@metronomeMove = nil
|
||||
move_keys = GameData::Move::DATA.keys.sort
|
||||
# NOTE: You could be really unlucky and roll blacklisted moves 1000 times in
|
||||
# a row. This is too unlikely to care about, though.
|
||||
1000.times do
|
||||
move = @battle.pbRandom(PBMoves.maxValue)+1 # Random move
|
||||
next if !movesData[move]
|
||||
next if @moveBlacklist.include?(movesData[move][MoveData::FUNCTION_CODE])
|
||||
blMove = false
|
||||
@moveBlacklistSignatures.each do |m|
|
||||
next if !isConst?(move,PBMoves,m)
|
||||
blMove = true; break
|
||||
end
|
||||
next if blMove
|
||||
next if isConst?(movesData[move][MoveData::TYPE],PBTypes,:SHADOW)
|
||||
@metronomeMove = move
|
||||
move_id = move_keys[@battle.pbRandom(move_keys.length)]
|
||||
move_data = GameData::Move.get(move_id)
|
||||
next if @moveBlacklist.include?(move_data.function_code)
|
||||
next if @moveBlacklistSignatures.include?(move_data.id)
|
||||
next if isConst?(move_data.type, PBTypes, :SHADOW)
|
||||
@metronomeMove = move_data.id
|
||||
break
|
||||
end
|
||||
if @metronomeMove<=0
|
||||
if !@metronomeMove
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1746,7 +1739,7 @@ class PokeBattle_Move_0B9 < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.effects[PBEffects::Disable]>0
|
||||
if target.effects[PBEffects::Disable]>0 || !target.lastRegularMoveUsed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1754,7 +1747,7 @@ class PokeBattle_Move_0B9 < PokeBattle_Move
|
||||
canDisable = false
|
||||
target.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
next if m.pp==0 && m.totalpp>0
|
||||
next if m.pp==0 && m.total_pp>0
|
||||
canDisable = true
|
||||
break
|
||||
end
|
||||
@@ -1769,7 +1762,7 @@ class PokeBattle_Move_0B9 < PokeBattle_Move
|
||||
target.effects[PBEffects::Disable] = 5
|
||||
target.effects[PBEffects::DisableMove] = target.lastRegularMoveUsed
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!",target.pbThis,
|
||||
PBMoves.getName(target.lastRegularMoveUsed)))
|
||||
GameData::Move.get(target.lastRegularMoveUsed).name))
|
||||
target.pbItemStatusCureCheck
|
||||
end
|
||||
end
|
||||
@@ -1872,8 +1865,8 @@ class PokeBattle_Move_0BC < PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
if target.lastRegularMoveUsed<=0 ||
|
||||
@moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MoveData::FUNCTION_CODE))
|
||||
if !target.lastRegularMoveUsed ||
|
||||
@moveBlacklist.include?(GameData::Move.get(target.lastRegularMoveUsed).function_code)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1885,7 +1878,7 @@ class PokeBattle_Move_0BC < PokeBattle_Move
|
||||
canEncore = false
|
||||
target.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
next if m.pp==0 && m.totalpp>0
|
||||
next if m.pp==0 && m.total_pp>0
|
||||
canEncore = true
|
||||
break
|
||||
end
|
||||
@@ -1958,8 +1951,7 @@ class PokeBattle_Move_0C0 < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
|
||||
def pbNumHits(user,targets)
|
||||
if isConst?(@id,PBMoves,:WATERSHURIKEN) &&
|
||||
user.isSpecies?(:GRENINJA) && user.form==2
|
||||
if @id == :WATERSHURIKEN && user.isSpecies?(:GRENINJA) && user.form == 2
|
||||
return 3
|
||||
end
|
||||
hitChances = [2,2,3,3,4,5]
|
||||
@@ -1969,8 +1961,7 @@ class PokeBattle_Move_0C0 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
if isConst?(@id,PBMoves,:WATERSHURIKEN) &&
|
||||
user.isSpecies?(:GRENINJA) && user.form==2
|
||||
if @id == :WATERSHURIKEN && user.isSpecies?(:GRENINJA) && user.form == 2
|
||||
return 20
|
||||
end
|
||||
return super
|
||||
@@ -2044,7 +2035,7 @@ end
|
||||
class PokeBattle_Move_0C4 < PokeBattle_TwoTurnMove
|
||||
def pbIsChargingTurn?(user)
|
||||
ret = super
|
||||
if user.effects[PBEffects::TwoTurnAttack]==0
|
||||
if !user.effects[PBEffects::TwoTurnAttack]
|
||||
w = @battle.pbWeather
|
||||
if w==PBWeather::Sun || w==PBWeather::HarshSun
|
||||
@powerHerb = false
|
||||
@@ -2234,8 +2225,8 @@ class PokeBattle_Move_0CE < PokeBattle_TwoTurnMove
|
||||
# NOTE: Sky Drop doesn't benefit from Power Herb, probably because it works
|
||||
# differently (i.e. immobilises the target during use too).
|
||||
@powerHerb = false
|
||||
@chargingTurn = (user.effects[PBEffects::TwoTurnAttack]==0)
|
||||
@damagingTurn = (user.effects[PBEffects::TwoTurnAttack]!=0)
|
||||
@chargingTurn = (user.effects[PBEffects::TwoTurnAttack].nil?)
|
||||
@damagingTurn = (!user.effects[PBEffects::TwoTurnAttack].nil?)
|
||||
return !@damagingTurn
|
||||
end
|
||||
|
||||
@@ -2306,21 +2297,22 @@ class PokeBattle_Move_0CF < PokeBattle_Move
|
||||
target.effects[PBEffects::TrappingUser] = user.index
|
||||
# Message
|
||||
msg = _INTL("{1} was trapped in the vortex!",target.pbThis)
|
||||
if isConst?(@id,PBMoves,:BIND)
|
||||
case @id
|
||||
when :BIND
|
||||
msg = _INTL("{1} was squeezed by {2}!",target.pbThis,user.pbThis(true))
|
||||
elsif isConst?(@id,PBMoves,:CLAMP)
|
||||
when :CLAMP
|
||||
msg = _INTL("{1} clamped {2}!",user.pbThis,target.pbThis(true))
|
||||
elsif isConst?(@id,PBMoves,:FIRESPIN)
|
||||
when :FIRESPIN
|
||||
msg = _INTL("{1} was trapped in the fiery vortex!",target.pbThis)
|
||||
elsif isConst?(@id,PBMoves,:INFESTATION)
|
||||
when :INFESTATION
|
||||
msg = _INTL("{1} has been afflicted with an infestation by {2}!",target.pbThis,user.pbThis(true))
|
||||
elsif isConst?(@id,PBMoves,:MAGMASTORM)
|
||||
when :MAGMASTORM
|
||||
msg = _INTL("{1} became trapped by Magma Storm!",target.pbThis)
|
||||
elsif isConst?(@id,PBMoves,:SANDTOMB)
|
||||
when :SANDTOMB
|
||||
msg = _INTL("{1} became trapped by Sand Tomb!",target.pbThis)
|
||||
elsif isConst?(@id,PBMoves,:WHIRLPOOL)
|
||||
when :WHIRLPOOL
|
||||
msg = _INTL("{1} became trapped in the vortex!",target.pbThis)
|
||||
elsif isConst?(@id,PBMoves,:WRAP)
|
||||
when :WRAP
|
||||
msg = _INTL("{1} was wrapped by {2}!",target.pbThis,user.pbThis(true))
|
||||
end
|
||||
@battle.pbDisplay(msg)
|
||||
@@ -3282,10 +3274,10 @@ class PokeBattle_Move_0F2 < PokeBattle_Move
|
||||
oldUserItem = user.item; oldUserItemName = user.itemName
|
||||
oldTargetItem = target.item; oldTargetItemName = target.itemName
|
||||
user.item = oldTargetItem
|
||||
user.effects[PBEffects::ChoiceBand] = -1
|
||||
user.effects[PBEffects::ChoiceBand] = nil
|
||||
user.effects[PBEffects::Unburden] = (!user.item && oldUserItem)
|
||||
target.item = oldUserItem
|
||||
target.effects[PBEffects::ChoiceBand] = -1
|
||||
target.effects[PBEffects::ChoiceBand] = nil
|
||||
target.effects[PBEffects::Unburden] = (!target.item && oldTargetItem)
|
||||
# Permanently steal the item from wild Pokémon
|
||||
if @battle.wildBattle? && target.opposes? &&
|
||||
|
||||
@@ -107,8 +107,8 @@ class PokeBattle_Move_106 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["107",:SeaOfFire,getConst(PBTypes,:FIRE),getConst(PBMoves,:FIREPLEDGE)],
|
||||
["108",:Swamp,nil,nil]]
|
||||
@combos = [["107", :SeaOfFire, getConst(PBTypes, :FIRE), :FIREPLEDGE],
|
||||
["108", :Swamp, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,8 +123,8 @@ class PokeBattle_Move_107 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["108",:Rainbow,getConst(PBTypes,:WATER),getConst(PBMoves,:WATERPLEDGE)],
|
||||
["106",:SeaOfFire,nil,nil]]
|
||||
@combos = [["108", :Rainbow, getConst(PBTypes, :WATER), :WATERPLEDGE],
|
||||
["106", :SeaOfFire, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,8 +139,8 @@ class PokeBattle_Move_108 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["106",:Swamp,getConst(PBTypes,:GRASS),getConst(PBMoves,:GRASSPLEDGE)],
|
||||
["107",:Rainbow,nil,nil]]
|
||||
@combos = [["106", :Swamp, getConst(PBTypes, :GRASS), :GRASSPLEDGE],
|
||||
["107", :Rainbow, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -243,7 +243,7 @@ class PokeBattle_Move_10C < PokeBattle_Move
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::Trapping] = 0
|
||||
user.effects[PBEffects::TrappingMove] = 0
|
||||
user.effects[PBEffects::TrappingMove] = nil
|
||||
user.effects[PBEffects::Substitute] = @subLife
|
||||
@battle.pbDisplay(_INTL("{1} put in a substitute!",user.pbThis))
|
||||
end
|
||||
@@ -326,9 +326,11 @@ class PokeBattle_Move_10E < PokeBattle_Move
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
failed = true
|
||||
target.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed || m.pp==0 || m.totalpp<=0
|
||||
failed = false; break
|
||||
if target.lastRegularMoveUsed
|
||||
target.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed || m.pp==0 || m.total_pp<=0
|
||||
failed = false; break
|
||||
end
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
@@ -379,11 +381,11 @@ class PokeBattle_Move_110 < PokeBattle_Move
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
return if user.fainted? || target.damageState.unaffected
|
||||
if user.effects[PBEffects::Trapping]>0
|
||||
trapMove = PBMoves.getName(user.effects[PBEffects::TrappingMove])
|
||||
trapMove = GameData::Move.get(user.effects[PBEffects::TrappingMove]).name
|
||||
trapUser = @battle.battlers[user.effects[PBEffects::TrappingUser]]
|
||||
@battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",user.pbThis,trapUser.pbThis(true),trapMove))
|
||||
user.effects[PBEffects::Trapping] = 0
|
||||
user.effects[PBEffects::TrappingMove] = 0
|
||||
user.effects[PBEffects::TrappingMove] = nil
|
||||
user.effects[PBEffects::TrappingUser] = -1
|
||||
end
|
||||
if user.effects[PBEffects::LeechSeed]>=0
|
||||
@@ -447,7 +449,7 @@ class PokeBattle_Move_111 < PokeBattle_Move
|
||||
effects[PBEffects::FutureSightMove] = @id
|
||||
effects[PBEffects::FutureSightUserIndex] = user.index
|
||||
effects[PBEffects::FutureSightUserPartyIndex] = user.pokemonIndex
|
||||
if isConst?(@id,PBMoves,:DOOMDESIRE)
|
||||
if @id == :DOOMDESIRE
|
||||
@battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",user.pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} foresaw an attack!",user.pbThis))
|
||||
@@ -624,7 +626,7 @@ class PokeBattle_Move_116 < PokeBattle_Move
|
||||
return true
|
||||
end
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove || oppMove.id<=0 ||
|
||||
if !oppMove ||
|
||||
(oppMove.function!="0B0" && # Me First
|
||||
(target.movedThisRound? || oppMove.statusMove?))
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
@@ -647,7 +649,7 @@ class PokeBattle_Move_117 < PokeBattle_Move
|
||||
next if b.effects[PBEffects::FollowMe]<user.effects[PBEffects::FollowMe]
|
||||
user.effects[PBEffects::FollowMe] = b.effects[PBEffects::FollowMe]+1
|
||||
end
|
||||
user.effects[PBEffects::RagePowder] = true if isConst?(@id,PBMoves,:RAGEPOWDER)
|
||||
user.effects[PBEffects::RagePowder] = true if @id == :RAGEPOWDER
|
||||
@battle.pbDisplay(_INTL("{1} became the center of attention!",user.pbThis))
|
||||
end
|
||||
end
|
||||
@@ -673,7 +675,7 @@ class PokeBattle_Move_118 < PokeBattle_Move
|
||||
@battle.eachBattler do |b|
|
||||
showMessage = false
|
||||
if b.inTwoTurnAttack?("0C9","0CC","0CE") # Fly/Bounce/Sky Drop
|
||||
b.effects[PBEffects::TwoTurnAttack] = 0
|
||||
b.effects[PBEffects::TwoTurnAttack] = nil
|
||||
@battle.pbClearChoice(b.index) if !b.movedThisRound?
|
||||
showMessage = true
|
||||
end
|
||||
@@ -778,7 +780,7 @@ class PokeBattle_Move_11C < PokeBattle_Move
|
||||
return if !target.airborne? && !target.inTwoTurnAttack?("0C9","0CC") # Fly/Bounce
|
||||
target.effects[PBEffects::SmackDown] = true
|
||||
if target.inTwoTurnAttack?("0C9","0CC") # Fly/Bounce. NOTE: Not Sky Drop.
|
||||
target.effects[PBEffects::TwoTurnAttack] = 0
|
||||
target.effects[PBEffects::TwoTurnAttack] = nil
|
||||
@battle.pbClearChoice(target.index) if !target.movedThisRound?
|
||||
end
|
||||
target.effects[PBEffects::MagnetRise] = 0
|
||||
@@ -805,7 +807,7 @@ class PokeBattle_Move_11D < PokeBattle_Move
|
||||
end
|
||||
# Target didn't choose to use a move this round
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove || oppMove.id<=0
|
||||
if !oppMove
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -829,7 +831,7 @@ class PokeBattle_Move_11E < PokeBattle_Move
|
||||
return true if pbMoveFailedTargetAlreadyMoved?(target)
|
||||
# Target isn't going to use a move
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove || oppMove.id<=0
|
||||
if !oppMove
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1636,7 +1638,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_14E < PokeBattle_TwoTurnMove
|
||||
def pbMoveFailed?(user,targets)
|
||||
return false if user.effects[PBEffects::TwoTurnAttack]>0 # Charging turn
|
||||
return false if user.effects[PBEffects::TwoTurnAttack] # Charging turn
|
||||
if !user.pbCanRaiseStatStage?(PBStats::SPATK,user,self) &&
|
||||
!user.pbCanRaiseStatStage?(PBStats::SPDEF,user,self) &&
|
||||
!user.pbCanRaiseStatStage?(PBStats::SPEED,user,self)
|
||||
@@ -2327,7 +2329,7 @@ class PokeBattle_Move_16B < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.lastRegularMoveUsed<0 || !target.pbHasMove?(target.lastRegularMoveUsed)
|
||||
if !target.lastRegularMoveUsed || !target.pbHasMove?(target.lastRegularMoveUsed)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2342,7 +2344,7 @@ class PokeBattle_Move_16B < PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
if @moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MoveData::FUNCTION_CODE))
|
||||
if @moveBlacklist.include?(GameData::Move.get(target.lastRegularMoveUsed).function_code)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2350,7 +2352,7 @@ class PokeBattle_Move_16B < PokeBattle_Move
|
||||
target.eachMoveWithIndex do |m,i|
|
||||
idxMove = i if m.id==target.lastRegularMoveUsed
|
||||
end
|
||||
if target.moves[idxMove].pp==0 && target.moves[idxMove].totalpp>0
|
||||
if target.moves[idxMove].pp==0 && target.moves[idxMove].total_pp>0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -152,7 +152,7 @@ class PokeBattle_Battle
|
||||
@battleBond = [Array.new(@party1.length, false), Array.new(@party2.length, false)]
|
||||
@usedInBattle = [Array.new(@party1.length, false), Array.new(@party2.length, false)]
|
||||
@successStates = []
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUser = -1
|
||||
@switching = false
|
||||
@futureSight = false
|
||||
@@ -160,8 +160,8 @@ class PokeBattle_Battle
|
||||
@moldBreaker = false
|
||||
@runCommand = 0
|
||||
@nextPickupUse = 0
|
||||
if hasConst?(PBMoves,:STRUGGLE)
|
||||
@struggle = PokeBattle_Move.pbFromPBMove(self,PBMove.new(getConst(PBMoves,:STRUGGLE)))
|
||||
if GameData::Move.exists?(:STRUGGLE)
|
||||
@struggle = PokeBattle_Move.pbFromPBMove(self,PBMove.new(:STRUGGLE))
|
||||
else
|
||||
@struggle = PokeBattle_Struggle.new(self,nil)
|
||||
end
|
||||
|
||||
@@ -222,11 +222,11 @@ class PokeBattle_Battle
|
||||
return if !pkmn
|
||||
pkmnName = pkmn.name
|
||||
battler = pbFindBattler(idxParty)
|
||||
moveName = PBMoves.getName(newMove)
|
||||
moveName = GameData::Move.get(newMove).name
|
||||
# Find a space for the new move in pkmn's moveset and learn it
|
||||
pkmn.moves.each_with_index do |m,i|
|
||||
return if m.id==newMove # Already knows the new move
|
||||
next if m.id!=0 # Not a blank move slot
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
m = pkmn.moves[i]
|
||||
return if m && m.id==newMove # Already knows the new move
|
||||
pkmn.moves[i] = PBMove.new(newMove)
|
||||
battler.moves[i] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[i]) if battler
|
||||
pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") }
|
||||
@@ -240,7 +240,7 @@ class PokeBattle_Battle
|
||||
pbDisplayPaused(_INTL("Which move should be forgotten?"))
|
||||
forgetMove = @scene.pbForgetMove(pkmn,newMove)
|
||||
if forgetMove>=0
|
||||
oldMoveName = PBMoves.getName(pkmn.moves[forgetMove].id)
|
||||
oldMoveName = pkmn.moves[forgetMove].name
|
||||
pkmn.moves[forgetMove] = PBMove.new(newMove) # Replaces current/total PP
|
||||
battler.moves[forgetMove] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[forgetMove]) if battler
|
||||
pbDisplayPaused(_INTL("1, 2, and... ... ... Ta-da!"))
|
||||
|
||||
@@ -5,8 +5,8 @@ class PokeBattle_Battle
|
||||
def pbCanChooseMove?(idxBattler,idxMove,showMessages,sleepTalk=false)
|
||||
battler = @battlers[idxBattler]
|
||||
move = battler.moves[idxMove]
|
||||
return false unless move && move.id>0
|
||||
if move.pp==0 && move.totalpp>0 && !sleepTalk
|
||||
return false unless move
|
||||
if move.pp==0 && move.total_pp>0 && !sleepTalk
|
||||
pbDisplayPaused(_INTL("There's no PP left for this move!")) if showMessages
|
||||
return false
|
||||
end
|
||||
@@ -20,7 +20,7 @@ class PokeBattle_Battle
|
||||
def pbCanChooseAnyMove?(idxBattler,sleepTalk=false)
|
||||
battler = @battlers[idxBattler]
|
||||
battler.eachMoveWithIndex do |m,i|
|
||||
next if m.pp==0 && m.totalpp>0 && !sleepTalk
|
||||
next if m.pp==0 && m.total_pp>0 && !sleepTalk
|
||||
if battler.effects[PBEffects::Encore]>0
|
||||
idxEncoredMove = battler.pbEncoredMoveIndex
|
||||
next if idxEncoredMove>=0 && i!=idxEncoredMove
|
||||
@@ -80,10 +80,8 @@ class PokeBattle_Battle
|
||||
|
||||
def pbChoseMove?(idxBattler,moveID)
|
||||
return false if !@battlers[idxBattler] || @battlers[idxBattler].fainted?
|
||||
idxMove = @choices[idxBattler][1]
|
||||
if @choices[idxBattler][0]==:UseMove && idxMove>=0
|
||||
chosenMoveID = @battlers[idxBattler].moves[idxMove].id
|
||||
return isConst?(chosenMoveID,PBMoves,moveID)
|
||||
if @choices[idxBattler][0]==:UseMove && @choices[idxBattler][1]
|
||||
return @choices[idxBattler][2].id == moveID
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -91,8 +89,8 @@ class PokeBattle_Battle
|
||||
def pbChoseMoveFunctionCode?(idxBattler,code)
|
||||
return false if @battlers[idxBattler].fainted?
|
||||
idxMove = @choices[idxBattler][1]
|
||||
if @choices[idxBattler][0]==:UseMove && idxMove>=0
|
||||
return @battlers[idxBattler].moves[idxMove].function==code
|
||||
if @choices[idxBattler][0]==:UseMove && @choices[idxBattler][1]
|
||||
return @choices[idxBattler][2].function == code
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -342,7 +342,7 @@ class PokeBattle_Battle
|
||||
pbDisplay(_INTL("{1} became cloaked in mystical moonlight!",battler.pbThis))
|
||||
battler.pbRecoverHP(battler.totalhp)
|
||||
battler.pbCureStatus(false)
|
||||
battler.eachMove { |m| m.pp = m.totalpp }
|
||||
battler.eachMove { |m| m.pp = m.total_pp }
|
||||
@positions[battler.index].effects[PBEffects::LunarDance] = false
|
||||
end
|
||||
# Entry hazards
|
||||
|
||||
@@ -76,7 +76,7 @@ class PokeBattle_Battle
|
||||
ret = true
|
||||
else # Chose a move to use
|
||||
next false if cmd<0 || !@battlers[idxBattler].moves[cmd] ||
|
||||
@battlers[idxBattler].moves[cmd].id<=0
|
||||
!@battlers[idxBattler].moves[cmd].id
|
||||
next false if !pbRegisterMove(idxBattler,cmd)
|
||||
next false if !singleBattle? &&
|
||||
!pbChooseTarget(@battlers[idxBattler],@battlers[idxBattler].moves[cmd])
|
||||
|
||||
@@ -234,7 +234,8 @@ class PokeBattle_Battle
|
||||
end
|
||||
next if !moveUser # User is fainted
|
||||
move = pos.effects[PBEffects::FutureSightMove]
|
||||
pbDisplay(_INTL("{1} took the {2} attack!",@battlers[idxPos].pbThis,PBMoves.getName(move)))
|
||||
pbDisplay(_INTL("{1} took the {2} attack!",@battlers[idxPos].pbThis,
|
||||
GameData::Move.get(move).name))
|
||||
# NOTE: Future Sight failing against the target here doesn't count towards
|
||||
# Stomping Tantrum.
|
||||
userLastMoveFailed = moveUser.lastMoveFailed
|
||||
@@ -244,7 +245,7 @@ class PokeBattle_Battle
|
||||
moveUser.lastMoveFailed = userLastMoveFailed
|
||||
@battlers[idxPos].pbFaint if @battlers[idxPos].fainted?
|
||||
pos.effects[PBEffects::FutureSightCounter] = 0
|
||||
pos.effects[PBEffects::FutureSightMove] = 0
|
||||
pos.effects[PBEffects::FutureSightMove] = nil
|
||||
pos.effects[PBEffects::FutureSightUserIndex] = -1
|
||||
pos.effects[PBEffects::FutureSightUserPartyIndex] = -1
|
||||
end
|
||||
@@ -401,19 +402,19 @@ class PokeBattle_Battle
|
||||
priority.each do |b|
|
||||
next if b.fainted? || b.effects[PBEffects::Trapping]==0
|
||||
b.effects[PBEffects::Trapping] -= 1
|
||||
moveName = PBMoves.getName(b.effects[PBEffects::TrappingMove])
|
||||
moveName = GameData::Move.get(b.effects[PBEffects::TrappingMove]).name
|
||||
if b.effects[PBEffects::Trapping]==0
|
||||
pbDisplay(_INTL("{1} was freed from {2}!",b.pbThis,moveName))
|
||||
else
|
||||
trappingMove = b.effects[PBEffects::TrappingMove]
|
||||
if isConst?(trappingMove,PBMoves,:BIND); pbCommonAnimation("Bind",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:CLAMP); pbCommonAnimation("Clamp",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:FIRESPIN); pbCommonAnimation("FireSpin",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:MAGMASTORM); pbCommonAnimation("MagmaStorm",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:SANDTOMB); pbCommonAnimation("SandTomb",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:WRAP); pbCommonAnimation("Wrap",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:INFESTATION); pbCommonAnimation("Infestation",b)
|
||||
else; pbCommonAnimation("Wrap",b)
|
||||
case b.effects[PBEffects::TrappingMove]
|
||||
when :BIND then pbCommonAnimation("Bind", b)
|
||||
when :CLAMP then pbCommonAnimation("Clamp", b)
|
||||
when :FIRESPIN then pbCommonAnimation("FireSpin", b)
|
||||
when :MAGMASTORM then pbCommonAnimation("MagmaStorm", b)
|
||||
when :SANDTOMB then pbCommonAnimation("SandTomb", b)
|
||||
when :WRAP then pbCommonAnimation("Wrap", b)
|
||||
when :INFESTATION then pbCommonAnimation("Infestation", b)
|
||||
else pbCommonAnimation("Wrap", b)
|
||||
end
|
||||
if b.takesIndirectDamage?
|
||||
hpLoss = (NEWEST_BATTLE_MECHANICS) ? b.totalhp/8 : b.totalhp/16
|
||||
@@ -446,12 +447,12 @@ class PokeBattle_Battle
|
||||
else
|
||||
PBDebug.log("[End of effect] #{b.pbThis}'s encore ended (encored move no longer known)")
|
||||
b.effects[PBEffects::Encore] = 0
|
||||
b.effects[PBEffects::EncoreMove] = 0
|
||||
b.effects[PBEffects::EncoreMove] = nil
|
||||
end
|
||||
end
|
||||
# Disable/Cursed Body
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::Disable) { |battler|
|
||||
battler.effects[PBEffects::DisableMove] = 0
|
||||
battler.effects[PBEffects::DisableMove] = nil
|
||||
pbDisplay(_INTL("{1} is no longer disabled!",battler.pbThis))
|
||||
}
|
||||
# Magnet Rise
|
||||
|
||||
@@ -17,14 +17,14 @@ class PokeBattle_AI
|
||||
# super-effective and powerful
|
||||
if !shouldSwitch && battler.turnCount>0 && skill>=PBTrainerAI.highSkill
|
||||
target = battler.pbDirectOpposing(true)
|
||||
if !target.fainted? && target.lastMoveUsed>0 &&
|
||||
if !target.fainted? && target.lastMoveUsed &&
|
||||
(target.level-battler.level).abs<=6
|
||||
moveData = pbGetMoveData(target.lastMoveUsed)
|
||||
moveType = moveData[MoveData::TYPE]
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
moveType = moveData.type
|
||||
typeMod = pbCalcTypeMod(moveType,target,battler)
|
||||
if PBTypes.superEffective?(typeMod) && moveData[MoveData::BASE_DAMAGE]>50
|
||||
switchChance = (moveData[MoveData::BASE_DAMAGE]>70) ? 30 : 20
|
||||
shouldSwitch = (pbAIRandom(100)<switchChance)
|
||||
if PBTypes.superEffective?(typeMod) && moveData.base_damage > 50
|
||||
switchChance = (moveData.base_damage > 70) ? 30 : 20
|
||||
shouldSwitch = (pbAIRandom(100) < switchChance)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -158,18 +158,14 @@ class PokeBattle_AI
|
||||
return -1 if !enemies || enemies.length==0
|
||||
best = -1
|
||||
bestSum = 0
|
||||
movesData = pbLoadMovesData
|
||||
enemies.each do |i|
|
||||
pkmn = party[i]
|
||||
sum = 0
|
||||
pkmn.moves.each do |m|
|
||||
next if m.id==0
|
||||
moveData = movesData[m.id]
|
||||
next if moveData[MoveData::BASE_DAMAGE]==0
|
||||
next if m.base_damage == 0
|
||||
@battle.battlers[idxBattler].eachOpposing do |b|
|
||||
bTypes = b.pbTypes(true)
|
||||
sum += PBTypes.getCombinedEffectiveness(moveData[MoveData::TYPE],
|
||||
bTypes[0],bTypes[1],bTypes[2])
|
||||
sum += PBTypes.getCombinedEffectiveness(m.type, bTypes[0], bTypes[1], bTypes[2])
|
||||
end
|
||||
end
|
||||
if best==-1 || sum>bestSum
|
||||
|
||||
@@ -105,7 +105,7 @@ class PokeBattle_AI
|
||||
end
|
||||
# Log the result
|
||||
if @battle.choices[idxBattler][2]
|
||||
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) will use #{@battle.choices[user.index][2].name}")
|
||||
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) will use #{@battle.choices[idxBattler][2].name}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class PokeBattle_AI
|
||||
when "007", "008", "009", "0C5"
|
||||
if target.pbCanParalyze?(user,false) &&
|
||||
!(skill>=PBTrainerAI.mediumSkill &&
|
||||
isConst?(move.id,PBMoves,:THUNDERWAVE) &&
|
||||
move.id == :THUNDERWAVE &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
score += 30
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
@@ -1275,17 +1275,19 @@ class PokeBattle_AI
|
||||
"05D", # Sketch
|
||||
"0B6" # Metronome
|
||||
]
|
||||
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if user.effects[PBEffects::Transform] ||
|
||||
target.lastRegularMoveUsed<=0 ||
|
||||
moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
|
||||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
|
||||
if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
break
|
||||
else
|
||||
lastMoveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m != target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
break
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "05D"
|
||||
@@ -1294,17 +1296,19 @@ class PokeBattle_AI
|
||||
"014", # Chatter
|
||||
"05D" # Sketch
|
||||
]
|
||||
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if user.effects[PBEffects::Transform] ||
|
||||
target.lastRegularMoveUsed<=0 ||
|
||||
moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
|
||||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
|
||||
if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
score -= 90 # User already knows the move that will be Sketched
|
||||
break
|
||||
else
|
||||
lastMoveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m != target.lastRegularMoveUsed
|
||||
score -= 90 # User already knows the move that will be Sketched
|
||||
break
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "05E"
|
||||
@@ -1324,8 +1328,8 @@ class PokeBattle_AI
|
||||
when "05F"
|
||||
if user.ability == :MULTITYPE || user.ability == :RKSSYSTEM
|
||||
score -= 90
|
||||
elsif target.lastMoveUsed<=0 ||
|
||||
PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MoveData::TYPE))
|
||||
elsif !target.lastMoveUsed ||
|
||||
PBTypes.isPseudoType?(GameData::Move.get(target.lastMoveUsed).type)
|
||||
score -= 90
|
||||
else
|
||||
aType = -1
|
||||
@@ -1507,11 +1511,11 @@ class PokeBattle_AI
|
||||
spatk = pbRoughStat(user,PBStats::SPATK,skill)
|
||||
if attack*1.5<spatk
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0
|
||||
moveData = pbGetMoveData(target.lastMoveUsed)
|
||||
if moveData[MoveData::BASE_DAMAGE]>0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==0) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData[MoveData::TYPE]))
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData.category == 0) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
end
|
||||
@@ -1525,11 +1529,11 @@ class PokeBattle_AI
|
||||
spatk = pbRoughStat(user,PBStats::SPATK,skill)
|
||||
if attack>spatk*1.5
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0
|
||||
moveData = pbGetMoveData(target.lastMoveUsed)
|
||||
if moveData[MoveData::BASE_DAMAGE]>0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==1) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData[MoveData::TYPE]))
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData.caegory == 1) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
end
|
||||
@@ -1709,7 +1713,7 @@ class PokeBattle_AI
|
||||
score -= user.effects[PBEffects::ProtectRate]*40
|
||||
end
|
||||
score += 50 if user.turnCount==0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "0AB"
|
||||
@@ -1721,8 +1725,8 @@ class PokeBattle_AI
|
||||
when "0AE"
|
||||
score -= 40
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
score -= 100 if target.lastRegularMoveUsed<=0 ||
|
||||
!pbGetMoveData(target.lastRegularMoveUsed,MoveData::FLAGS)[/e/] # Not copyable by Mirror Move
|
||||
score -= 100 if !target.lastRegularMoveUsed ||
|
||||
!GameData::Move.get(target.lastRegularMoveUsed).flags[/e/] # Not copyable by Mirror Move
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "0AF"
|
||||
@@ -1767,17 +1771,16 @@ class PokeBattle_AI
|
||||
if target.effects[PBEffects::Encore]>0
|
||||
score -= 90
|
||||
elsif aspeed>ospeed
|
||||
if target.lastMoveUsed<=0
|
||||
if !target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
else
|
||||
moveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if moveData[MoveData::CATEGORY]==2 && # Status move
|
||||
(moveData[MoveData::TARGET]==PBTargets::User ||
|
||||
moveData[MoveData::TARGET]==PBTargets::BothSides)
|
||||
moveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveData.category == 2 && # Status move
|
||||
[PBTargets::User, PBTargets::BothSides].include?(moveData.target)
|
||||
score += 60
|
||||
elsif moveData[MoveData::CATEGORY]!=2 && # Damaging move
|
||||
moveData[MoveData::TARGET]==PBTargets::NearOther &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(moveData[MoveData::TYPE],target,user))
|
||||
elsif moveData.category != 2 && # Damaging move
|
||||
moveData.target == PBTargets::NearOther &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
score += 60
|
||||
end
|
||||
end
|
||||
@@ -2054,7 +2057,8 @@ class PokeBattle_AI
|
||||
:CHOICEBAND,:CHOICESCARF,:CHOICESPECS])
|
||||
score += 50
|
||||
elsif !user.item && target.item
|
||||
score -= 30 if pbGetMoveData(user.lastMoveUsed,MoveData::FUNCTION_CODE)=="0F2" # Trick/Switcheroo
|
||||
score -= 30 if user.lastMoveUsed &&
|
||||
GameData::Move.get(user.lastMoveUsed).function_code == "0F2" # Trick/Switcheroo
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "0F3"
|
||||
@@ -2712,7 +2716,7 @@ class PokeBattle_AI
|
||||
score -= user.effects[PBEffects::ProtectRate]*40
|
||||
end
|
||||
score += 50 if user.turnCount==0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "14D"
|
||||
@@ -2924,7 +2928,7 @@ class PokeBattle_AI
|
||||
score -= user.effects[PBEffects::ProtectRate]*40
|
||||
end
|
||||
score += 50 if user.turnCount==0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]
|
||||
score += 20 # Because of possible poisoning
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -2940,7 +2944,7 @@ class PokeBattle_AI
|
||||
#---------------------------------------------------------------------------
|
||||
when "16B"
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if target.lastRegularMoveUsed<0 ||
|
||||
if !target.lastRegularMoveUsed ||
|
||||
!target.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
target.usingMultiTurnAttack?
|
||||
score -= 90
|
||||
|
||||
@@ -287,7 +287,7 @@ class PokeBattle_AI
|
||||
abilityBlacklist = [:ANALYTIC,:SNIPER,:TINTEDLENS,:AERILATE,:PIXILATE,:REFRIGERATE]
|
||||
canCheck = true
|
||||
abilityBlacklist.each do |m|
|
||||
next if !isConst?(move.id,PBMoves,m)
|
||||
next if move.id != m
|
||||
canCheck = false
|
||||
break
|
||||
end
|
||||
@@ -309,7 +309,7 @@ class PokeBattle_AI
|
||||
abilityBlacklist = [:FILTER,:SOLIDROCK]
|
||||
canCheck = true
|
||||
abilityBlacklist.each do |m|
|
||||
next if !isConst?(move.id,PBMoves,m)
|
||||
next if move.id != m
|
||||
canCheck = false
|
||||
break
|
||||
end
|
||||
|
||||
@@ -179,7 +179,7 @@ class CommandMenuDisplay < BattleMenuBase
|
||||
|
||||
def refreshButtons
|
||||
return if !USE_GRAPHICS
|
||||
for i in 0...4
|
||||
for i in 0...@buttons.length
|
||||
button = @buttons[i]
|
||||
button.src_rect.x = (i==@index) ? @buttonBitmap.width/2 : 0
|
||||
button.src_rect.y = MODES[@mode][i]*BUTTON_HEIGHT
|
||||
@@ -218,7 +218,6 @@ class FightMenuDisplay < BattleMenuBase
|
||||
Color.new(248,192,0),Color.new(144,104,0), # Yellow, 1/2 of total PP or less
|
||||
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR # Black, more than 1/2 of total PP
|
||||
]
|
||||
MAX_MOVES = 4 # Number of moves to display at once
|
||||
|
||||
def initialize(viewport,z)
|
||||
super(viewport)
|
||||
@@ -239,7 +238,7 @@ class FightMenuDisplay < BattleMenuBase
|
||||
background.setBitmap("Graphics/Pictures/Battle/overlay_fight")
|
||||
addSprite("background",background)
|
||||
# Create move buttons
|
||||
@buttons = Array.new(MAX_MOVES) do |i|
|
||||
@buttons = Array.new(Pokemon::MAX_MOVES) do |i|
|
||||
button = SpriteWrapper.new(viewport)
|
||||
button.bitmap = @buttonBitmap.bitmap
|
||||
button.x = self.x+4
|
||||
@@ -337,20 +336,21 @@ class FightMenuDisplay < BattleMenuBase
|
||||
if !USE_GRAPHICS
|
||||
# Fill in command window
|
||||
commands = []
|
||||
moves.each { |m| commands.push((m && m.id>0) ? m.name : "-") }
|
||||
for i in 0...[4, moves.length].max
|
||||
commands.push((moves[i]) ? moves[i].name : "-")
|
||||
end
|
||||
@cmdWindow.commands = commands
|
||||
return
|
||||
end
|
||||
# Draw move names onto overlay
|
||||
@overlay.bitmap.clear
|
||||
textPos = []
|
||||
moves.each_with_index do |m,i|
|
||||
button = @buttons[i]
|
||||
@buttons.each_with_index do |button,i|
|
||||
next if !@visibility["button_#{i}"]
|
||||
x = button.x-self.x+button.src_rect.width/2
|
||||
y = button.y-self.y+8
|
||||
moveNameBase = TEXT_BASE_COLOR
|
||||
if m.type>=0
|
||||
if moves[i].type>=0
|
||||
# NOTE: This takes a colour from a particular pixel in the button
|
||||
# graphic and makes the move name's base colour that same colour.
|
||||
# The pixel is at coordinates 10,34 in the button box. If you
|
||||
@@ -358,7 +358,7 @@ class FightMenuDisplay < BattleMenuBase
|
||||
# of code to ensure the font is an appropriate colour.
|
||||
moveNameBase = button.bitmap.get_pixel(10,button.src_rect.y+34)
|
||||
end
|
||||
textPos.push([m.name,x,y,2,moveNameBase,TEXT_SHADOW_COLOR])
|
||||
textPos.push([moves[i].name,x,y,2,moveNameBase,TEXT_SHADOW_COLOR])
|
||||
end
|
||||
pbDrawTextPositions(@overlay.bitmap,textPos)
|
||||
end
|
||||
@@ -368,7 +368,7 @@ class FightMenuDisplay < BattleMenuBase
|
||||
if USE_GRAPHICS
|
||||
# Choose appropriate button graphics and z positions
|
||||
@buttons.each_with_index do |button,i|
|
||||
if !moves[i] || moves[i].id==0
|
||||
if !moves[i]
|
||||
@visibility["button_#{i}"] = false
|
||||
next
|
||||
end
|
||||
@@ -385,16 +385,16 @@ class FightMenuDisplay < BattleMenuBase
|
||||
# Write PP and type of the selected move
|
||||
if !USE_GRAPHICS
|
||||
moveType = PBTypes.getName(move.type)
|
||||
if move.totalpp<=0
|
||||
if move.total_pp<=0
|
||||
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}",moveType)
|
||||
else
|
||||
@msgBox.text = _ISPRINTF("PP: {1: 2d}/{2: 2d}<br>TYPE/{3:s}",
|
||||
move.pp,move.totalpp,moveType)
|
||||
move.pp,move.total_pp,moveType)
|
||||
end
|
||||
return
|
||||
end
|
||||
@infoOverlay.bitmap.clear
|
||||
if !move || move.id==0
|
||||
if !move
|
||||
@visibility["typeIcon"] = false
|
||||
return
|
||||
end
|
||||
@@ -402,10 +402,10 @@ class FightMenuDisplay < BattleMenuBase
|
||||
# Type icon
|
||||
@typeIcon.src_rect.y = move.type*TYPE_ICON_HEIGHT
|
||||
# PP text
|
||||
if move.totalpp>0
|
||||
ppFraction = [(4.0*move.pp/move.totalpp).ceil,3].min
|
||||
if move.total_pp>0
|
||||
ppFraction = [(4.0*move.pp/move.total_pp).ceil,3].min
|
||||
textPos = []
|
||||
textPos.push([_INTL("PP: {1}/{2}",move.pp,move.totalpp),
|
||||
textPos.push([_INTL("PP: {1}/{2}",move.pp,move.total_pp),
|
||||
448,50,2,PP_COLORS[ppFraction*2],PP_COLORS[ppFraction*2+1]])
|
||||
pbDrawTextPositions(@infoOverlay.bitmap,textPos)
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ class PokeBattle_Scene
|
||||
cw = @sprites["fightWindow"]
|
||||
cw.battler = battler
|
||||
moveIndex = 0
|
||||
if battler.moves[@lastMove[idxBattler]] && battler.moves[@lastMove[idxBattler]].id>0
|
||||
if battler.moves[@lastMove[idxBattler]] && battler.moves[@lastMove[idxBattler]].id
|
||||
moveIndex = @lastMove[idxBattler]
|
||||
end
|
||||
cw.shiftMode = (@battle.pbCanShift?(idxBattler)) ? 1 : 0
|
||||
@@ -98,13 +98,13 @@ class PokeBattle_Scene
|
||||
if Input.trigger?(Input::LEFT)
|
||||
cw.index -= 1 if (cw.index&1)==1
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
if battler.moves[cw.index+1] && battler.moves[cw.index+1].id>0
|
||||
if battler.moves[cw.index+1] && battler.moves[cw.index+1].id
|
||||
cw.index += 1 if (cw.index&1)==0
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
cw.index -= 2 if (cw.index&2)==2
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
if battler.moves[cw.index+2] && battler.moves[cw.index+2].id>0
|
||||
if battler.moves[cw.index+2] && battler.moves[cw.index+2].id
|
||||
cw.index += 2 if (cw.index&2)==0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -383,13 +383,14 @@ class PokeBattle_Scene
|
||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||
# move has no animations defined for it.
|
||||
def pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum=0)
|
||||
id_number = GameData::Move.get(moveID).id_number
|
||||
noFlip = false
|
||||
if (idxUser&1)==0 # On player's side
|
||||
anim = move2anim[0][moveID]
|
||||
anim = move2anim[0][id_number]
|
||||
else # On opposing side
|
||||
anim = move2anim[1][moveID]
|
||||
anim = move2anim[1][id_number]
|
||||
noFlip = true if anim
|
||||
anim = move2anim[0][moveID] if !anim
|
||||
anim = move2anim[0][id_number] if !anim
|
||||
end
|
||||
return [anim+hitNum,noFlip] if anim
|
||||
return nil
|
||||
@@ -399,62 +400,62 @@ class PokeBattle_Scene
|
||||
# animations, tries to use a default move animation depending on the move's
|
||||
# type. If that default move animation doesn't exist, trues to use Tackle's
|
||||
# move animation. Returns nil if it can't find any of these animations to use.
|
||||
def pbFindMoveAnimation(moveID,idxUser,hitNum)
|
||||
def pbFindMoveAnimation(moveID, idxUser, hitNum)
|
||||
begin
|
||||
move2anim = pbLoadMoveToAnim
|
||||
# Find actual animation requested (an opponent using the animation first
|
||||
# looks for an OppMove version then a Move version)
|
||||
anim = pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum)
|
||||
anim = pbFindMoveAnimDetails(move2anim, moveID, idxUser, hitNum)
|
||||
return anim if anim
|
||||
# Actual animation not found, get the default animation for the move's type
|
||||
moveData = pbGetMoveData(moveID)
|
||||
moveType = moveData[MoveData::TYPE]
|
||||
moveKind = moveData[MoveData::CATEGORY]
|
||||
moveKind += 3 if PBTargets.multipleTargets?(moveData[MoveData::TARGET]) ||
|
||||
PBTargets.targetsFoeSide?(moveData[MoveData::TARGET])
|
||||
moveKind += 3 if moveKind==2 && moveData[MoveData::TARGET]!=PBTargets::User &&
|
||||
moveData[MoveData::TARGET]!=PBTargets::UserSide
|
||||
moveData = GameData::Move.get(moveID)
|
||||
moveType = moveData.type
|
||||
moveKind = moveData.category
|
||||
moveKind += 3 if PBTargets.multipleTargets?(moveData.target) ||
|
||||
PBTargets.targetsFoeSide?(moveData.target)
|
||||
moveKind += 3 if moveKind == 2 && moveData.target != PBTargets::User &&
|
||||
moveData.target != PBTargets::UserSide
|
||||
# [one target physical, one target special, user status,
|
||||
# multiple targets physical, multiple targets special, non-user status]
|
||||
typeDefaultAnim = {
|
||||
:NORMAL => [:TACKLE,:SONICBOOM,:DEFENSECURL,:EXPLOSION,:SWIFT,:TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH,:AURASPHERE,:DETECT,nil,nil,nil],
|
||||
:FLYING => [:WINGATTACK,:GUST,:ROOST,nil,:AIRCUTTER,:FEATHERDANCE],
|
||||
:POISON => [:POISONSTING,:SLUDGE,:ACIDARMOR,nil,:ACID,:POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB,:MUDSLAP,nil,:EARTHQUAKE,:EARTHPOWER,:MUDSPORT],
|
||||
:ROCK => [:ROCKTHROW,:POWERGEM,:ROCKPOLISH,:ROCKSLIDE,nil,:SANDSTORM],
|
||||
:BUG => [:TWINEEDLE,:BUGBUZZ,:QUIVERDANCE,nil,:STRUGGLEBUG,:STRINGSHOT],
|
||||
:GHOST => [:LICK,:SHADOWBALL,:GRUDGE,nil,nil,:CONFUSERAY],
|
||||
:STEEL => [:IRONHEAD,:MIRRORSHOT,:IRONDEFENSE,nil,nil,:METALSOUND],
|
||||
:FIRE => [:FIREPUNCH,:EMBER,:SUNNYDAY,nil,:INCINERATE,:WILLOWISP],
|
||||
:WATER => [:CRABHAMMER,:WATERGUN,:AQUARING,nil,:SURF,:WATERSPORT],
|
||||
:GRASS => [:VINEWHIP,:MEGADRAIN,:COTTONGUARD,:RAZORLEAF,nil,:SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH,:THUNDERSHOCK,:CHARGE,nil,:DISCHARGE,:THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT,:CONFUSION,:CALMMIND,nil,:SYNCHRONOISE,:MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH,:ICEBEAM,:MIST,nil,:POWDERSNOW,:HAIL],
|
||||
:DRAGON => [:DRAGONCLAW,:DRAGONRAGE,:DRAGONDANCE,nil,:TWISTER,nil],
|
||||
:DARK => [:PURSUIT,:DARKPULSE,:HONECLAWS,nil,:SNARL,:EMBARGO],
|
||||
:FAIRY => [:TACKLE,:FAIRYWIND,:MOONLIGHT,nil,:SWIFT,:SWEETKISS]
|
||||
:NORMAL => [:TACKLE, :SONICBOOM, :DEFENSECURL, :EXPLOSION, :SWIFT, :TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH, :AURASPHERE, :DETECT, nil, nil, nil],
|
||||
:FLYING => [:WINGATTACK, :GUST, :ROOST, nil, :AIRCUTTER, :FEATHERDANCE],
|
||||
:POISON => [:POISONSTING, :SLUDGE, :ACIDARMOR, nil, :ACID, :POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB, :MUDSLAP, nil, :EARTHQUAKE, :EARTHPOWER, :MUDSPORT],
|
||||
:ROCK => [:ROCKTHROW, :POWERGEM, :ROCKPOLISH, :ROCKSLIDE, nil, :SANDSTORM],
|
||||
:BUG => [:TWINEEDLE, :BUGBUZZ, :QUIVERDANCE, nil, :STRUGGLEBUG, :STRINGSHOT],
|
||||
:GHOST => [:LICK, :SHADOWBALL, :GRUDGE, nil, nil, :CONFUSERAY],
|
||||
:STEEL => [:IRONHEAD, :MIRRORSHOT, :IRONDEFENSE, nil, nil, :METALSOUND],
|
||||
:FIRE => [:FIREPUNCH, :EMBER, :SUNNYDAY, nil, :INCINERATE, :WILLOWISP],
|
||||
:WATER => [:CRABHAMMER, :WATERGUN, :AQUARING, nil, :SURF, :WATERSPORT],
|
||||
:GRASS => [:VINEWHIP, :MEGADRAIN, :COTTONGUARD, :RAZORLEAF, nil, :SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH, :THUNDERSHOCK, :CHARGE, nil, :DISCHARGE, :THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT, :CONFUSION, :CALMMIND, nil, :SYNCHRONOISE, :MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH, :ICEBEAM, :MIST, nil, :POWDERSNOW, :HAIL],
|
||||
:DRAGON => [:DRAGONCLAW, :DRAGONRAGE, :DRAGONDANCE, nil, :TWISTER, nil],
|
||||
:DARK => [:PURSUIT, :DARKPULSE, :HONECLAWS, nil, :SNARL, :EMBARGO],
|
||||
:FAIRY => [:TACKLE, :FAIRYWIND, :MOONLIGHT, nil, :SWIFT, :SWEETKISS]
|
||||
}
|
||||
typeDefaultAnim.each do |type, anims|
|
||||
next if !isConst?(moveType,PBTypes,type)
|
||||
if anims[moveKind] && hasConst?(PBMoves,anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[moveKind]),idxUser)
|
||||
next if !isConst?(moveType, PBTypes, type)
|
||||
if GameData::Move.exists?(anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if moveKind>=3 && anims[moveKind-3] && hasConst?(PBMoves,anims[moveKind-3])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[moveKind-3]),idxUser)
|
||||
if moveKind >= 3 && GameData::Move.exists?(anims[moveKind - 3])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind - 3], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if anims[2] && hasConst?(PBMoves,anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[2]),idxUser)
|
||||
if GameData::Move.exists?(anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[2], idxUser)
|
||||
end
|
||||
break
|
||||
end
|
||||
return anim if anim
|
||||
# Default animation for the move's type not found, use Tackle's animation
|
||||
if hasConst?(PBMoves,:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim,getConst(PBMoves,:TACKLE),idxUser)
|
||||
if GameData::Move.exists?(:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim, :TACKLE, idxUser)
|
||||
end
|
||||
rescue
|
||||
end
|
||||
|
||||
@@ -85,38 +85,37 @@ begin
|
||||
Quash = 79
|
||||
Rage = 80
|
||||
RagePowder = 81 # Used along with FollowMe
|
||||
Revenge = 82
|
||||
Rollout = 83
|
||||
Roost = 84
|
||||
ShellTrap = 85
|
||||
SkyDrop = 86
|
||||
SlowStart = 87
|
||||
SmackDown = 88
|
||||
Snatch = 89
|
||||
SpikyShield = 90
|
||||
Spotlight = 91
|
||||
Stockpile = 92
|
||||
StockpileDef = 93
|
||||
StockpileSpDef = 94
|
||||
Substitute = 95
|
||||
Taunt = 96
|
||||
Telekinesis = 97
|
||||
ThroatChop = 98
|
||||
Torment = 99
|
||||
Toxic = 100
|
||||
Transform = 101
|
||||
TransformSpecies = 102
|
||||
Trapping = 103 # Trapping move
|
||||
TrappingMove = 104
|
||||
TrappingUser = 105
|
||||
Truant = 106
|
||||
TwoTurnAttack = 107
|
||||
Type3 = 108
|
||||
Unburden = 109
|
||||
Uproar = 110
|
||||
WaterSport = 111
|
||||
WeightChange = 112
|
||||
Yawn = 113
|
||||
Rollout = 82
|
||||
Roost = 83
|
||||
ShellTrap = 84
|
||||
SkyDrop = 85
|
||||
SlowStart = 86
|
||||
SmackDown = 87
|
||||
Snatch = 88
|
||||
SpikyShield = 89
|
||||
Spotlight = 90
|
||||
Stockpile = 91
|
||||
StockpileDef = 92
|
||||
StockpileSpDef = 93
|
||||
Substitute = 94
|
||||
Taunt = 95
|
||||
Telekinesis = 96
|
||||
ThroatChop = 97
|
||||
Torment = 98
|
||||
Toxic = 99
|
||||
Transform = 100
|
||||
TransformSpecies = 101
|
||||
Trapping = 102 # Trapping move
|
||||
TrappingMove = 103
|
||||
TrappingUser = 104
|
||||
Truant = 105
|
||||
TwoTurnAttack = 106
|
||||
Type3 = 107
|
||||
Unburden = 108
|
||||
Uproar = 109
|
||||
WaterSport = 110
|
||||
WeightChange = 111
|
||||
Yawn = 112
|
||||
|
||||
#===========================================================================
|
||||
# These effects apply to a battler position
|
||||
|
||||
@@ -78,15 +78,15 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
def pbCanChooseMovePartial?(idxPokemon,idxMove)
|
||||
thispkmn = @battlers[idxPokemon]
|
||||
thismove = thispkmn.moves[idxMove]
|
||||
return false if !thismove || thismove.id==0
|
||||
return false if !thismove
|
||||
return false if thismove.pp<=0
|
||||
if thispkmn.effects[PBEffects::ChoiceBand]>=0 &&
|
||||
if thispkmn.effects[PBEffects::ChoiceBand] &&
|
||||
thismove.id!=thispkmn.effects[PBEffects::ChoiceBand] &&
|
||||
thispkmn.hasActiveItem?(:CHOICEBAND)
|
||||
return false
|
||||
end
|
||||
# though incorrect, just for convenience (actually checks Torment later)
|
||||
if thispkmn.effects[PBEffects::Torment]
|
||||
if thispkmn.effects[PBEffects::Torment] && thispkmn.lastMoveUsed
|
||||
return false if thismove.id==thispkmn.lastMoveUsed
|
||||
end
|
||||
return true
|
||||
@@ -135,28 +135,28 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
end
|
||||
|
||||
def pbRegisterMove(idxBattler,idxMove,_showMessages=true)
|
||||
thispkmn = @battlers[idxBattler]
|
||||
this_battler = @battlers[idxBattler]
|
||||
if idxMove==-2
|
||||
@choices[idxPokemon][0] = :UseMove # Move
|
||||
@choices[idxPokemon][1] = -2 # "Incapable of using its power..."
|
||||
@choices[idxPokemon][2] = @struggle
|
||||
@choices[idxPokemon][3] = -1
|
||||
@choices[idxBattler][0] = :UseMove # Move
|
||||
@choices[idxBattler][1] = -2 # "Incapable of using its power..."
|
||||
@choices[idxBattler][2] = @struggle
|
||||
@choices[idxBattler][3] = -1
|
||||
else
|
||||
@choices[idxPokemon][0] = :UseMove # Move
|
||||
@choices[idxPokemon][1] = idxMove # Index of move
|
||||
@choices[idxPokemon][2] = thispkmn.moves[idxMove] # Move object
|
||||
@choices[idxPokemon][3] = -1 # No target chosen
|
||||
@choices[idxBattler][0] = :UseMove # Move
|
||||
@choices[idxBattler][1] = idxMove # Index of move
|
||||
@choices[idxBattler][2] = this_battler.moves[idxMove] # Move object
|
||||
@choices[idxBattler][3] = -1 # No target chosen
|
||||
end
|
||||
end
|
||||
|
||||
def pbAutoFightMenu(idxBattler)
|
||||
thispkmn = @battlers[idxBattler]
|
||||
nature = thispkmn.nature
|
||||
this_battler = @battlers[idxBattler]
|
||||
nature = this_battler.nature
|
||||
randnum = @battleAI.pbAIRandom(100)
|
||||
category = 0
|
||||
atkpercent = 0
|
||||
defpercent = 0
|
||||
if thispkmn.effects[PBEffects::Pinch]
|
||||
if this_battler.effects[PBEffects::Pinch]
|
||||
atkpercent = @@BattlePalacePinchTable[nature*3]
|
||||
defpercent = atkpercent+@@BattlePalacePinchTable[nature*3+1]
|
||||
else
|
||||
@@ -171,9 +171,9 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
category = 2
|
||||
end
|
||||
moves = []
|
||||
for i in 0...thispkmn.moves.length
|
||||
for i in 0...this_battler.moves.length
|
||||
next if !pbCanChooseMovePartial?(idxBattler,i)
|
||||
next if pbMoveCategory(thispkmn.moves[i])!=category
|
||||
next if pbMoveCategory(this_battler.moves[i])!=category
|
||||
moves[moves.length] = i
|
||||
end
|
||||
if moves.length==0
|
||||
|
||||
@@ -1080,7 +1080,8 @@ BattleHandlers::DamageCalcUserAbility.add(:SWARM,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:TECHNICIAN,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.index!=target.index && move.id>0 && baseDmg*mults[BASE_DMG_MULT]<=60
|
||||
if user.index!=target.index && move && move.id != :STRUGGLE &&
|
||||
baseDmg*mults[BASE_DMG_MULT]<=60
|
||||
mults[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
}
|
||||
@@ -1358,7 +1359,7 @@ BattleHandlers::TargetAbilityOnHit.add(:CURSEDBODY,
|
||||
regularMove = m
|
||||
break
|
||||
end
|
||||
next if !regularMove || (regularMove.pp==0 && regularMove.totalpp>0)
|
||||
next if !regularMove || (regularMove.pp==0 && regularMove.total_pp>0)
|
||||
next if battle.pbRandom(100)>=30
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if !move.pbMoveFailedAromaVeil?(target,user,PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
|
||||
@@ -2098,17 +2099,16 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
battle.eachOtherSideBattler(battler.index) do |b|
|
||||
b.eachMove do |m|
|
||||
next if m.statusMove?
|
||||
moveData = pbGetMoveData(m.id)
|
||||
if type1
|
||||
moveType = moveData[MoveData::TYPE]
|
||||
if NEWEST_BATTLE_MECHANICS && isConst?(m.id,PBMoves,:HIDDENPOWER)
|
||||
moveType = m.type
|
||||
if NEWEST_BATTLE_MECHANICS && m.function == "090" # Hidden Power
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
|
||||
next if PBTypes.ineffective?(eff)
|
||||
next if !PBTypes.superEffective?(eff) && moveData[MoveData::FUNCTION_CODE]!="070" # OHKO
|
||||
next if !PBTypes.superEffective?(eff) && m.function != "070" # OHKO
|
||||
else
|
||||
next if moveData[MoveData::FUNCTION_CODE]!="070" # OHKO
|
||||
next if m.function != "070" # OHKO
|
||||
end
|
||||
found = true
|
||||
break
|
||||
@@ -2207,33 +2207,32 @@ BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN,
|
||||
forewarnMoves = []
|
||||
battle.eachOtherSideBattler(battler.index) do |b|
|
||||
b.eachMove do |m|
|
||||
moveData = pbGetMoveData(m.id)
|
||||
power = moveData[MoveData::BASE_DAMAGE]
|
||||
power = 160 if ["070"].include?(moveData[MoveData::FUNCTION_CODE]) # OHKO
|
||||
power = 150 if ["08B"].include?(moveData[MoveData::FUNCTION_CODE]) # Eruption
|
||||
power = m.baseDamage
|
||||
power = 160 if ["070"].include?(m.function) # OHKO
|
||||
power = 150 if ["08B"].include?(m.function) # Eruption
|
||||
# Counter, Mirror Coat, Metal Burst
|
||||
power = 120 if ["071","072","073"].include?(moveData[MoveData::FUNCTION_CODE])
|
||||
power = 120 if ["071","072","073"].include?(m.function)
|
||||
# Sonic Boom, Dragon Rage, Night Shade, Endeavor, Psywave,
|
||||
# Return, Frustration, Crush Grip, Gyro Ball, Hidden Power,
|
||||
# Natural Gift, Trump Card, Flail, Grass Knot
|
||||
power = 80 if ["06A","06B","06D","06E","06F",
|
||||
"089","08A","08C","08D","090",
|
||||
"096","097","098","09A"].include?(moveData[MoveData::FUNCTION_CODE])
|
||||
"096","097","098","09A"].include?(m.function)
|
||||
next if power<highestPower
|
||||
forewarnMoves = [] if power>highestPower
|
||||
forewarnMoves.push(m.id)
|
||||
forewarnMoves.push(m.name)
|
||||
highestPower = power
|
||||
end
|
||||
end
|
||||
if forewarnMoves.length>0
|
||||
battle.pbShowAbilitySplash(battler)
|
||||
forewarnMoveID = forewarnMoves[battle.pbRandom(forewarnMoves.length)]
|
||||
forewarnMoveName = forewarnMoves[battle.pbRandom(forewarnMoves.length)]
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
battle.pbDisplay(_INTL("{1} was alerted to {2}!",
|
||||
battler.pbThis,PBMoves.getName(forewarnMoveID)))
|
||||
battler.pbThis, forewarnMoveName))
|
||||
else
|
||||
battle.pbDisplay(_INTL("{1}'s Forewarn alerted it to {2}!",
|
||||
battler.pbThis,PBMoves.getName(forewarnMoveID)))
|
||||
battler.pbThis, forewarnMoveName))
|
||||
end
|
||||
battle.pbHideAbilitySplash(battler)
|
||||
end
|
||||
@@ -2285,7 +2284,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:IMPOSTER,
|
||||
choice.semiInvulnerable?
|
||||
battle.pbShowAbilitySplash(battler,true)
|
||||
battle.pbHideAbilitySplash(battler)
|
||||
battle.pbAnimation(getConst(PBMoves,:TRANSFORM),battler,choice)
|
||||
battle.pbAnimation(:TRANSFORM,battler,choice)
|
||||
battle.scene.pbChangePokemon(battler,choice.pokemon)
|
||||
battler.pbTransform(choice)
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ BattleHandlers::StatusCureItem.add(:MENTALHERB,
|
||||
battler.effects[PBEffects::Taunt] = 0
|
||||
battle.pbDisplay(_INTL("{1}'s encore ended!",battler.pbThis)) if battler.effects[PBEffects::Encore]>0
|
||||
battler.effects[PBEffects::Encore] = 0
|
||||
battler.effects[PBEffects::EncoreMove] = 0
|
||||
battler.effects[PBEffects::EncoreMove] = nil
|
||||
battle.pbDisplay(_INTL("{1}'s torment wore off!",battler.pbThis)) if battler.effects[PBEffects::Torment]
|
||||
battler.effects[PBEffects::Torment] = false
|
||||
battle.pbDisplay(_INTL("{1} is no longer disabled!",battler.pbThis)) if battler.effects[PBEffects::Disable]>0
|
||||
@@ -1288,8 +1288,7 @@ BattleHandlers::EndOfMoveItem.add(:LEPPABERRY,
|
||||
next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index)
|
||||
found = []
|
||||
battler.pokemon.moves.each_with_index do |m,i|
|
||||
next if !m || m.id==0
|
||||
next if m.totalpp<=0 || m.pp==m.totalpp
|
||||
next if m.total_pp<=0 || m.pp==m.total_pp
|
||||
next if !forced && m.pp>0
|
||||
found.push(i)
|
||||
end
|
||||
@@ -1300,9 +1299,9 @@ BattleHandlers::EndOfMoveItem.add(:LEPPABERRY,
|
||||
choice = found[battle.pbRandom(found.length)]
|
||||
pkmnMove = battler.pokemon.moves[choice]
|
||||
pkmnMove.pp += 10
|
||||
pkmnMove.pp = pkmnMove.totalpp if pkmnMove.pp>pkmnMove.totalpp
|
||||
pkmnMove.pp = pkmnMove.total_pp if pkmnMove.pp>pkmnMove.total_pp
|
||||
battler.moves[choice].pp = pkmnMove.pp
|
||||
moveName = PBMoves.getName(pkmnMove.id)
|
||||
moveName = pkmnMove.name
|
||||
if forced
|
||||
battle.pbDisplay(_INTL("{1} restored its {2}'s PP.",battler.pbThis,moveName))
|
||||
else
|
||||
|
||||
@@ -72,7 +72,7 @@ begin
|
||||
def initialize
|
||||
@effects = []
|
||||
@effects[PBEffects::FutureSightCounter] = 0
|
||||
@effects[PBEffects::FutureSightMove] = 0
|
||||
@effects[PBEffects::FutureSightMove] = nil
|
||||
@effects[PBEffects::FutureSightUserIndex] = -1
|
||||
@effects[PBEffects::FutureSightUserPartyIndex] = -1
|
||||
@effects[PBEffects::HealingWish] = false
|
||||
|
||||
@@ -1334,7 +1334,7 @@ def pbItemBall(item,quantity=1)
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
elsif item.is_machine? # TM or HM
|
||||
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name))
|
||||
elsif quantity>1
|
||||
pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
@@ -1350,7 +1350,7 @@ def pbItemBall(item,quantity=1)
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
elsif item.is_machine? # TM or HM
|
||||
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,GameData::Move.get(move).name))
|
||||
elsif quantity>1
|
||||
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
@@ -1377,7 +1377,7 @@ def pbReceiveItem(item,quantity=1)
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
elsif item.is_machine? # TM or HM
|
||||
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name))
|
||||
elsif quantity>1
|
||||
pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
#===============================================================================
|
||||
# Hidden move handlers
|
||||
#===============================================================================
|
||||
class MoveHandlerHash < HandlerHash
|
||||
def initialize
|
||||
super(:PBMoves)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module HiddenMoveHandlers
|
||||
CanUseMove = MoveHandlerHash.new
|
||||
ConfirmUseMove = MoveHandlerHash.new
|
||||
@@ -194,7 +186,7 @@ end
|
||||
# Cut
|
||||
#===============================================================================
|
||||
def pbCut
|
||||
move = getID(PBMoves,:CUT)
|
||||
move = :CUT
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_CUT,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("This tree looks like it can be cut down."))
|
||||
@@ -203,7 +195,7 @@ def pbCut
|
||||
pbMessage(_INTL("This tree looks like it can be cut down!\1"))
|
||||
if pbConfirmMessage(_INTL("Would you like to cut it?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
return true
|
||||
end
|
||||
@@ -222,7 +214,7 @@ HiddenMoveHandlers::CanUseMove.add(:CUT,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:CUT,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if facingEvent
|
||||
@@ -279,7 +271,7 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
|
||||
escape = ($PokemonGlobal.escapePoint rescue nil)
|
||||
if escape
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = escape[0]
|
||||
@@ -304,7 +296,7 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
|
||||
def pbDive
|
||||
divemap = GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
||||
return false if !divemap
|
||||
move = getID(PBMoves,:DIVE)
|
||||
move = :DIVE
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
|
||||
@@ -312,7 +304,7 @@ def pbDive
|
||||
end
|
||||
if pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = divemap
|
||||
@@ -340,7 +332,7 @@ def pbSurfacing
|
||||
break
|
||||
end
|
||||
return if !surface_map_id
|
||||
move = getID(PBMoves,:DIVE)
|
||||
move = :DIVE
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
|
||||
@@ -348,7 +340,7 @@ def pbSurfacing
|
||||
end
|
||||
if pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = surface_map_id
|
||||
@@ -443,7 +435,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
end
|
||||
next false if !dive_map_id
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = dive_map_id
|
||||
@@ -482,7 +474,7 @@ HiddenMoveHandlers::UseMove.add(:FLASH,proc { |move,pokemon|
|
||||
darkness = $PokemonTemp.darknessSprite
|
||||
next false if !darkness || darkness.disposed?
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
$PokemonGlobal.flashUsed = true
|
||||
radiusDiff = 8*20/Graphics.frame_rate
|
||||
@@ -520,7 +512,7 @@ HiddenMoveHandlers::UseMove.add(:FLY,proc { |move,pokemon|
|
||||
next false
|
||||
end
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = $PokemonTemp.flydata[0]
|
||||
@@ -562,7 +554,7 @@ def pbHeadbuttEffect(event=nil)
|
||||
end
|
||||
|
||||
def pbHeadbutt(event=nil)
|
||||
move = getID(PBMoves,:HEADBUTT)
|
||||
move = :HEADBUTT
|
||||
movefinder = pbCheckMove(move)
|
||||
if !$DEBUG && !movefinder
|
||||
pbMessage(_INTL("A Pokémon could be in this tree. Maybe a Pokémon could shake it."))
|
||||
@@ -570,7 +562,7 @@ def pbHeadbutt(event=nil)
|
||||
end
|
||||
if pbConfirmMessage(_INTL("A Pokémon could be in this tree. Would you like to use Headbutt?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbHeadbuttEffect(event)
|
||||
return true
|
||||
@@ -589,7 +581,7 @@ HiddenMoveHandlers::CanUseMove.add(:HEADBUTT,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:HEADBUTT,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
pbHeadbuttEffect(facingEvent)
|
||||
@@ -607,7 +599,7 @@ def pbRockSmashRandomEncounter
|
||||
end
|
||||
|
||||
def pbRockSmash
|
||||
move = getID(PBMoves,:ROCKSMASH)
|
||||
move = :ROCKSMASH
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_ROCKSMASH,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("It's a rugged rock, but a Pokémon may be able to smash it."))
|
||||
@@ -615,7 +607,7 @@ def pbRockSmash
|
||||
end
|
||||
if pbConfirmMessage(_INTL("This rock appears to be breakable. Would you like to use Rock Smash?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
return true
|
||||
end
|
||||
@@ -634,7 +626,7 @@ HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:ROCKSMASH,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if facingEvent
|
||||
@@ -654,7 +646,7 @@ def pbStrength
|
||||
pbMessage(_INTL("Strength made it possible to move boulders around."))
|
||||
return false
|
||||
end
|
||||
move = getID(PBMoves,:STRENGTH)
|
||||
move = :STRENGTH
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_STRENGTH,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("It's a big boulder, but a Pokémon may be able to push it aside."))
|
||||
@@ -663,7 +655,7 @@ def pbStrength
|
||||
pbMessage(_INTL("It's a big boulder, but a Pokémon may be able to push it aside.\1"))
|
||||
if pbConfirmMessage(_INTL("Would you like to use Strength?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbMessage(_INTL("{1}'s Strength made it possible to move boulders around!",speciesname))
|
||||
$PokemonMap.strengthUsed = true
|
||||
@@ -688,7 +680,7 @@ HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:STRENGTH,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!\1",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!\1",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
pbMessage(_INTL("{1}'s Strength made it possible to move boulders around!",pokemon.name))
|
||||
$PokemonMap.strengthUsed = true
|
||||
@@ -703,14 +695,14 @@ HiddenMoveHandlers::UseMove.add(:STRENGTH,proc { |move,pokemon|
|
||||
def pbSurf
|
||||
return false if $game_player.pbFacingEvent
|
||||
return false if $game_player.pbHasDependentEvents?
|
||||
move = getID(PBMoves,:SURF)
|
||||
move = :SURF
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_SURF,false) || (!$DEBUG && !movefinder)
|
||||
return false
|
||||
end
|
||||
if pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbCancelVehicles
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
@@ -798,7 +790,7 @@ HiddenMoveHandlers::UseMove.add(:SURF,proc { |move,pokemon|
|
||||
$game_temp.in_menu = false
|
||||
pbCancelVehicles
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm,0.5) if surfbgm
|
||||
@@ -851,7 +843,7 @@ HiddenMoveHandlers::CanUseMove.add(:SWEETSCENT,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
pbSweetScent
|
||||
next true
|
||||
@@ -893,7 +885,7 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
|
||||
healing = GameData::Metadata.get.home if !healing # Home
|
||||
next false if !healing
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = healing[0]
|
||||
@@ -952,7 +944,7 @@ def pbDescendWaterfall(event=nil)
|
||||
end
|
||||
|
||||
def pbWaterfall
|
||||
move = getID(PBMoves,:WATERFALL)
|
||||
move = :WATERFALL
|
||||
movefinder = pbCheckMove(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_WATERFALL,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
||||
@@ -960,7 +952,7 @@ def pbWaterfall
|
||||
end
|
||||
if pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbAscendWaterfall
|
||||
return true
|
||||
@@ -988,7 +980,7 @@ HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:WATERFALL,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
end
|
||||
pbAscendWaterfall
|
||||
next true
|
||||
|
||||
@@ -286,20 +286,18 @@ def pbDayCareGenerateEgg
|
||||
mother.hasItem?(:LIGHTBALL)
|
||||
lightball = true
|
||||
end
|
||||
if lightball && isConst?(babyspecies,PBSpecies,:PICHU) &&
|
||||
hasConst?(PBMoves,:VOLTTACKLE)
|
||||
moves.push(getConst(PBMoves,:VOLTTACKLE))
|
||||
if lightball && isConst?(babyspecies,PBSpecies,:PICHU) && GameData::Move.exists?(:VOLTTACKLE)
|
||||
moves.push(:VOLTTACKLE)
|
||||
end
|
||||
moves = moves.reverse
|
||||
moves |= [] # remove duplicates
|
||||
moves = moves.reverse
|
||||
# Assembling move list
|
||||
first_move_index = moves.length - Pokemon::MAX_MOVES
|
||||
first_move_index = 0 if first_move_index < 0
|
||||
finalmoves = []
|
||||
listend = moves.length-4
|
||||
listend = 0 if listend<0
|
||||
for i in listend...listend+4
|
||||
moveid = (i>=moves.length) ? 0 : moves[i]
|
||||
finalmoves[finalmoves.length] = PBMove.new(moveid)
|
||||
for i in first_move_index...moves.length
|
||||
finalmoves.push(PBMove.new(moves[i]))
|
||||
end
|
||||
# Inheriting Individual Values
|
||||
ivs = []
|
||||
@@ -386,10 +384,7 @@ def pbDayCareGenerateEgg
|
||||
egg.iv[3] = ivs[3]
|
||||
egg.iv[4] = ivs[4]
|
||||
egg.iv[5] = ivs[5]
|
||||
egg.moves[0] = finalmoves[0]
|
||||
egg.moves[1] = finalmoves[1]
|
||||
egg.moves[2] = finalmoves[2]
|
||||
egg.moves[3] = finalmoves[3]
|
||||
egg.moves = finalmoves
|
||||
egg.calcStats
|
||||
egg.obtainText = _INTL("Day-Care Couple")
|
||||
egg.name = _INTL("Egg")
|
||||
|
||||
@@ -24,7 +24,7 @@ module TrainerData
|
||||
:Item, :Item, :Item, :Item],
|
||||
"Pokemon" => [SPECIES, "ev", :PBSpecies, nil], # Species, level
|
||||
"Item" => [ITEM, "e", :Item],
|
||||
"Moves" => [MOVES, "eEEE", :PBMoves, :PBMoves, :PBMoves, :PBMoves],
|
||||
"Moves" => [MOVES, "eEEE", :Move, :Move, :Move, :Move],
|
||||
"Ability" => [ABILITY, "u"],
|
||||
"Gender" => [GENDER, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
|
||||
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }],
|
||||
|
||||
@@ -246,11 +246,11 @@ end
|
||||
# Restore PP
|
||||
#===============================================================================
|
||||
def pbRestorePP(pkmn,idxMove,pp)
|
||||
return 0 if !pkmn.moves[idxMove] || pkmn.moves[idxMove].id==0
|
||||
return 0 if pkmn.moves[idxMove].totalpp<=0
|
||||
return 0 if !pkmn.moves[idxMove] || !pkmn.moves[idxMove].id
|
||||
return 0 if pkmn.moves[idxMove].total_pp<=0
|
||||
oldpp = pkmn.moves[idxMove].pp
|
||||
newpp = pkmn.moves[idxMove].pp+pp
|
||||
newpp = pkmn.moves[idxMove].totalpp if newpp>pkmn.moves[idxMove].totalpp
|
||||
newpp = pkmn.moves[idxMove].total_pp if newpp>pkmn.moves[idxMove].total_pp
|
||||
pkmn.moves[idxMove].pp = newpp
|
||||
return newpp-oldpp
|
||||
end
|
||||
@@ -407,7 +407,7 @@ end
|
||||
#===============================================================================
|
||||
def pbLearnMove(pkmn,move,ignoreifknown=false,bymachine=false,&block)
|
||||
return false if !pkmn
|
||||
movename = PBMoves.getName(move)
|
||||
move = GameData::Move.get(move).id
|
||||
if pkmn.egg? && !$DEBUG
|
||||
pbMessage(_INTL("Eggs can't be taught any moves."),&block)
|
||||
return false
|
||||
@@ -417,11 +417,12 @@ def pbLearnMove(pkmn,move,ignoreifknown=false,bymachine=false,&block)
|
||||
return false
|
||||
end
|
||||
pkmnname = pkmn.name
|
||||
movename = GameData::Move.get(move).name
|
||||
if pkmn.hasMove?(move)
|
||||
pbMessage(_INTL("{1} already knows {2}.",pkmnname,movename),&block) if !ignoreifknown
|
||||
return false
|
||||
end
|
||||
if pkmn.numMoves<4
|
||||
if pkmn.numMoves<Pokemon::MAX_MOVES
|
||||
pkmn.pbLearnMove(move)
|
||||
pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]",pkmnname,movename),&block)
|
||||
return true
|
||||
@@ -431,11 +432,11 @@ def pbLearnMove(pkmn,move,ignoreifknown=false,bymachine=false,&block)
|
||||
pbMessage(_INTL("Please choose a move that will be replaced with {1}.",movename),&block)
|
||||
forgetmove = pbForgetMove(pkmn,move)
|
||||
if forgetmove>=0
|
||||
oldmovename = PBMoves.getName(pkmn.moves[forgetmove].id)
|
||||
oldmovename = pkmn.moves[forgetmove].name
|
||||
oldmovepp = pkmn.moves[forgetmove].pp
|
||||
pkmn.moves[forgetmove] = PBMove.new(move) # Replaces current/total PP
|
||||
if bymachine && !NEWEST_BATTLE_MECHANICS
|
||||
pkmn.moves[forgetmove].pp = [oldmovepp,pkmn.moves[forgetmove].totalpp].min
|
||||
pkmn.moves[forgetmove].pp = [oldmovepp,pkmn.moves[forgetmove].total_pp].min
|
||||
end
|
||||
pbMessage(_INTL("1,\\wt[16] 2, and\\wt[16]...\\wt[16] ...\\wt[16] ... Ta-da!\\se[Battle ball drop]\1"),&block)
|
||||
pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1",pkmnname,oldmovename),&block)
|
||||
@@ -480,7 +481,7 @@ def pbUseItem(bag,item,bagscene=nil)
|
||||
end
|
||||
machine = itm.move
|
||||
return 0 if !machine
|
||||
movename = PBMoves.getName(machine)
|
||||
movename = GameData::Move.get(machine).name
|
||||
pbMessage(_INTL("\\se[PC access]You booted up {1}.\1",itm.name))
|
||||
if !pbConfirmMessage(_INTL("Do you want to teach {1} to a Pokémon?",movename))
|
||||
return 0
|
||||
@@ -554,7 +555,7 @@ def pbUseItemOnPokemon(item,pkmn,scene)
|
||||
if itm.is_machine?
|
||||
machine = itm.move
|
||||
return false if !machine
|
||||
movename = PBMoves.getName(machine)
|
||||
movename = GameData::Move.get(machine).name
|
||||
if pkmn.shadowPokemon?
|
||||
pbMessage(_INTL("Shadow Pokémon can't be taught any moves.")) { scene.pbUpdate }
|
||||
elsif !pkmn.compatibleWithMove?(machine)
|
||||
|
||||
@@ -590,7 +590,7 @@ ItemHandlers::UseOnPokemon.copy(:ETHER,:LEPPABERRY)
|
||||
ItemHandlers::UseOnPokemon.add(:MAXETHER,proc { |item,pkmn,scene|
|
||||
move = scene.pbChooseMove(pkmn,_INTL("Restore which move?"))
|
||||
next false if move<0
|
||||
if pbRestorePP(pkmn,move,pkmn.moves[move].totalpp-pkmn.moves[move].pp)==0
|
||||
if pbRestorePP(pkmn,move,pkmn.moves[move].total_pp-pkmn.moves[move].pp)==0
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
@@ -614,7 +614,7 @@ ItemHandlers::UseOnPokemon.add(:ELIXIR,proc { |item,pkmn,scene|
|
||||
ItemHandlers::UseOnPokemon.add(:MAXELIXIR,proc { |item,pkmn,scene|
|
||||
pprestored = 0
|
||||
for i in 0...pkmn.moves.length
|
||||
pprestored += pbRestorePP(pkmn,i,pkmn.moves[i].totalpp-pkmn.moves[i].pp)
|
||||
pprestored += pbRestorePP(pkmn,i,pkmn.moves[i].total_pp-pkmn.moves[i].pp)
|
||||
end
|
||||
if pprestored==0
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
@@ -627,12 +627,12 @@ ItemHandlers::UseOnPokemon.add(:MAXELIXIR,proc { |item,pkmn,scene|
|
||||
ItemHandlers::UseOnPokemon.add(:PPUP,proc { |item,pkmn,scene|
|
||||
move = scene.pbChooseMove(pkmn,_INTL("Boost PP of which move?"))
|
||||
if move>=0
|
||||
if pkmn.moves[move].totalpp<=1 || pkmn.moves[move].ppup>=3
|
||||
if pkmn.moves[move].total_pp<=1 || pkmn.moves[move].ppup>=3
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
pkmn.moves[move].ppup += 1
|
||||
movename = PBMoves.getName(pkmn.moves[move].id)
|
||||
movename = pkmn.moves[move].name
|
||||
scene.pbDisplay(_INTL("{1}'s PP increased.",movename))
|
||||
next true
|
||||
end
|
||||
@@ -642,12 +642,12 @@ ItemHandlers::UseOnPokemon.add(:PPUP,proc { |item,pkmn,scene|
|
||||
ItemHandlers::UseOnPokemon.add(:PPMAX,proc { |item,pkmn,scene|
|
||||
move = scene.pbChooseMove(pkmn,_INTL("Boost PP of which move?"))
|
||||
if move>=0
|
||||
if pkmn.moves[move].totalpp<=1 || pkmn.moves[move].ppup>=3
|
||||
if pkmn.moves[move].total_pp<=1 || pkmn.moves[move].ppup>=3
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
pkmn.moves[move].ppup = 3
|
||||
movename = PBMoves.getName(pkmn.moves[move].id)
|
||||
movename = pkmn.moves[move].name
|
||||
scene.pbDisplay(_INTL("{1}'s PP increased.",movename))
|
||||
next true
|
||||
end
|
||||
|
||||
@@ -143,8 +143,8 @@ ItemHandlers::CanUseInBattle.copy(:REVIVE,:MAXREVIVE,:REVIVALHERB)
|
||||
|
||||
ItemHandlers::CanUseInBattle.add(:ETHER,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
|
||||
if !pokemon.able? || move<0 ||
|
||||
pokemon.moves[move].totalpp<=0 ||
|
||||
pokemon.moves[move].pp==pokemon.moves[move].totalpp
|
||||
pokemon.moves[move].total_pp<=0 ||
|
||||
pokemon.moves[move].pp==pokemon.moves[move].total_pp
|
||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||
next false
|
||||
end
|
||||
@@ -161,7 +161,7 @@ ItemHandlers::CanUseInBattle.add(:ELIXIR,proc { |item,pokemon,battler,move,first
|
||||
canRestore = false
|
||||
for m in pokemon.moves
|
||||
next if m.id==0
|
||||
next if m.totalpp<=0 || m.pp==m.totalpp
|
||||
next if m.total_pp<=0 || m.pp==m.total_pp
|
||||
canRestore = true
|
||||
break
|
||||
end
|
||||
@@ -487,7 +487,7 @@ ItemHandlers::BattleUseOnPokemon.copy(:ETHER,:LEPPABERRY)
|
||||
|
||||
ItemHandlers::BattleUseOnPokemon.add(:MAXETHER,proc { |item,pokemon,battler,choices,scene|
|
||||
idxMove = choices[3]
|
||||
pbBattleRestorePP(pokemon,battler,idxMove,pokemon.moves[idxMove].totalpp)
|
||||
pbBattleRestorePP(pokemon,battler,idxMove,pokemon.moves[idxMove].total_pp)
|
||||
scene.pbDisplay(_INTL("PP was restored."))
|
||||
})
|
||||
|
||||
@@ -500,7 +500,7 @@ ItemHandlers::BattleUseOnPokemon.add(:ELIXIR,proc { |item,pokemon,battler,choice
|
||||
|
||||
ItemHandlers::BattleUseOnPokemon.add(:MAXELIXIR,proc { |item,pokemon,battler,choices,scene|
|
||||
for i in 0...pokemon.moves.length
|
||||
pbBattleRestorePP(pokemon,battler,i,pokemon.moves[i].totalpp)
|
||||
pbBattleRestorePP(pokemon,battler,i,pokemon.moves[i].total_pp)
|
||||
end
|
||||
scene.pbDisplay(_INTL("PP was restored."))
|
||||
})
|
||||
|
||||
@@ -103,6 +103,8 @@ class Pokemon
|
||||
EV_STAT_LIMIT = 252
|
||||
# Maximum length a Pokémon's nickname can be
|
||||
MAX_NAME_SIZE = 10
|
||||
# Maximum number of moves a Pokémon can know at once
|
||||
MAX_MOVES = 4
|
||||
|
||||
#=============================================================================
|
||||
# Ownership, obtained information
|
||||
@@ -495,18 +497,15 @@ class Pokemon
|
||||
|
||||
# @return [Integer] the number of moves known by the Pokémon
|
||||
def numMoves
|
||||
ret = 0
|
||||
@moves.each { |m| ret += 1 if m && m.id != 0 }
|
||||
return ret
|
||||
return @moves.length
|
||||
end
|
||||
|
||||
# @param move [Integer, Symbol, String] ID of the move to check
|
||||
# @return [Boolean] whether the Pokémon knows the given move
|
||||
def hasMove?(move)
|
||||
move = getID(PBMoves, move)
|
||||
return false if !move || move <= 0
|
||||
@moves.each { |m| return true if m && m.id == move }
|
||||
return false
|
||||
def hasMove?(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return false if !move_data
|
||||
return @moves.any? { |m| m.id == move_data.id }
|
||||
end
|
||||
alias knowsMove? hasMove?
|
||||
|
||||
@@ -518,101 +517,79 @@ class Pokemon
|
||||
|
||||
# Sets this Pokémon's movelist to the default movelist it originally had.
|
||||
def resetMoves
|
||||
lvl = self.level
|
||||
fullMoveList = self.getMoveList
|
||||
moveList = []
|
||||
fullMoveList.each { |m| moveList.push(m[1]) if m[0] <= lvl }
|
||||
moveList = moveList.reverse
|
||||
moveList |= [] # Remove duplicates
|
||||
moveList = moveList.reverse
|
||||
listend = moveList.length - 4
|
||||
listend = 0 if listend < 0
|
||||
j = 0
|
||||
for i in listend...listend+4
|
||||
moveid = (i >= moveList.length) ? 0 : moveList[i]
|
||||
@moves[j] = PBMove.new(moveid)
|
||||
j += 1
|
||||
this_level = self.level
|
||||
# Find all level-up moves that self could have learned
|
||||
moveset = self.getMoveList
|
||||
knowable_moves = []
|
||||
moveset.each { |m| knowable_moves.push(m[1]) if m[0] <= this_level }
|
||||
# Remove duplicates (retaining the latest copy of each move)
|
||||
knowable_moves = knowable_moves.reverse
|
||||
knowable_moves |= []
|
||||
knowable_moves = knowable_moves.reverse
|
||||
# Add all moves
|
||||
@moves.clear
|
||||
first_move_index = knowable_moves.length - MAX_MOVES
|
||||
first_move_index = 0 if first_move_index < 0
|
||||
for i in first_move_index...knowable_moves.length
|
||||
@moves.push(PBMove.new(knowable_moves[i]))
|
||||
end
|
||||
end
|
||||
|
||||
# Silently learns the given move. Will erase the first known move if it has to.
|
||||
# @param move [Integer, Symbol, String] ID of the move to learn
|
||||
def pbLearnMove(move)
|
||||
move = getID(PBMoves, move)
|
||||
return if move <= 0
|
||||
for i in 0...4 # Already knows move, relocate it to the end of the list
|
||||
next if @moves[i].id != move
|
||||
j = i + 1
|
||||
while j < 4
|
||||
break if @moves[j].id == 0
|
||||
tmp = @moves[j]
|
||||
@moves[j] = @moves[j - 1]
|
||||
@moves[j - 1] = tmp
|
||||
j += 1
|
||||
end
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to learn
|
||||
def pbLearnMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return if !move_data
|
||||
# Check if self already knows the move; if so, move it to the end of the array
|
||||
@moves.each_with_index do |m, i|
|
||||
next if m.id != move_data.id
|
||||
@moves.push(m)
|
||||
@moves.delete_at(i)
|
||||
return
|
||||
end
|
||||
for i in 0...4 # Has empty move slot, put move in there
|
||||
next if @moves[i].id != 0
|
||||
@moves[i] = PBMove.new(move)
|
||||
return
|
||||
end
|
||||
# Already knows 4 moves, forget the first move and learn the new move
|
||||
@moves[0] = @moves[1]
|
||||
@moves[1] = @moves[2]
|
||||
@moves[2] = @moves[3]
|
||||
@moves[3] = PBMove.new(move)
|
||||
# Move is not already known; learn it
|
||||
@moves.push(PBMove.new(move_data.id))
|
||||
# Delete the first known move if self now knows more moves than it should
|
||||
@moves.shift if numMoves > MAX_MOVES
|
||||
end
|
||||
|
||||
# Deletes the given move from the Pokémon.
|
||||
# @param move [Integer, Symbol, String] ID of the move to delete
|
||||
def pbDeleteMove(move)
|
||||
move = getID(PBMoves,move)
|
||||
return if !move || move <= 0
|
||||
newMoves = []
|
||||
@moves.each { |m| newMoves.push(m) if m && m.id != move }
|
||||
newMoves.push(PBMove.new(0))
|
||||
for i in 0...4
|
||||
@moves[i] = newMoves[i]
|
||||
end
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to delete
|
||||
def pbDeleteMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return if !move_data
|
||||
@moves.delete_if { |m| m.id == move_data.id }
|
||||
end
|
||||
|
||||
# Deletes the move at the given index from the Pokémon.
|
||||
# @param index [Integer] index of the move to be deleted
|
||||
def pbDeleteMoveAtIndex(index)
|
||||
newMoves = []
|
||||
@moves.each_with_index { |m, i| newMoves.push(m) if m && i != index }
|
||||
newMoves.push(PBMove.new(0))
|
||||
for i in 0...4
|
||||
@moves[i] = newMoves[i]
|
||||
end
|
||||
@moves.delete_at(index)
|
||||
end
|
||||
|
||||
# Deletes all moves from the Pokémon.
|
||||
def pbDeleteAllMoves
|
||||
for i in 0...4
|
||||
@moves[i] = PBMove.new(0)
|
||||
end
|
||||
@moves = []
|
||||
end
|
||||
|
||||
# Copies currently known moves into a separate array, for Move Relearner.
|
||||
def pbRecordFirstMoves
|
||||
@firstmoves = []
|
||||
@moves.each { |m| @firstmoves.push(m.id) if m && m.id > 0 }
|
||||
@moves.each { |m| @firstmoves.push(m.id) }
|
||||
end
|
||||
|
||||
# Adds a move to this Pokémon's first moves.
|
||||
# @param move [Integer, Symbol, String] ID of the move to add
|
||||
def pbAddFirstMove(move)
|
||||
move = getID(PBMoves, move)
|
||||
@firstmoves.push(move) if move > 0 && !@firstmoves.include?(move)
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to add
|
||||
def pbAddFirstMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@firstmoves.push(move_data.id) if move_data && !@firstmoves.include?(move_data.id)
|
||||
end
|
||||
|
||||
# Removes a move from this Pokémon's first moves.
|
||||
# @param move [Integer, Symbol, String] ID of the move to remove
|
||||
def pbRemoveFirstMove(move)
|
||||
move = getID(PBMoves, move)
|
||||
@firstmoves.delete(move) if move > 0
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to remove
|
||||
def pbRemoveFirstMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@firstmoves.delete(move_data.id) if move_data
|
||||
end
|
||||
|
||||
# Clears this Pokémon's first moves.
|
||||
@@ -622,8 +599,8 @@ class Pokemon
|
||||
|
||||
# @param move [Integer, Symbol, String] ID of the move to check
|
||||
# @return [Boolean] whether the Pokémon is compatible with the given move
|
||||
def compatibleWithMove?(move)
|
||||
return pbSpeciesCompatible?(self.fSpecies, move)
|
||||
def compatibleWithMove?(move_id)
|
||||
return pbSpeciesCompatible?(self.fSpecies, move_id)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -830,9 +807,9 @@ class Pokemon
|
||||
def healPP(move_index = -1)
|
||||
return if egg?
|
||||
if move_index >= 0
|
||||
@moves[move_index].pp = @moves[move_index].totalpp
|
||||
@moves[move_index].pp = @moves[move_index].total_pp
|
||||
else
|
||||
@moves.each { |m| m.pp = m.totalpp }
|
||||
@moves.each { |m| m.pp = m.total_pp }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1107,12 +1084,6 @@ class Pokemon
|
||||
calcStats
|
||||
@hp = @totalhp
|
||||
@happiness = pbGetSpeciesData(@species, formSimple, SpeciesData::HAPPINESS)
|
||||
if withMoves
|
||||
self.resetMoves
|
||||
else
|
||||
for i in 0...4
|
||||
@moves[i] = PBMove.new(0)
|
||||
end
|
||||
end
|
||||
self.resetMoves if withMoves
|
||||
end
|
||||
end
|
||||
|
||||
@@ -270,48 +270,48 @@ MultipleForms.register(:CHERRIM,{
|
||||
})
|
||||
|
||||
MultipleForms.register(:ROTOM,{
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
formMoves = [
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
form_moves = [
|
||||
:OVERHEAT, # Heat, Microwave
|
||||
:HYDROPUMP, # Wash, Washing Machine
|
||||
:BLIZZARD, # Frost, Refrigerator
|
||||
:AIRSLASH, # Fan
|
||||
:LEAFSTORM # Mow, Lawnmower
|
||||
]
|
||||
idxMoveToReplace = -1
|
||||
pkmn.moves.each_with_index do |move,i|
|
||||
next if !move
|
||||
formMoves.each do |newMove|
|
||||
next if !isConst?(move.id,PBMoves,newMove)
|
||||
idxMoveToReplace = i
|
||||
break
|
||||
end
|
||||
break if idxMoveToReplace>=0
|
||||
move_index = -1
|
||||
pkmn.moves.each_with_index do |move, i|
|
||||
next if !form_moves.any? { |m| move == m }
|
||||
move_index = i
|
||||
break
|
||||
end
|
||||
if form==0
|
||||
if idxMoveToReplace>=0
|
||||
moveName = PBMoves.getName(pkmn.moves[idxMoveToReplace].id)
|
||||
pkmn.pbDeleteMoveAtIndex(idxMoveToReplace)
|
||||
pbMessage(_INTL("{1} forgot {2}...",pkmn.name,moveName))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves==0
|
||||
if form == 0
|
||||
# Turned back into the base form; forget form-specific moves
|
||||
if move_index >= 0
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.pbDeleteMoveAtIndex(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
newMove = getConst(PBMoves,formMoves[form-1])
|
||||
if idxMoveToReplace>=0
|
||||
oldMoveName = PBMoves.getName(pkmn.moves[idxMoveToReplace].id)
|
||||
if newMove && newMove>0
|
||||
newMoveName = PBMoves.getName(newMove)
|
||||
pkmn.moves[idxMoveToReplace].id = newMove
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
new_move_id = form_moves[form - 1]
|
||||
if move_index >= 0
|
||||
# Knows another form's unique move; replace it
|
||||
old_move_name = pkmn.moves[move_index].name
|
||||
if GameData::Move.exists?(new_move_id)
|
||||
pkmn.moves[move_index].id = new_move_id
|
||||
new_move_name = pkmn.moves[move_index].name
|
||||
pbMessage(_INTL("1,\\wt[16] 2, and\\wt[16]...\\wt[16] ...\\wt[16] ... Ta-da!\\se[Battle ball drop]\1"))
|
||||
pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1",pkmn.name,oldMoveName))
|
||||
pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]",pkmn.name,newMoveName))
|
||||
pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1", pkmn.name, old_move_name))
|
||||
pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]", pkmn.name, new_move_name))
|
||||
else
|
||||
pkmn.pbDeleteMoveAtIndex(idxMoveToReplace)
|
||||
pbMessage(_INTL("{1} forgot {2}...",pkmn.name,oldMoveName))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves==0
|
||||
pkmn.pbDeleteMoveAtIndex(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, old_move_name))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
elsif newMove && newMove>0
|
||||
pbLearnMove(pkmn,newMove,true)
|
||||
else
|
||||
# Just try to learn this form's unique move
|
||||
pbLearnMove(pkmn, new_move_id, true)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -396,39 +396,26 @@ MultipleForms.register(:KYUREM,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next pkmn.form-2 if pkmn.form>=3 # Fused forms stop glowing
|
||||
},
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
case form
|
||||
when 0 # Normal
|
||||
pkmn.moves.each do |move|
|
||||
next if !move
|
||||
if (isConst?(move.id,PBMoves,:ICEBURN) ||
|
||||
isConst?(move.id,PBMoves,:FREEZESHOCK)) && hasConst?(PBMoves,:GLACIATE)
|
||||
move.id = getConst(PBMoves,:GLACIATE)
|
||||
if [:ICEBURN, :FREEZESHOCK].include?(move.id)
|
||||
move.id = :GLACIATE if GameData::Move.exists?(:GLACIATE)
|
||||
end
|
||||
if (isConst?(move.id,PBMoves,:FUSIONFLARE) ||
|
||||
isConst?(move.id,PBMoves,:FUSIONBOLT)) && hasConst?(PBMoves,:SCARYFACE)
|
||||
move.id = getConst(PBMoves,:SCARYFACE)
|
||||
if [:FUSIONFLARE, :FUSIONBOLT].include?(move.id)
|
||||
move.id = :SCARYFACE if GameData::Move.exists?(:SCARYFACE)
|
||||
end
|
||||
end
|
||||
when 1 # White
|
||||
pkmn.moves.each do |move|
|
||||
next if !move
|
||||
if isConst?(move.id,PBMoves,:GLACIATE) && hasConst?(PBMoves,:ICEBURN)
|
||||
move.id = getConst(PBMoves,:ICEBURN)
|
||||
end
|
||||
if isConst?(move.id,PBMoves,:SCARYFACE) && hasConst?(PBMoves,:FUSIONFLARE)
|
||||
move.id = getConst(PBMoves,:FUSIONFLARE)
|
||||
end
|
||||
move.id = :ICEBURN if move == :GLACIATE && GameData::Move.exists?(:ICEBURN)
|
||||
move.id = :FUSIONFLARE if move == :SCARYFACE && GameData::Move.exists?(:FUSIONFLARE)
|
||||
end
|
||||
when 2 # Black
|
||||
pkmn.moves.each do |move|
|
||||
next if !move
|
||||
if isConst?(move.id,PBMoves,:GLACIATE) && hasConst?(PBMoves,:FREEZESHOCK)
|
||||
move.id = getConst(PBMoves,:FREEZESHOCK)
|
||||
end
|
||||
if isConst?(move.id,PBMoves,:SCARYFACE) && hasConst?(PBMoves,:FUSIONBOLT)
|
||||
move.id = getConst(PBMoves,:FUSIONBOLT)
|
||||
end
|
||||
move.id = :FREEZESHOCK if move == :GLACIATE && GameData::Move.exists?(:FREEZESHOCK)
|
||||
move.id = :FUSIONBOLT if move == :SCARYFACE && GameData::Move.exists?(:FUSIONBOLT)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -629,34 +616,30 @@ MultipleForms.register(:NECROZMA,{
|
||||
# Fused forms are 1 and 2, Ultra form is 3 or 4 depending on which fusion
|
||||
next pkmn.form-2 if pkmn.form>=3 && (pkmn.fainted? || endBattle)
|
||||
},
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
next if form>2 || oldForm>2 # Ultra form changes don't affect moveset
|
||||
formMoves = [
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
next if form > 2 || oldForm > 2 # Ultra form changes don't affect moveset
|
||||
form_moves = [
|
||||
:SUNSTEELSTRIKE, # Dusk Mane (with Solgaleo) (form 1)
|
||||
:MOONGEISTBEAM # Dawn Wings (with Lunala) (form 2)
|
||||
]
|
||||
if form==0
|
||||
idxMoveToReplace = -1
|
||||
pkmn.moves.each_with_index do |move,i|
|
||||
next if !move
|
||||
formMoves.each do |newMove|
|
||||
next if !isConst?(move.id,PBMoves,newMove)
|
||||
idxMoveToReplace = i
|
||||
break
|
||||
end
|
||||
break if idxMoveToReplace>=0
|
||||
if form == 0
|
||||
# Turned back into the base form; forget form-specific moves
|
||||
move_index = -1
|
||||
pkmn.moves.each_with_index do |move, i|
|
||||
next if !form_moves.any? { |m| move == m }
|
||||
move_index = i
|
||||
break
|
||||
end
|
||||
if idxMoveToReplace>=0
|
||||
moveName = PBMoves.getName(pkmn.moves[idxMoveToReplace].id)
|
||||
pkmn.pbDeleteMoveAtIndex(idxMoveToReplace)
|
||||
pbMessage(_INTL("{1} forgot {2}...",pkmn.name,moveName))
|
||||
pkmn.pbLearnMove(:CONFUSION) if pkmn.numMoves==0
|
||||
if move_index >= 0
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.pbDeleteMoveAtIndex(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pkmn.pbLearnMove(:CONFUSION) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
newMove = getConst(PBMoves,formMoves[form-1])
|
||||
if newMove && newMove>0
|
||||
pbLearnMove(pkmn,newMove,true)
|
||||
end
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
new_move_id = form_moves[form - 1]
|
||||
pbLearnMove(pkmn, new_move_id, true)
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
@@ -16,8 +16,8 @@ class Pokemon
|
||||
ret = i; break
|
||||
end
|
||||
if !checkItemOnly
|
||||
megaMove = speciesData[fSpec][SpeciesData::MEGA_MOVE] || 0
|
||||
if megaMove>0 && self.hasMove?(megaMove)
|
||||
megaMove = speciesData[fSpec][SpeciesData::MEGA_MOVE]
|
||||
if self.hasMove?(megaMove)
|
||||
ret = i; break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,13 +22,12 @@ def pbPurify(pokemon,scene)
|
||||
pokemon.shadow = false
|
||||
pokemon.giveRibbon(PBRibbons::NATIONAL)
|
||||
scene.pbDisplay(_INTL("{1} opened the door to its heart!",pokemon.name))
|
||||
oldmoves = []
|
||||
for i in 0...4; oldmoves.push(pokemon.moves[i].id); end
|
||||
old_moves = []
|
||||
pokemon.moves.each { |m| old_moves.push(m.id) }
|
||||
pokemon.pbUpdateShadowMoves
|
||||
for i in 0...4
|
||||
next if pokemon.moves[i].id<=0 || pokemon.moves[i].id==oldmoves[i]
|
||||
scene.pbDisplay(_INTL("{1} regained the move \n{2}!",
|
||||
pokemon.name,PBMoves.getName(pokemon.moves[i].id)))
|
||||
pokemon.moves.each_with_index do |m, i|
|
||||
next if m == old_moves[i]
|
||||
scene.pbDisplay(_INTL("{1} regained the move {2}!", pokemon.name, m.name))
|
||||
end
|
||||
pokemon.pbRecordFirstMoves
|
||||
if pokemon.savedev
|
||||
@@ -75,31 +74,23 @@ def pbApplyEVGain(pokemon,ev,evgain)
|
||||
end
|
||||
end
|
||||
|
||||
def pbReplaceMoves(pokemon,move1,move2=0,move3=0,move4=0)
|
||||
return if !pokemon
|
||||
[move1,move2,move3,move4].each { |move|
|
||||
moveIndex = -1
|
||||
if move!=0
|
||||
# Look for given move
|
||||
for i in 0...4
|
||||
moveIndex = i if pokemon.moves[i].id==move
|
||||
def pbReplaceMoves(pkmn, new_moves)
|
||||
return if !pkmn
|
||||
new_moves.each do |move|
|
||||
next if !move || pkmn.hasMove?(move)
|
||||
# Find a move slot to put move into
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
if i >= pkmn.numMoves
|
||||
# Empty slot; add the new move there
|
||||
pkmn.pbLearnMove(move)
|
||||
break
|
||||
elsif !new_moves.include?(pkmn.moves[i].id)
|
||||
# Known move that isn't a move to be relearned; replace it
|
||||
pkmn.moves[i].id = move
|
||||
break
|
||||
end
|
||||
end
|
||||
if moveIndex==-1
|
||||
# Look for slot to replace move
|
||||
for i in 0...4
|
||||
if (pokemon.moves[i].id==0 && move!=0) || (
|
||||
pokemon.moves[i].id!=move1 &&
|
||||
pokemon.moves[i].id!=move2 &&
|
||||
pokemon.moves[i].id!=move3 &&
|
||||
pokemon.moves[i].id!=move4)
|
||||
# Replace move
|
||||
pokemon.moves[i] = PBMove.new(move)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -288,47 +279,57 @@ class Pokemon
|
||||
self.heartgauge = HEARTGAUGESIZE
|
||||
self.savedexp = 0
|
||||
self.savedev = [0,0,0,0,0,0]
|
||||
self.shadowmoves = [0,0,0,0,0,0,0,0]
|
||||
# Retrieve shadow moves
|
||||
moves = pbLoadShadowMovesets
|
||||
if moves[self.species] && moves[self.species].length>0
|
||||
for i in 0...[4,moves[self.species].length].min
|
||||
self.shadowmoves[i] = moves[self.species][i]
|
||||
self.shadowmoves = []
|
||||
# Retrieve Shadow moveset for this Pokémon
|
||||
shadow_moveset = pbLoadShadowMovesets[self.fSpecies]
|
||||
shadow_moveset = pbLoadShadowMovesets[self.species] if !shadow_moveset || shadow_moveset.length == 0
|
||||
# Record this Pokémon's Shadow moves
|
||||
if shadow_moveset && shadow_moveset.length > 0
|
||||
for i in 0...[shadow_moveset.length, MAX_MOVES].min
|
||||
self.shadowmoves[i] = shadow_moveset[i]
|
||||
end
|
||||
self.shadowmovenum = moves[self.species].length
|
||||
self.shadowmovenum = shadow_moveset.length
|
||||
else
|
||||
# No special shadow moves
|
||||
self.shadowmoves[0] = getConst(PBMoves,:SHADOWRUSH) || 0
|
||||
# No Shadow moveset defined; just use Shadow Rush
|
||||
self.shadowmoves[0] = :SHADOWRUSH if GameData::Move.exists?(:SHADOWRUSH)
|
||||
self.shadowmovenum = 1
|
||||
end
|
||||
for i in 0...4 # Save old moves
|
||||
self.shadowmoves[4+i] = self.moves[i].id
|
||||
end
|
||||
# Record this Pokémon's original moves
|
||||
@moves.each_with_index { |m, i| self.shadowmoves[MAX_MOVES + i] = m.id }
|
||||
# Update moves
|
||||
pbUpdateShadowMoves
|
||||
end
|
||||
|
||||
def pbUpdateShadowMoves(allmoves=false)
|
||||
def pbUpdateShadowMoves(relearn_all_moves = false)
|
||||
return if !@shadowmoves
|
||||
m = @shadowmoves
|
||||
# Not a Shadow Pokémon (any more); relearn all its original moves
|
||||
if !@shadow
|
||||
# No shadow moves
|
||||
pbReplaceMoves(self,m[4],m[5],m[6],m[7])
|
||||
@shadowmoves = nil
|
||||
else
|
||||
moves = []
|
||||
relearning = (allmoves) ? 3 : [3,3,2,1,1,0][self.heartStage]
|
||||
relearned = 0
|
||||
# Add all Shadow moves
|
||||
for i in 0...4; moves.push(m[i]) if m[i]!=0; end
|
||||
# Add X regular moves
|
||||
for i in 0...4
|
||||
next if i<@shadowmovenum
|
||||
if m[i+4]!=0 && relearned<relearning
|
||||
moves.push(m[i+4]); relearned += 1
|
||||
end
|
||||
if @shadowmoves.length > MAX_MOVES
|
||||
new_moves = []
|
||||
@shadowmoves.each_with_index { |m, i| new_moves.push(m) if m && i >= MAX_MOVES }
|
||||
pbReplaceMoves(self, new_moves)
|
||||
end
|
||||
pbReplaceMoves(self,moves[0] || 0,moves[1] || 0,moves[2] || 0,moves[3] || 0)
|
||||
@shadowmoves = nil
|
||||
return
|
||||
end
|
||||
# Is a Shadow Pokémon; ensure it knows the appropriate moves depending on its heart stage
|
||||
m = @shadowmoves
|
||||
# Start with all Shadow moves
|
||||
new_moves = []
|
||||
@shadowmoves.each_with_index { |m, i| new_moves.push(m) if m && i < MAX_MOVES }
|
||||
# Add some original moves (skipping ones in the same slot as a Shadow Move)
|
||||
num_original_moves = (relearn_all_moves) ? 3 : [3, 3, 2, 1, 1, 0][self.heartStage]
|
||||
if num_original_moves > 0
|
||||
relearned_count = 0
|
||||
@shadowmoves.each_with_index do |m, i|
|
||||
next if !m || i < MAX_MOVES + @shadowmovenum
|
||||
new_moves.push(m)
|
||||
relearned_count += 1
|
||||
break if relearned_count >= num_original_moves
|
||||
end
|
||||
end
|
||||
# Relearn Shadow moves plus some original moves (may not change anything)
|
||||
pbReplaceMoves(self, new_moves)
|
||||
end
|
||||
|
||||
alias :__shadow_clone :clone
|
||||
|
||||
@@ -493,7 +493,7 @@ PBEvolution.register(:HappinessNight, {
|
||||
|
||||
PBEvolution.register(:HappinessMove, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"parameterType" => :PBMoves,
|
||||
"parameterType" => :Move,
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
if pkmn.happiness >= 220
|
||||
next pkmn.moves.any? { |m| m && m.id == parameter }
|
||||
@@ -619,7 +619,7 @@ PBEvolution.register(:HoldItemHappiness, {
|
||||
|
||||
PBEvolution.register(:HasMove, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"parameterType" => :PBMoves,
|
||||
"parameterType" => :Move,
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
next pkmn.moves.any? { |m| m && m.id == parameter }
|
||||
}
|
||||
|
||||
@@ -4,75 +4,75 @@
|
||||
#===============================================================================
|
||||
|
||||
# @deprecated Use {Pokemon} instead. PokeBattle_Pokemon has been turned into an alias
|
||||
# and is slated to be removed in vXX.
|
||||
# and is slated to be removed in v20.
|
||||
class PokeBattle_Pokemon; end
|
||||
|
||||
PokeBattle_Pokemon = Pokemon
|
||||
|
||||
class Pokemon
|
||||
# @deprecated Use {MAX_NAME_SIZE} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {MAX_NAME_SIZE} instead. This alias is slated to be removed in v20.
|
||||
MAX_POKEMON_NAME_SIZE = MAX_NAME_SIZE
|
||||
|
||||
# @deprecated Use {Owner#public_id} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#public_id} instead. This alias is slated to be removed in v20.
|
||||
def publicID
|
||||
Deprecation.warn_method('Pokemon#publicID', 'vXX', 'Pokemon::Owner#public_id')
|
||||
Deprecation.warn_method('Pokemon#publicID', 'v20', 'Pokemon::Owner#public_id')
|
||||
return @owner.public_id
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#id} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#id} instead. This alias is slated to be removed in v20.
|
||||
def trainerID
|
||||
Deprecation.warn_method('Pokemon#trainerID', 'vXX', 'Pokemon::Owner#id')
|
||||
Deprecation.warn_method('Pokemon#trainerID', 'v20', 'Pokemon::Owner#id')
|
||||
return @owner.id
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#id=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#id=} instead. This alias is slated to be removed in v20.
|
||||
def trainerID=(value)
|
||||
Deprecation.warn_method('Pokemon#trainerID=', 'vXX', 'Pokemon::Owner#id=')
|
||||
Deprecation.warn_method('Pokemon#trainerID=', 'v20', 'Pokemon::Owner#id=')
|
||||
@owner.id = value
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#name} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#name} instead. This alias is slated to be removed in v20.
|
||||
def ot
|
||||
Deprecation.warn_method('Pokemon#ot', 'vXX', 'Pokemon::Owner#name')
|
||||
Deprecation.warn_method('Pokemon#ot', 'v20', 'Pokemon::Owner#name')
|
||||
return @owner.name
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#name=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#name=} instead. This alias is slated to be removed in v20.
|
||||
def ot=(value)
|
||||
Deprecation.warn_method('Pokemon#ot=', 'vXX', 'Pokemon::Owner#name=')
|
||||
Deprecation.warn_method('Pokemon#ot=', 'v20', 'Pokemon::Owner#name=')
|
||||
@owner.name = value
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#gender} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#gender} instead. This alias is slated to be removed in v20.
|
||||
def otgender
|
||||
Deprecation.warn_method('Pokemon#otgender', 'vXX', 'Pokemon::Owner#gender')
|
||||
Deprecation.warn_method('Pokemon#otgender', 'v20', 'Pokemon::Owner#gender')
|
||||
return @owner.gender
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#gender=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#gender=} instead. This alias is slated to be removed in v20.
|
||||
def otgender=(value)
|
||||
Deprecation.warn_method('Pokemon#otgender=', 'vXX', 'Pokemon::Owner#gender=')
|
||||
Deprecation.warn_method('Pokemon#otgender=', 'v20', 'Pokemon::Owner#gender=')
|
||||
@owner.gender = value
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#language} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#language} instead. This alias is slated to be removed in v20.
|
||||
def language
|
||||
Deprecation.warn_method('Pokemon#language', 'vXX', 'Pokemon::Owner#language')
|
||||
Deprecation.warn_method('Pokemon#language', 'v20', 'Pokemon::Owner#language')
|
||||
return @owner.language
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#language=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#language=} instead. This alias is slated to be removed in v20.
|
||||
def language=(value)
|
||||
Deprecation.warn_method('Pokemon#language=', 'vXX', 'Pokemon::Owner#language=')
|
||||
Deprecation.warn_method('Pokemon#language=', 'v20', 'Pokemon::Owner#language=')
|
||||
@owner.language = value
|
||||
end
|
||||
end
|
||||
|
||||
# (see Pokemon#initialize)
|
||||
# @deprecated Use +Pokemon.new+ instead. This method and its aliases are
|
||||
# slated to be removed in vXX.
|
||||
# slated to be removed in v20.
|
||||
def pbNewPkmn(species, level, owner = $Trainer, withMoves = true)
|
||||
Deprecation.warn_method('pbNewPkmn', 'vXX', 'Pokemon.new')
|
||||
Deprecation.warn_method('pbNewPkmn', 'v20', 'Pokemon.new')
|
||||
return Pokemon.new(species, level, owner, withMoves)
|
||||
end
|
||||
alias pbGenPkmn pbNewPkmn
|
||||
|
||||
@@ -941,10 +941,10 @@ class PokemonPartyScreen
|
||||
movenames = []
|
||||
for i in pokemon.moves
|
||||
break if i.id==0
|
||||
if i.totalpp<=0
|
||||
movenames.push(_INTL("{1} (PP: ---)",PBMoves.getName(i.id)))
|
||||
if i.total_pp<=0
|
||||
movenames.push(_INTL("{1} (PP: ---)",i.name))
|
||||
else
|
||||
movenames.push(_INTL("{1} (PP: {2}/{3})",PBMoves.getName(i.id),i.pp,i.totalpp))
|
||||
movenames.push(_INTL("{1} (PP: {2}/{3})",i.name,i.pp,i.total_pp))
|
||||
end
|
||||
end
|
||||
return @scene.pbShowCommands(helptext,movenames,index)
|
||||
@@ -1129,20 +1129,20 @@ class PokemonPartyScreen
|
||||
commands = []
|
||||
cmdSummary = -1
|
||||
cmdDebug = -1
|
||||
cmdMoves = [-1,-1,-1,-1]
|
||||
cmdMoves = [-1] * pkmn.numMoves
|
||||
cmdSwitch = -1
|
||||
cmdMail = -1
|
||||
cmdItem = -1
|
||||
# Build the commands
|
||||
commands[cmdSummary = commands.length] = _INTL("Summary")
|
||||
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
|
||||
for i in 0...pkmn.moves.length
|
||||
move = pkmn.moves[i]
|
||||
if !pkmn.egg?
|
||||
# Check for hidden moves and add any that were found
|
||||
if !pkmn.egg? && (isConst?(move.id,PBMoves,:MILKDRINK) ||
|
||||
isConst?(move.id,PBMoves,:SOFTBOILED) ||
|
||||
HiddenMoveHandlers.hasHandler(move.id))
|
||||
commands[cmdMoves[i] = commands.length] = [PBMoves.getName(move.id),1]
|
||||
pkmn.moves.each_with_index do |m, i|
|
||||
if [:MILKDRINK, :SOFTBOILED].include?(m.id) ||
|
||||
HiddenMoveHandlers.hasHandler(m.id)
|
||||
commands[cmdMoves[i] = commands.length] = [m.name, 1]
|
||||
end
|
||||
end
|
||||
end
|
||||
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
|
||||
@@ -1156,60 +1156,56 @@ class PokemonPartyScreen
|
||||
commands[commands.length] = _INTL("Cancel")
|
||||
command = @scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),commands)
|
||||
havecommand = false
|
||||
for i in 0...4
|
||||
if cmdMoves[i]>=0 && command==cmdMoves[i]
|
||||
havecommand = true
|
||||
if isConst?(pkmn.moves[i].id,PBMoves,:SOFTBOILED) ||
|
||||
isConst?(pkmn.moves[i].id,PBMoves,:MILKDRINK)
|
||||
amt = [(pkmn.totalhp/5).floor,1].max
|
||||
if pkmn.hp<=amt
|
||||
pbDisplay(_INTL("Not enough HP..."))
|
||||
cmdMoves.each_with_index do |cmd, i|
|
||||
next if cmd < 0 || cmd != command
|
||||
havecommand = true
|
||||
if [:MILKDRINK, :SOFTBOILED].include?(pkmn.moves[i].id)
|
||||
amt = [(pkmn.totalhp/5).floor,1].max
|
||||
if pkmn.hp<=amt
|
||||
pbDisplay(_INTL("Not enough HP..."))
|
||||
break
|
||||
end
|
||||
@scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
|
||||
oldpkmnid = pkmnid
|
||||
loop do
|
||||
@scene.pbPreSelect(oldpkmnid)
|
||||
pkmnid = @scene.pbChoosePokemon(true,pkmnid)
|
||||
break if pkmnid<0
|
||||
newpkmn = @party[pkmnid]
|
||||
movename = pkmn.moves[i].name
|
||||
if pkmnid==oldpkmnid
|
||||
pbDisplay(_INTL("{1} can't use {2} on itself!",pkmn.name,movename))
|
||||
elsif newpkmn.egg?
|
||||
pbDisplay(_INTL("{1} can't be used on an Egg!",movename))
|
||||
elsif newpkmn.hp==0 || newpkmn.hp==newpkmn.totalhp
|
||||
pbDisplay(_INTL("{1} can't be used on that Pokémon.",movename))
|
||||
else
|
||||
pkmn.hp -= amt
|
||||
hpgain = pbItemRestoreHP(newpkmn,amt)
|
||||
@scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",newpkmn.name,hpgain))
|
||||
pbRefresh
|
||||
end
|
||||
break if pkmn.hp<=amt
|
||||
end
|
||||
@scene.pbSelect(oldpkmnid)
|
||||
pbRefresh
|
||||
break
|
||||
elsif pbCanUseHiddenMove?(pkmn,pkmn.moves[i].id)
|
||||
if pbConfirmUseHiddenMove(pkmn,pkmn.moves[i].id)
|
||||
@scene.pbEndScene
|
||||
if pkmn.moves[i].id == :FLY
|
||||
scene = PokemonRegionMap_Scene.new(-1,false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartFlyScreen
|
||||
if ret
|
||||
$PokemonTemp.flydata=ret
|
||||
return [pkmn,pkmn.moves[i].id]
|
||||
end
|
||||
@scene.pbStartScene(@party,
|
||||
(@party.length>1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
|
||||
break
|
||||
end
|
||||
@scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
|
||||
oldpkmnid = pkmnid
|
||||
loop do
|
||||
@scene.pbPreSelect(oldpkmnid)
|
||||
pkmnid = @scene.pbChoosePokemon(true,pkmnid)
|
||||
break if pkmnid<0
|
||||
newpkmn = @party[pkmnid]
|
||||
movename = PBMoves.getName(pkmn.moves[i].id)
|
||||
if pkmnid==oldpkmnid
|
||||
pbDisplay(_INTL("{1} can't use {2} on itself!",pkmn.name,movename))
|
||||
elsif newpkmn.egg?
|
||||
pbDisplay(_INTL("{1} can't be used on an Egg!",movename))
|
||||
elsif newpkmn.hp==0 || newpkmn.hp==newpkmn.totalhp
|
||||
pbDisplay(_INTL("{1} can't be used on that Pokémon.",movename))
|
||||
else
|
||||
pkmn.hp -= amt
|
||||
hpgain = pbItemRestoreHP(newpkmn,amt)
|
||||
@scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",newpkmn.name,hpgain))
|
||||
pbRefresh
|
||||
end
|
||||
break if pkmn.hp<=amt
|
||||
end
|
||||
@scene.pbSelect(oldpkmnid)
|
||||
pbRefresh
|
||||
break
|
||||
elsif pbCanUseHiddenMove?(pkmn,pkmn.moves[i].id)
|
||||
if pbConfirmUseHiddenMove(pkmn,pkmn.moves[i].id)
|
||||
@scene.pbEndScene
|
||||
if isConst?(pkmn.moves[i].id,PBMoves,:FLY)
|
||||
scene = PokemonRegionMap_Scene.new(-1,false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartFlyScreen
|
||||
if ret
|
||||
$PokemonTemp.flydata=ret
|
||||
return [pkmn,pkmn.moves[i].id]
|
||||
end
|
||||
@scene.pbStartScene(@party,
|
||||
(@party.length>1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
|
||||
break
|
||||
end
|
||||
return [pkmn,pkmn.moves[i].id]
|
||||
end
|
||||
else
|
||||
break
|
||||
return [pkmn,pkmn.moves[i].id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ class MoveSelectionSprite < SpriteWrapper
|
||||
self.x = 240
|
||||
self.y = 92+(self.index*64)
|
||||
self.y -= 76 if @fifthmove
|
||||
self.y += 20 if @fifthmove && self.index==4
|
||||
self.y += 20 if @fifthmove && self.index==Pokemon::MAX_MOVES # Add a gap
|
||||
self.bitmap = @movesel.bitmap
|
||||
if self.preselected
|
||||
self.src_rect.set(0,h,w,h)
|
||||
@@ -166,7 +166,7 @@ class PokemonSummary_Scene
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbStartForgetScene(party,partyindex,moveToLearn)
|
||||
def pbStartForgetScene(party,partyindex,move_to_learn)
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@party = party
|
||||
@@ -182,11 +182,12 @@ class PokemonSummary_Scene
|
||||
@sprites["pokeicon"].setOffset(PictureOrigin::Center)
|
||||
@sprites["pokeicon"].x = 46
|
||||
@sprites["pokeicon"].y = 92
|
||||
@sprites["movesel"] = MoveSelectionSprite.new(@viewport,moveToLearn>0)
|
||||
@sprites["movesel"] = MoveSelectionSprite.new(@viewport,!move_to_learn.nil?)
|
||||
@sprites["movesel"].visible = false
|
||||
@sprites["movesel"].visible = true
|
||||
@sprites["movesel"].index = 0
|
||||
drawSelectedMove(moveToLearn,@pokemon.moves[0].id)
|
||||
new_move = (move_to_learn) ? PBMove.new(move_to_learn) : nil
|
||||
drawSelectedMove(new_move,@pokemon.moves[0])
|
||||
pbFadeInAndShow(@sprites)
|
||||
end
|
||||
|
||||
@@ -678,19 +679,19 @@ class PokemonSummary_Scene
|
||||
imagepos = []
|
||||
# Write move names, types and PP amounts for each known move
|
||||
yPos = 98
|
||||
for i in 0...@pokemon.moves.length
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
move=@pokemon.moves[i]
|
||||
if move.id>0
|
||||
if move
|
||||
imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,move.type*28,64,28])
|
||||
textpos.push([PBMoves.getName(move.id),316,yPos,0,moveBase,moveShadow])
|
||||
if move.totalpp>0
|
||||
textpos.push([move.name,316,yPos,0,moveBase,moveShadow])
|
||||
if move.total_pp>0
|
||||
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
||||
ppfraction = 0
|
||||
if move.pp==0; ppfraction = 3
|
||||
elsif move.pp*4<=move.totalpp; ppfraction = 2
|
||||
elsif move.pp*2<=move.totalpp; ppfraction = 1
|
||||
if move.pp==0; ppfraction = 3
|
||||
elsif move.pp*4<=move.total_pp; ppfraction = 2
|
||||
elsif move.pp*2<=move.total_pp; ppfraction = 1
|
||||
end
|
||||
textpos.push([sprintf("%d/%d",move.pp,move.totalpp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
||||
textpos.push([sprintf("%d/%d",move.pp,move.total_pp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
||||
end
|
||||
else
|
||||
textpos.push(["-",316,yPos,0,moveBase,moveShadow])
|
||||
@@ -703,47 +704,7 @@ class PokemonSummary_Scene
|
||||
pbDrawImagePositions(overlay,imagepos)
|
||||
end
|
||||
|
||||
def drawSelectedMove(moveToLearn,moveid)
|
||||
# Draw all of page four, except selected move's details
|
||||
drawMoveSelection(moveToLearn)
|
||||
# Set various values
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(64,64,64)
|
||||
shadow = Color.new(176,176,176)
|
||||
@sprites["pokemon"].visible = false if @sprites["pokemon"]
|
||||
@sprites["pokeicon"].pokemon = @pokemon
|
||||
@sprites["pokeicon"].visible = true
|
||||
@sprites["itemicon"].visible = false if @sprites["itemicon"]
|
||||
# Get data for selected move
|
||||
moveData = pbGetMoveData(moveid)
|
||||
basedamage = moveData[MoveData::BASE_DAMAGE]
|
||||
category = moveData[MoveData::CATEGORY]
|
||||
accuracy = moveData[MoveData::ACCURACY]
|
||||
textpos = []
|
||||
# Write power and accuracy values for selected move
|
||||
if basedamage==0 # Status move
|
||||
textpos.push(["---",216,154,1,base,shadow])
|
||||
elsif basedamage==1 # Variable power move
|
||||
textpos.push(["???",216,154,1,base,shadow])
|
||||
else
|
||||
textpos.push([sprintf("%d",basedamage),216,154,1,base,shadow])
|
||||
end
|
||||
if accuracy==0
|
||||
textpos.push(["---",216,186,1,base,shadow])
|
||||
else
|
||||
textpos.push([sprintf("%d%",accuracy),216+overlay.text_size("%").width,186,1,base,shadow])
|
||||
end
|
||||
# Draw all text
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
# Draw selected move's damage category icon
|
||||
imagepos = [["Graphics/Pictures/category",166,124,0,category*28,64,28]]
|
||||
pbDrawImagePositions(overlay,imagepos)
|
||||
# Draw selected move's description
|
||||
drawTextEx(overlay,4,218,230,5,
|
||||
pbGetMessage(MessageTypes::MoveDescriptions,moveid),base,shadow)
|
||||
end
|
||||
|
||||
def drawMoveSelection(moveToLearn)
|
||||
def drawPageFourSelecting(move_to_learn)
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
base = Color.new(248,248,248)
|
||||
@@ -759,7 +720,7 @@ class PokemonSummary_Scene
|
||||
Color.new(144,72,24), # 1/4 of total PP or less
|
||||
Color.new(136,48,48)] # Zero PP
|
||||
# Set background image
|
||||
if moveToLearn!=0
|
||||
if move_to_learn
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Summary/bg_learnmove")
|
||||
else
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Summary/bg_movedetail")
|
||||
@@ -774,24 +735,25 @@ class PokemonSummary_Scene
|
||||
imagepos = []
|
||||
# Write move names, types and PP amounts for each known move
|
||||
yPos = 98
|
||||
yPos -= 76 if moveToLearn!=0
|
||||
for i in 0...5
|
||||
yPos -= 76 if move_to_learn
|
||||
limit = (move_to_learn) ? Pokemon::MAX_MOVES + 1 : Pokemon::MAX_MOVES
|
||||
for i in 0...limit
|
||||
move = @pokemon.moves[i]
|
||||
if i==4
|
||||
move = PBMove.new(moveToLearn) if moveToLearn!=0
|
||||
if i==Pokemon::MAX_MOVES
|
||||
move = move_to_learn
|
||||
yPos += 20
|
||||
end
|
||||
if move && move.id>0
|
||||
if move
|
||||
imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,move.type*28,64,28])
|
||||
textpos.push([PBMoves.getName(move.id),316,yPos,0,moveBase,moveShadow])
|
||||
if move.totalpp>0
|
||||
textpos.push([move.name,316,yPos,0,moveBase,moveShadow])
|
||||
if move.total_pp>0
|
||||
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
||||
ppfraction = 0
|
||||
if move.pp==0; ppfraction = 3
|
||||
elsif move.pp*4<=move.totalpp; ppfraction = 2
|
||||
elsif move.pp*2<=move.totalpp; ppfraction = 1
|
||||
if move.pp==0; ppfraction = 3
|
||||
elsif move.pp*4<=move.total_pp; ppfraction = 2
|
||||
elsif move.pp*2<=move.total_pp; ppfraction = 1
|
||||
end
|
||||
textpos.push([sprintf("%d/%d",move.pp,move.totalpp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
||||
textpos.push([sprintf("%d/%d",move.pp,move.total_pp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
||||
end
|
||||
else
|
||||
textpos.push(["-",316,yPos,0,moveBase,moveShadow])
|
||||
@@ -813,6 +775,38 @@ class PokemonSummary_Scene
|
||||
end
|
||||
end
|
||||
|
||||
def drawSelectedMove(move_to_learn, selected_move)
|
||||
# Draw all of page four, except selected move's details
|
||||
drawPageFourSelecting(move_to_learn)
|
||||
# Set various values
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(64, 64, 64)
|
||||
shadow = Color.new(176, 176, 176)
|
||||
@sprites["pokemon"].visible = false if @sprites["pokemon"]
|
||||
@sprites["pokeicon"].pokemon = @pokemon
|
||||
@sprites["pokeicon"].visible = true
|
||||
@sprites["itemicon"].visible = false if @sprites["itemicon"]
|
||||
textpos = []
|
||||
# Write power and accuracy values for selected move
|
||||
case selected_move.base_damage
|
||||
when 0 then textpos.push(["---", 216, 154, 1, base, shadow]) # Status move
|
||||
when 1 then textpos.push(["???", 216, 154, 1, base, shadow]) # Variable power move
|
||||
else textpos.push([selected_move.base_damage.to_s, 216, 154, 1, base, shadow])
|
||||
end
|
||||
if selected_move.accuracy == 0
|
||||
textpos.push(["---", 216, 186, 1, base, shadow])
|
||||
else
|
||||
textpos.push([sprintf("%d%", selected_move.accuracy), 216 + overlay.text_size("%").width, 186, 1, base, shadow])
|
||||
end
|
||||
# Draw all text
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
# Draw selected move's damage category icon
|
||||
imagepos = [["Graphics/Pictures/category", 166, 124, 0, selected_move.category * 28, 64, 28]]
|
||||
pbDrawImagePositions(overlay, imagepos)
|
||||
# Draw selected move's description
|
||||
drawTextEx(overlay, 4, 218, 230, 5, selected_move.description, base, shadow)
|
||||
end
|
||||
|
||||
def drawPageFive
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
@sprites["uparrow"].visible = false
|
||||
@@ -903,7 +897,7 @@ class PokemonSummary_Scene
|
||||
selmove = 0
|
||||
oldselmove = 0
|
||||
switching = false
|
||||
drawSelectedMove(0,@pokemon.moves[selmove].id)
|
||||
drawSelectedMove(nil,@pokemon.moves[selmove])
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -920,7 +914,7 @@ class PokemonSummary_Scene
|
||||
switching = false
|
||||
elsif Input.trigger?(Input::C)
|
||||
pbPlayDecisionSE
|
||||
if selmove==4
|
||||
if selmove==Pokemon::MAX_MOVES
|
||||
break if !switching
|
||||
@sprites["movepresel"].visible = false
|
||||
switching = false
|
||||
@@ -937,30 +931,28 @@ class PokemonSummary_Scene
|
||||
@pokemon.moves[selmove] = tmpmove
|
||||
@sprites["movepresel"].visible = false
|
||||
switching = false
|
||||
drawSelectedMove(0,@pokemon.moves[selmove].id)
|
||||
drawSelectedMove(nil,@pokemon.moves[selmove])
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
selmove -= 1
|
||||
if selmove<4 && selmove>=@pokemon.numMoves
|
||||
if selmove<Pokemon::MAX_MOVES && selmove>=@pokemon.numMoves
|
||||
selmove = @pokemon.numMoves-1
|
||||
end
|
||||
selmove = 0 if selmove>=4
|
||||
selmove = 0 if selmove>=Pokemon::MAX_MOVES
|
||||
selmove = @pokemon.numMoves-1 if selmove<0
|
||||
@sprites["movesel"].index = selmove
|
||||
newmove = @pokemon.moves[selmove].id
|
||||
pbPlayCursorSE
|
||||
drawSelectedMove(0,newmove)
|
||||
drawSelectedMove(nil,@pokemon.moves[selmove])
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
selmove += 1
|
||||
selmove = 0 if selmove<4 && selmove>=@pokemon.numMoves
|
||||
selmove = 0 if selmove>=4
|
||||
selmove = 4 if selmove<0
|
||||
selmove = 0 if selmove<Pokemon::MAX_MOVES && selmove>=@pokemon.numMoves
|
||||
selmove = 0 if selmove>=Pokemon::MAX_MOVES
|
||||
selmove = Pokemon::MAX_MOVES if selmove<0
|
||||
@sprites["movesel"].index = selmove
|
||||
newmove = @pokemon.moves[selmove].id
|
||||
pbPlayCursorSE
|
||||
drawSelectedMove(0,newmove)
|
||||
drawSelectedMove(nil,@pokemon.moves[selmove])
|
||||
end
|
||||
end
|
||||
@sprites["movesel"].visible=false
|
||||
@@ -1194,16 +1186,17 @@ class PokemonSummary_Scene
|
||||
return dorefresh
|
||||
end
|
||||
|
||||
def pbChooseMoveToForget(moveToLearn)
|
||||
def pbChooseMoveToForget(move_to_learn)
|
||||
new_move = (move_to_learn) ? PBMove.new(move_to_learn) : nil
|
||||
selmove = 0
|
||||
maxmove = (moveToLearn>0) ? 4 : 3
|
||||
maxmove = (new_move) ? Pokemon::MAX_MOVES : Pokemon::MAX_MOVES - 1
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::B)
|
||||
selmove = 4
|
||||
pbPlayCloseMenuSE if moveToLearn>0
|
||||
selmove = Pokemon::MAX_MOVES
|
||||
pbPlayCloseMenuSE if new_move
|
||||
break
|
||||
elsif Input.trigger?(Input::C)
|
||||
pbPlayDecisionSE
|
||||
@@ -1211,24 +1204,24 @@ class PokemonSummary_Scene
|
||||
elsif Input.trigger?(Input::UP)
|
||||
selmove -= 1
|
||||
selmove = maxmove if selmove<0
|
||||
if selmove<4 && selmove>=@pokemon.numMoves
|
||||
if selmove<Pokemon::MAX_MOVES && selmove>=@pokemon.numMoves
|
||||
selmove = @pokemon.numMoves-1
|
||||
end
|
||||
@sprites["movesel"].index = selmove
|
||||
newmove = (selmove==4) ? moveToLearn : @pokemon.moves[selmove].id
|
||||
drawSelectedMove(moveToLearn,newmove)
|
||||
selected_move = (selmove==Pokemon::MAX_MOVES) ? new_move : @pokemon.moves[selmove]
|
||||
drawSelectedMove(new_move,selected_move)
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
selmove += 1
|
||||
selmove = 0 if selmove>maxmove
|
||||
if selmove<4 && selmove>=@pokemon.numMoves
|
||||
selmove = (moveToLearn>0) ? maxmove : 0
|
||||
if selmove<Pokemon::MAX_MOVES && selmove>=@pokemon.numMoves
|
||||
selmove = (new_move) ? maxmove : 0
|
||||
end
|
||||
@sprites["movesel"].index = selmove
|
||||
newmove = (selmove==4) ? moveToLearn : @pokemon.moves[selmove].id
|
||||
drawSelectedMove(moveToLearn,newmove)
|
||||
selected_move = (selmove==Pokemon::MAX_MOVES) ? new_move : @pokemon.moves[selmove]
|
||||
drawSelectedMove(new_move,selected_move)
|
||||
end
|
||||
end
|
||||
return (selmove==4) ? -1 : selmove
|
||||
return (selmove==Pokemon::MAX_MOVES) ? -1 : selmove
|
||||
end
|
||||
|
||||
def pbScene
|
||||
@@ -1317,16 +1310,14 @@ class PokemonSummaryScreen
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbStartForgetScreen(party,partyindex,moveToLearn)
|
||||
def pbStartForgetScreen(party,partyindex,move_to_learn)
|
||||
ret = -1
|
||||
@scene.pbStartForgetScene(party,partyindex,moveToLearn)
|
||||
@scene.pbStartForgetScene(party,partyindex,move_to_learn)
|
||||
loop do
|
||||
ret = @scene.pbChooseMoveToForget(moveToLearn)
|
||||
if ret>=0 && moveToLearn!=0 && pbIsHiddenMove?(party[partyindex].moves[ret].id) && !$DEBUG
|
||||
pbMessage(_INTL("HM moves can't be forgotten now.")) { @scene.pbUpdate }
|
||||
else
|
||||
break
|
||||
end
|
||||
ret = @scene.pbChooseMoveToForget(move_to_learn)
|
||||
break if ret < 0 || !move_to_learn
|
||||
break if $DEBUG || !party[partyindex].moves[ret].hidden_move?
|
||||
pbMessage(_INTL("HM moves can't be forgotten now.")) { @scene.pbUpdate }
|
||||
end
|
||||
@scene.pbEndScene
|
||||
return ret
|
||||
@@ -1334,15 +1325,12 @@ class PokemonSummaryScreen
|
||||
|
||||
def pbStartChooseMoveScreen(party,partyindex,message)
|
||||
ret = -1
|
||||
@scene.pbStartForgetScene(party,partyindex,0)
|
||||
@scene.pbStartForgetScene(party,partyindex,nil)
|
||||
pbMessage(message) { @scene.pbUpdate }
|
||||
loop do
|
||||
ret = @scene.pbChooseMoveToForget(0)
|
||||
if ret<0
|
||||
pbMessage(_INTL("You must choose a move!")) { @scene.pbUpdate }
|
||||
else
|
||||
break
|
||||
end
|
||||
ret = @scene.pbChooseMoveToForget(nil)
|
||||
break if ret >= 0
|
||||
pbMessage(_INTL("You must choose a move!")) { @scene.pbUpdate }
|
||||
end
|
||||
@scene.pbEndScene
|
||||
return ret
|
||||
|
||||
@@ -236,7 +236,7 @@ class PokemonReadyMenu
|
||||
def pbStartReadyMenu(moves,items)
|
||||
commands = [[],[]] # Moves, items
|
||||
for i in moves
|
||||
commands[0].push([i[0], PBMoves.getName(i[0]), true, i[1]])
|
||||
commands[0].push([i[0], GameData::Move.get(i[0]).name, true, i[1]])
|
||||
end
|
||||
commands[0].sort! { |a,b| a[1]<=>b[1] }
|
||||
for i in items
|
||||
@@ -250,7 +250,7 @@ class PokemonReadyMenu
|
||||
if command[0]==0 # Use a move
|
||||
move = commands[0][command[1]][0]
|
||||
user = $Trainer.party[commands[0][command[1]][3]]
|
||||
if isConst?(move,PBMoves,:FLY)
|
||||
if move == :FLY
|
||||
ret = nil
|
||||
pbFadeOutInWithUpdate(99999,@scene.sprites) {
|
||||
pbHideMenu
|
||||
@@ -299,30 +299,26 @@ def pbUseKeyItem
|
||||
moves = [:CUT, :DEFOG, :DIG, :DIVE, :FLASH, :FLY, :HEADBUTT, :ROCKCLIMB,
|
||||
:ROCKSMASH, :SECRETPOWER, :STRENGTH, :SURF, :SWEETSCENT, :TELEPORT,
|
||||
:WATERFALL, :WHIRLPOOL]
|
||||
realmoves = []
|
||||
for i in moves
|
||||
move = getID(PBMoves,i)
|
||||
next if move==0
|
||||
for j in 0...$Trainer.party.length
|
||||
next if $Trainer.party[j].egg?
|
||||
next if !$Trainer.party[j].hasMove?(move)
|
||||
realmoves.push([move,j]) if pbCanUseHiddenMove?($Trainer.party[j],move,false)
|
||||
break
|
||||
real_moves = []
|
||||
moves.each do |move|
|
||||
$Trainer.pokemonParty.each_with_index do |pkmn, i|
|
||||
next if !pkmn.hasMove?(move)
|
||||
real_moves.push([move, i]) if pbCanUseHiddenMove?(pkmn, move, false)
|
||||
end
|
||||
end
|
||||
realitems = []
|
||||
real_items = []
|
||||
for i in $PokemonBag.registeredItems
|
||||
itm = GameData::Item.get(i).id
|
||||
realitems.push(itm) if $PokemonBag.pbHasItem?(itm)
|
||||
real_items.push(itm) if $PokemonBag.pbHasItem?(itm)
|
||||
end
|
||||
if realitems.length==0 && realmoves.length==0
|
||||
if real_items.length == 0 && real_moves.length == 0
|
||||
pbMessage(_INTL("An item in the Bag can be registered to this key for instant use."))
|
||||
else
|
||||
$game_temp.in_menu = true
|
||||
$game_map.update
|
||||
sscene = PokemonReadyMenu_Scene.new
|
||||
sscreen = PokemonReadyMenu.new(sscene)
|
||||
sscreen.pbStartReadyMenu(realmoves,realitems)
|
||||
sscreen.pbStartReadyMenu(real_moves, real_items)
|
||||
$game_temp.in_menu = false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1839,11 +1839,10 @@ class PokemonStorageScreen
|
||||
def pbChooseMove(pkmn,helptext,index=0)
|
||||
movenames = []
|
||||
for i in pkmn.moves
|
||||
break if i.id==0
|
||||
if i.totalpp<=0
|
||||
movenames.push(_INTL("{1} (PP: ---)",PBMoves.getName(i.id)))
|
||||
if i.total_pp<=0
|
||||
movenames.push(_INTL("{1} (PP: ---)",i.name))
|
||||
else
|
||||
movenames.push(_INTL("{1} (PP: {2}/{3})",PBMoves.getName(i.id),i.pp,i.totalpp))
|
||||
movenames.push(_INTL("{1} (PP: {2}/{3})",i.name,i.pp,i.total_pp))
|
||||
end
|
||||
end
|
||||
return @scene.pbShowCommands(helptext,movenames,index)
|
||||
|
||||
@@ -51,7 +51,7 @@ class MoveRelearner_Scene
|
||||
@pokemon=pokemon
|
||||
@moves=moves
|
||||
moveCommands=[]
|
||||
moves.each { |m| moveCommands.push(PBMoves.getName(m)) }
|
||||
moves.each { |m| moveCommands.push(GameData::Move.get(m).name) }
|
||||
# Create sprite hash
|
||||
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z=99999
|
||||
@@ -81,7 +81,6 @@ class MoveRelearner_Scene
|
||||
end
|
||||
|
||||
def pbDrawMoveList
|
||||
movesData = pbLoadMovesData
|
||||
overlay=@sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
type1rect=Rect.new(0,@pokemon.type1*28,64,28)
|
||||
@@ -100,19 +99,13 @@ class MoveRelearner_Scene
|
||||
for i in 0...VISIBLEMOVES
|
||||
moveobject=@moves[@sprites["commands"].top_item+i]
|
||||
if moveobject
|
||||
moveData=movesData[moveobject]
|
||||
if moveData
|
||||
imagepos.push(["Graphics/Pictures/types",12,yPos+2,0,
|
||||
moveData[MoveData::TYPE]*28,64,28])
|
||||
textpos.push([PBMoves.getName(moveobject),80,yPos,0,
|
||||
Color.new(248,248,248),Color.new(0,0,0)])
|
||||
if moveData[MoveData::TOTAL_PP]>0
|
||||
textpos.push([_INTL("PP"),112,yPos+32,0,
|
||||
Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push([_INTL("{1}/{2}",
|
||||
moveData[MoveData::TOTAL_PP],moveData[MoveData::TOTAL_PP]),230,yPos+32,1,
|
||||
Color.new(64,64,64),Color.new(176,176,176)])
|
||||
end
|
||||
moveData=GameData::Move.get(moveobject)
|
||||
imagepos.push(["Graphics/Pictures/types",12,yPos+2,0,moveData.type*28,64,28])
|
||||
textpos.push([moveData.name,80,yPos,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
if moveData.total_pp>0
|
||||
textpos.push([_INTL("PP"),112,yPos+32,0,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push([_INTL("{1}/{1}",moveData.total_pp),230,yPos+32,1,
|
||||
Color.new(64,64,64),Color.new(176,176,176)])
|
||||
else
|
||||
textpos.push(["-",80,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push(["--",228,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
@@ -123,10 +116,10 @@ class MoveRelearner_Scene
|
||||
imagepos.push(["Graphics/Pictures/reminderSel",
|
||||
0,78+(@sprites["commands"].index-@sprites["commands"].top_item)*64,
|
||||
0,0,258,72])
|
||||
selMoveData=movesData[@moves[@sprites["commands"].index]]
|
||||
basedamage=selMoveData[MoveData::BASE_DAMAGE]
|
||||
category=selMoveData[MoveData::CATEGORY]
|
||||
accuracy=selMoveData[MoveData::ACCURACY]
|
||||
selMoveData=GameData::Move.get(@moves[@sprites["commands"].index])
|
||||
basedamage=selMoveData.base_damage
|
||||
category=selMoveData.category
|
||||
accuracy=selMoveData.accuracy
|
||||
textpos.push([_INTL("CATEGORY"),272,114,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
textpos.push([_INTL("POWER"),272,146,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
textpos.push([basedamage<=1 ? basedamage==1 ? "???" : "---" : sprintf("%d",basedamage),
|
||||
@@ -143,8 +136,7 @@ class MoveRelearner_Scene
|
||||
imagepos.push(["Graphics/Pictures/reminderButtons",134,350,76,0,76,32])
|
||||
end
|
||||
pbDrawImagePositions(overlay,imagepos)
|
||||
drawTextEx(overlay,272,210,230,5,
|
||||
pbGetMessage(MessageTypes::MoveDescriptions,@moves[@sprites["commands"].index]),
|
||||
drawTextEx(overlay,272,210,230,5,selMoveData.description,
|
||||
Color.new(64,64,64),Color.new(176,176,176))
|
||||
end
|
||||
|
||||
@@ -193,19 +185,16 @@ class MoveRelearnerScreen
|
||||
@scene.pbStartScene(pokemon,moves)
|
||||
loop do
|
||||
move=@scene.pbChooseMove
|
||||
if move<=0
|
||||
if @scene.pbConfirm(
|
||||
_INTL("Give up trying to teach a new move to {1}?",pokemon.name))
|
||||
@scene.pbEndScene
|
||||
return false
|
||||
end
|
||||
else
|
||||
if @scene.pbConfirm(_INTL("Teach {1}?",PBMoves.getName(move)))
|
||||
if move
|
||||
if @scene.pbConfirm(_INTL("Teach {1}?",GameData::Move.get(move).name))
|
||||
if pbLearnMove(pokemon,move)
|
||||
@scene.pbEndScene
|
||||
return true
|
||||
end
|
||||
end
|
||||
elsif @scene.pbConfirm(_INTL("Give up trying to teach a new move to {1}?",pokemon.name))
|
||||
@scene.pbEndScene
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class PokemonMartAdapter
|
||||
item_name = getName(item)
|
||||
if GameData::Item.get(item).is_machine?
|
||||
machine = GameData::Item.get(item).move
|
||||
item_name = _INTL("{1} {2}", item_name, PBMoves.getName(machine))
|
||||
item_name = _INTL("{1} {2}", item_name, GameData::Move.get(machine).name)
|
||||
end
|
||||
return item_name
|
||||
end
|
||||
|
||||
@@ -412,7 +412,8 @@ def pbReceiveMysteryGift(id)
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("\\me[Item get]You obtained some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
elsif itm.is_machine? # TM or HM
|
||||
pbMessage(_INTL("\\me[Item get]You obtained \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(itm.move)))
|
||||
pbMessage(_INTL("\\me[Item get]You obtained \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,
|
||||
GameData::Move.get(itm.move).name))
|
||||
elsif qty>1
|
||||
pbMessage(_INTL("\\me[Item get]You obtained {1} \\c[1]{2}\\c[0]!\\wtnp[30]",qty,itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
|
||||
@@ -53,13 +53,11 @@ class PBPokemon
|
||||
moves=pieces[4].split(/\s*,\s*/)
|
||||
moveid=[]
|
||||
for i in 0...4
|
||||
if (PBMoves.const_defined?(moves[i]) rescue false)
|
||||
moveid.push(PBMoves.const_get(moves[i]))
|
||||
end
|
||||
move_data = GameData::Move.try_get(moves[i])
|
||||
moveid.push(move_data.id) if move_data
|
||||
end
|
||||
moveid=[1] if moveid.length==0
|
||||
return self.new(species,item,nature,
|
||||
moveid[0],(moveid[1]||0),(moveid[2]||0),(moveid[3]||0),evvalue)
|
||||
moveid=[GameData::Move.get(1)] if moveid.length==0
|
||||
return self.new(species, item, nature, moveid[0], moveid[1], moveid[2], moveid[3], evvalue)
|
||||
end
|
||||
|
||||
def self.fromPokemon(pokemon)
|
||||
@@ -70,9 +68,12 @@ class PBPokemon
|
||||
evvalue|=0x08 if pokemon.ev[3]>60
|
||||
evvalue|=0x10 if pokemon.ev[4]>60
|
||||
evvalue|=0x20 if pokemon.ev[5]>60
|
||||
mov1 = (pokemon.moves[0]) ? pokemon.moves[0].id : nil
|
||||
mov2 = (pokemon.moves[1]) ? pokemon.moves[1].id : nil
|
||||
mov3 = (pokemon.moves[2]) ? pokemon.moves[2].id : nil
|
||||
mov4 = (pokemon.moves[3]) ? pokemon.moves[3].id : nil
|
||||
return self.new(pokemon.species,pokemon.item_id,pokemon.nature,
|
||||
pokemon.moves[0].id,pokemon.moves[1].id,pokemon.moves[2].id,
|
||||
pokemon.moves[3].id,evvalue)
|
||||
mov1,mov2,mov3,mov4,evvalue)
|
||||
end
|
||||
|
||||
def self.constFromStr(mod,str)
|
||||
@@ -97,10 +98,10 @@ class PBPokemon
|
||||
species=self.constFromStr(PBSpecies,s[1])
|
||||
item=s[2].to_sym
|
||||
nature=self.constFromStr(PBNatures,s[3])
|
||||
move1=self.constFromStr(PBMoves,s[4])
|
||||
move2=(s.length>=12) ? self.constFromStr(PBMoves,s[5]) : 0
|
||||
move3=(s.length>=13) ? self.constFromStr(PBMoves,s[6]) : 0
|
||||
move4=(s.length>=14) ? self.constFromStr(PBMoves,s[7]) : 0
|
||||
move1=GameData::Move.get(s[4]).id
|
||||
move2=(s.length>=12) ? GameData::Move.get(s[5]).id : nil
|
||||
move3=(s.length>=13) ? GameData::Move.get(s[6]).id : nil
|
||||
move4=(s.length>=14) ? GameData::Move.get(s[7]).id : nil
|
||||
ev=0
|
||||
slen=s.length-6
|
||||
ev|=0x01 if s[slen].to_i>0
|
||||
@@ -129,7 +130,7 @@ class PBPokemon
|
||||
|
||||
def inspect
|
||||
c1=getConstantName(PBSpecies,@species)
|
||||
c2=(@item) ? GameData::Item.get(@item).name : ""
|
||||
c2=(@item) ? GameData::Item.get(@item).id_to_s : ""
|
||||
c3=getConstantName(PBNatures,@nature)
|
||||
evlist=""
|
||||
for i in 0...@ev
|
||||
@@ -138,10 +139,10 @@ class PBPokemon
|
||||
evlist+=["HP","ATK","DEF","SPD","SA","SD"][i]
|
||||
end
|
||||
end
|
||||
c4=(@move1==0) ? "" : getConstantName(PBMoves,@move1)
|
||||
c5=(@move2==0) ? "" : getConstantName(PBMoves,@move2)
|
||||
c6=(@move3==0) ? "" : getConstantName(PBMoves,@move3)
|
||||
c7=(@move4==0) ? "" : getConstantName(PBMoves,@move4)
|
||||
c4=(@move1) ? GameData::Move.get(@move1).id_to_s : ""
|
||||
c5=(@move2) ? GameData::Move.get(@move2).id_to_s : ""
|
||||
c6=(@move3) ? GameData::Move.get(@move3).id_to_s : ""
|
||||
c7=(@move4) ? GameData::Move.get(@move4).id_to_s : ""
|
||||
return "#{c1};#{c2};#{c3};#{evlist};#{c4},#{c5},#{c6},#{c7}"
|
||||
end
|
||||
|
||||
@@ -150,9 +151,7 @@ class PBPokemon
|
||||
end
|
||||
|
||||
def convertMove(move)
|
||||
if isConst?(move,PBMoves,:RETURN) && hasConst?(PBMoves,:FRUSTRATION)
|
||||
move=getConst(PBMoves,:FRUSTRATION)
|
||||
end
|
||||
move = :FRUSTRATION if move == :RETURN && GameData::Move.exists?(:FRUSTRATION)
|
||||
return move
|
||||
end
|
||||
|
||||
|
||||
@@ -1,63 +1,47 @@
|
||||
def pbRandomMove
|
||||
keys = GameData::Move::DATA.keys.sort
|
||||
loop do
|
||||
move=rand(PBMoves.maxValue)+1
|
||||
next if move>384 || isConst?(move,PBMoves,:SKETCH) || isConst?(move,PBMoves,:STRUGGLE)
|
||||
return move if PBMoves.getName(move)!=""
|
||||
move_id = keys[rand(keys.length)]
|
||||
move = GameData::Move.get(move_id)
|
||||
next if move.id_number > 384 || move.id == :SKETCH || move.id == :STRUGGLE
|
||||
return move.id
|
||||
end
|
||||
end
|
||||
|
||||
def addMove(moves,move,base)
|
||||
data=moveData(move)
|
||||
data=GameData::Move.get(move)
|
||||
count=base+1
|
||||
if data.function=="000" && data.basedamage<=40
|
||||
if data.function_code=="000" && data.base_damage<=40
|
||||
count=base
|
||||
end
|
||||
if isConst?(move,PBMoves,:BUBBLE) ||
|
||||
isConst?(move,PBMoves,:BUBBLEBEAM)
|
||||
if [:BUBBLE, :BUBBLEBEAM].include?(data.id)
|
||||
count=0
|
||||
return
|
||||
end
|
||||
if data.basedamage<=30 ||
|
||||
isConst?(move,PBMoves,:GROWL) ||
|
||||
isConst?(move,PBMoves,:TAILWHIP) ||
|
||||
isConst?(move,PBMoves,:LEER)
|
||||
if data.base_damage<=30 || [:GROWL, :TAILWHIP, :LEER].include?(data.id)
|
||||
count=base
|
||||
end
|
||||
if data.basedamage>=60 ||
|
||||
isConst?(move,PBMoves,:REFLECT) ||
|
||||
isConst?(move,PBMoves,:LIGHTSCREEN) ||
|
||||
isConst?(move,PBMoves,:SAFEGUARD) ||
|
||||
isConst?(move,PBMoves,:SUBSTITUTE) ||
|
||||
isConst?(move,PBMoves,:FAKEOUT)
|
||||
if data.base_damage>=60 ||
|
||||
[:REFLECT, :LIGHTSCREEN, :SAFEGUARD, :SUBSTITUTE, :FAKEOUT].include?(data.id)
|
||||
count=base+2
|
||||
end
|
||||
if data.basedamage>=80 && isConst?(data.type,PBTypes,:NORMAL)
|
||||
if data.base_damage>=80 && isConst?(data.type,PBTypes,:NORMAL)
|
||||
count=base+5
|
||||
end
|
||||
if data.basedamage>=80 && isConst?(data.type,PBTypes,:NORMAL)
|
||||
if data.base_damage>=80 && isConst?(data.type,PBTypes,:NORMAL)
|
||||
count=base+3
|
||||
end
|
||||
if isConst?(move,PBMoves,:PROTECT) ||
|
||||
isConst?(move,PBMoves,:DETECT) ||
|
||||
isConst?(move,PBMoves,:TOXIC) ||
|
||||
isConst?(move,PBMoves,:AERIALACE) ||
|
||||
isConst?(move,PBMoves,:WILLOWISP) ||
|
||||
isConst?(move,PBMoves,:SPORE) ||
|
||||
isConst?(move,PBMoves,:THUNDERWAVE) ||
|
||||
isConst?(move,PBMoves,:HYPNOSIS) ||
|
||||
isConst?(move,PBMoves,:CONFUSERAY) ||
|
||||
isConst?(move,PBMoves,:ENDURE) ||
|
||||
isConst?(move,PBMoves,:SWORDSDANCE)
|
||||
if [:PROTECT, :DETECT, :TOXIC, :AERIALACE, :WILLOWISP, :SPORE, :THUNDERWAVE,
|
||||
:HYPNOSIS, :CONFUSERAY, :ENDURE, :SWORDSDANCE].include?(data.id)
|
||||
count=base+3
|
||||
end
|
||||
if !moves.include?(move)
|
||||
count.times{moves.push(move)}
|
||||
if !moves.include?(move.id)
|
||||
count.times { moves.push(move.id) }
|
||||
end
|
||||
end
|
||||
|
||||
$legalMoves = []
|
||||
$legalMovesLevel = 0
|
||||
$moveData = []
|
||||
$baseStatTotal = []
|
||||
$minimumLevel = []
|
||||
$babySpecies = []
|
||||
@@ -84,7 +68,7 @@ def pbGetLegalMoves2(species,maxlevel)
|
||||
babyEggMoves.each { |m| addMove(moves,m,2) }
|
||||
movedatas=[]
|
||||
for move in moves
|
||||
movedatas.push([move,moveData(move)])
|
||||
movedatas.push([move,GameData::Move.get(move)])
|
||||
end
|
||||
# Delete less powerful moves
|
||||
deleteAll=proc { |a,item|
|
||||
@@ -93,22 +77,22 @@ def pbGetLegalMoves2(species,maxlevel)
|
||||
end
|
||||
}
|
||||
for move in moves
|
||||
md=moveData(move)
|
||||
md=GameData::Move.get(move)
|
||||
for move2 in movedatas
|
||||
if md.function=="0A5" && move2[1].function=="000" && md.type==move2[1].type &&
|
||||
md.basedamage>=move2[1].basedamage
|
||||
if md.function_code=="0A5" && move2[1].function_code=="000" &&
|
||||
md.type==move2[1].type && md.base_damage>=move2[1].base_damage
|
||||
deleteAll.call(moves,move2[0])
|
||||
elsif md.function==move2[1].function && md.basedamage==0 &&
|
||||
elsif md.function_code==move2[1].function_code && md.base_damage==0 &&
|
||||
md.accuracy>move2[1].accuracy
|
||||
# Supersonic vs. Confuse Ray, etc.
|
||||
deleteAll.call(moves,move2[0])
|
||||
elsif md.function=="006" && move2[1].function=="005"
|
||||
elsif md.function_code=="006" && move2[1].function_code=="005"
|
||||
deleteAll.call(moves,move2[0])
|
||||
elsif md.function==move2[1].function && md.basedamage!=0 &&
|
||||
elsif md.function_code==move2[1].function_code && md.base_damage!=0 &&
|
||||
md.type==move2[1].type &&
|
||||
(md.totalpp==15 || md.totalpp==10 || md.totalpp==move2[1].totalpp) &&
|
||||
(md.basedamage>move2[1].basedamage ||
|
||||
(md.basedamage==move2[1].basedamage && md.accuracy>move2[1].accuracy))
|
||||
(md.total_pp==15 || md.total_pp==10 || md.total_pp==move2[1].total_pp) &&
|
||||
(md.base_damage>move2[1].base_damage ||
|
||||
(md.base_damage==move2[1].base_damage && md.accuracy>move2[1].accuracy))
|
||||
# Surf, Flamethrower, Thunderbolt, etc.
|
||||
deleteAll.call(moves,move2[0])
|
||||
end
|
||||
@@ -145,13 +129,6 @@ def evolutions(move)
|
||||
return $evolutions[move]
|
||||
end
|
||||
|
||||
def moveData(move)
|
||||
if !$moveData[move]
|
||||
$moveData[move]=PBMoveData.new(move)
|
||||
end
|
||||
return $moveData[move]
|
||||
end
|
||||
|
||||
=begin
|
||||
[3/10]
|
||||
0-266 - 0-500
|
||||
@@ -265,12 +242,12 @@ def pbArrangeByTier(pokemonlist,rule)
|
||||
end
|
||||
|
||||
def hasMorePowerfulMove(moves,thismove)
|
||||
thisdata=moveData(thismove)
|
||||
return false if thisdata.basedamage==0
|
||||
thisdata=GameData::Move.get(thismove)
|
||||
return false if thisdata.base_damage==0
|
||||
for move in moves
|
||||
next if move==0
|
||||
if moveData(move).type==thisdata.type &&
|
||||
moveData(move).basedamage>thisdata.basedamage
|
||||
next if !move
|
||||
moveData = GameData::Move.get(move)
|
||||
if moveData.type==thisdata.type && moveData.base_damage>thisdata.base_damage
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -399,31 +376,30 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
end
|
||||
moves=$legalMoves[species]
|
||||
sketch=false
|
||||
if isConst?(moves[0],PBMoves,:SKETCH)
|
||||
if moves[0] == :SKETCH
|
||||
sketch=true
|
||||
moves[0]=pbRandomMove
|
||||
moves[1]=pbRandomMove
|
||||
moves[2]=pbRandomMove
|
||||
moves[3]=pbRandomMove
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
moves[i]=pbRandomMove
|
||||
end
|
||||
end
|
||||
next if moves.length==0
|
||||
if (moves|[]).length<4
|
||||
moves=[getID(PBMoves,:TACKLE)] if moves.length==0
|
||||
if (moves|[]).length<Pokemon::MAX_MOVES
|
||||
moves=[:TACKLE] if moves.length==0
|
||||
moves|=[]
|
||||
else
|
||||
newmoves=[]
|
||||
rest=(getConst(PBMoves,:REST) || -1)
|
||||
spitup=(getConst(PBMoves,:SPITUP) || -1)
|
||||
swallow=(getConst(PBMoves,:SWALLOW) || -1)
|
||||
stockpile=(getConst(PBMoves,:STOCKPILE) || -1)
|
||||
snore=(getConst(PBMoves,:SNORE) || -1)
|
||||
sleeptalk=(getConst(PBMoves,:SLEEPTALK) || -1)
|
||||
rest=GameData::Move.exists?(:REST) ? :REST : nil
|
||||
spitup=GameData::Move.exists?(:SPITUP) ? :SPITUP : nil
|
||||
swallow=GameData::Move.exists?(:SWALLOW) ? :SWALLOW : nil
|
||||
stockpile=GameData::Move.exists?(:STOCKPILE) ? :STOCKPILE : nil
|
||||
snore=GameData::Move.exists?(:SNORE) ? :SNORE : nil
|
||||
sleeptalk=GameData::Move.exists?(:SLEEPTALK) ? :SLEEPTALK : nil
|
||||
loop do
|
||||
newmoves.clear
|
||||
while newmoves.length<4
|
||||
while newmoves.length<[moves.length,Pokemon::MAX_MOVES].min
|
||||
m=moves[rand(moves.length)]
|
||||
next if rand(2)==0 && hasMorePowerfulMove(moves,m)
|
||||
newmoves.push(m) if !newmoves.include?(m) && m!=0
|
||||
newmoves.push(m) if m && !newmoves.include?(m)
|
||||
end
|
||||
if (newmoves.include?(spitup) ||
|
||||
newmoves.include?(swallow)) && !newmoves.include?(stockpile)
|
||||
@@ -444,9 +420,9 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
hasSpecial=false
|
||||
hasNormal=false
|
||||
for move in newmoves
|
||||
d=moveData(move)
|
||||
totalbasedamage+=d.basedamage
|
||||
if d.basedamage>=1
|
||||
d=GameData::Move.get(move)
|
||||
totalbasedamage+=d.base_damage
|
||||
if d.base_damage>=1
|
||||
hasNormal=true if isConst?(d.type,PBTypes,:NORMAL)
|
||||
hasPhysical=true if d.category==0
|
||||
hasSpecial=true if d.category==1
|
||||
@@ -479,12 +455,7 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
break
|
||||
end
|
||||
end
|
||||
for i in 0...4
|
||||
moves[i]=0 if !moves[i]
|
||||
end
|
||||
if item == :LIGHTCLAY &&
|
||||
!moves.include?((getConst(PBMoves,:LIGHTSCREEN) || -1)) &&
|
||||
!moves.include?((getConst(PBMoves,:REFLECT) || -1))
|
||||
if item == :LIGHTCLAY && !moves.any? { |m| m == :LIGHTSCREEN || m = :REFLECT }
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
if item == :BLACKSLUDGE
|
||||
@@ -494,13 +465,13 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
end
|
||||
if item == :HEATROCK && !moves.include?((getConst(PBMoves,:SUNNYDAY) || -1))
|
||||
if item == :HEATROCK && !moves.any? { |m| m == :SUNNYDAY }
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
if item == :DAMPROCK && !moves.include?((getConst(PBMoves,:RAINDANCE) || -1))
|
||||
if item == :DAMPROCK && !moves.any? { |m| m == :RAINDANCE }
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
if moves.include?((getConst(PBMoves,:REST) || -1))
|
||||
if moves.any? { |m| m == :REST }
|
||||
item = :LUMBERRY if rand(3)==0
|
||||
item = :CHESTOBERRY if rand(4)==0
|
||||
end
|
||||
@@ -819,8 +790,8 @@ end
|
||||
|
||||
|
||||
def pbDecideWinnerEffectiveness(move,otype1,otype2,ability,scores)
|
||||
data=moveData(move)
|
||||
return 0 if data.basedamage==0
|
||||
data=GameData::Move.get(move)
|
||||
return 0 if data.base_damage==0
|
||||
atype=data.type
|
||||
typemod=PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE*PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
if ability != :LEVITATE || !isConst?(data.type,PBTypes,:GROUND)
|
||||
@@ -853,7 +824,7 @@ def pbDecideWinnerScore(party0,party1,rating)
|
||||
end
|
||||
for i in 0...party0.length
|
||||
for move in party0[i].moves
|
||||
next if move.id==0
|
||||
next if !move
|
||||
for j in 0...party1.length
|
||||
score+=pbDecideWinnerEffectiveness(move.id,
|
||||
types1[j],types2[j],abilities[j],[-16,-8,0,4,12,20])
|
||||
@@ -1138,18 +1109,15 @@ def isBattlePokemonDuplicate(pk,pk2)
|
||||
if pk.species==pk2.species
|
||||
moves1=[]
|
||||
moves2=[]
|
||||
4.times{
|
||||
moves1.push(pk.moves[0].id)
|
||||
moves2.push(pk.moves[1].id)
|
||||
}
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
moves1.push((pk.moves[i]) ? pk.moves[i].id : nil)
|
||||
moves2.push((pk2.moves[i]) ? pk2.moves[i].id : nil)
|
||||
end
|
||||
moves1.sort!
|
||||
moves2.sort!
|
||||
if moves1[0]==moves2[0] &&
|
||||
moves1[1]==moves2[1] &&
|
||||
moves1[2]==moves2[2] &&
|
||||
moves1[3]==moves2[3]
|
||||
if moves1 == moves2
|
||||
# Accept as same if moves are same and there are four moves each
|
||||
return true if moves1[3]!=0
|
||||
return true if moves1[Pokemon::MAX_MOVES - 1]
|
||||
end
|
||||
return true if pk.item==pk2.item &&
|
||||
pk.nature==pk2.nature &&
|
||||
|
||||
@@ -79,6 +79,7 @@ def pbSetUpSystem
|
||||
consts = [] if !consts
|
||||
GameData::Ability.load
|
||||
GameData::Item.load
|
||||
GameData::Move.load
|
||||
GameData::BerryPlant.load
|
||||
GameData::Metadata.load
|
||||
GameData::MapMetadata.load
|
||||
|
||||
@@ -270,7 +270,7 @@ def pbItemIconFile(item)
|
||||
bitmapFileName = sprintf("Graphics/Icons/item%03d",itm.id_number)
|
||||
if !pbResolveBitmap(bitmapFileName) && itm.is_machine?
|
||||
move = itm.move
|
||||
type = pbGetMoveData(move,MoveData::TYPE)
|
||||
type = GameData::Move.get(move).type
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemMachine%s",getConstantName(PBTypes,type)) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemMachine%03d",type)
|
||||
|
||||
@@ -368,12 +368,8 @@ end
|
||||
# Checks whether any Pokémon in the party knows the given move, and returns
|
||||
# the first Pokémon it finds with that move, or nil if no Pokémon has that move.
|
||||
def pbCheckMove(move)
|
||||
move = getID(PBMoves,move)
|
||||
return nil if !move || move<=0
|
||||
for i in $Trainer.pokemonParty
|
||||
for j in i.moves
|
||||
return i if j.id==move
|
||||
end
|
||||
$Trainer.pokemonParty.each do |pkmn|
|
||||
return pkmn if pkmn.hasMove?(move)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -982,28 +982,24 @@ def pbTextEntry(helptext,minlength,maxlength,variableNumber)
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
|
||||
def pbMoveTutorAnnotations(move,movelist=nil)
|
||||
def pbMoveTutorAnnotations(move, movelist = nil)
|
||||
ret = []
|
||||
for i in 0...6
|
||||
ret[i] = nil
|
||||
next if i>=$Trainer.party.length
|
||||
found = false
|
||||
for j in 0...4
|
||||
if !$Trainer.party[i].egg? && $Trainer.party[i].moves[j].id==move
|
||||
ret[i] = _INTL("LEARNED")
|
||||
found = true
|
||||
end
|
||||
end
|
||||
next if found
|
||||
species = $Trainer.party[i].species
|
||||
if !$Trainer.party[i].egg? && movelist && movelist.any? { |j| j==species }
|
||||
# Checked data from movelist
|
||||
ret[i] = _INTL("ABLE")
|
||||
elsif !$Trainer.party[i].egg? && $Trainer.party[i].compatibleWithMove?(move)
|
||||
# Checked data from PBS/tm.txt
|
||||
ret[i] = _INTL("ABLE")
|
||||
else
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
if pkmn.egg?
|
||||
ret[i] = _INTL("NOT ABLE")
|
||||
elsif pkmn.hasMove?(move)
|
||||
ret[i] = _INTL("LEARNED")
|
||||
else
|
||||
species = pkmn.species
|
||||
if movelist && movelist.any? { |j| j == species }
|
||||
# Checked data from movelist given in parameter
|
||||
ret[i] = _INTL("ABLE")
|
||||
elsif pkmn.compatibleWithMove?(move)
|
||||
# Checked data from PBS/tm.txt
|
||||
ret[i] = _INTL("ABLE")
|
||||
else
|
||||
ret[i] = _INTL("NOT ABLE")
|
||||
end
|
||||
end
|
||||
end
|
||||
return ret
|
||||
@@ -1011,14 +1007,14 @@ end
|
||||
|
||||
def pbMoveTutorChoose(move,movelist=nil,bymachine=false)
|
||||
ret = false
|
||||
move = getID(PBMoves,move)
|
||||
move = GameData::Move.get(move).id
|
||||
if movelist!=nil && movelist.is_a?(Array)
|
||||
for i in 0...movelist.length
|
||||
movelist[i] = getID(PBSpecies,movelist[i])
|
||||
movelist[i] = GameData::Move.get(movelist[i]).id
|
||||
end
|
||||
end
|
||||
pbFadeOutIn {
|
||||
movename = PBMoves.getName(move)
|
||||
movename = GameData::Move.get(move).name
|
||||
annot = pbMoveTutorAnnotations(move,movelist)
|
||||
scene = PokemonParty_Scene.new
|
||||
screen = PokemonPartyScreen.new(scene,$Trainer.party)
|
||||
@@ -1053,11 +1049,11 @@ def pbChooseMove(pokemon,variableNumber,nameVarNumber)
|
||||
pbFadeOutIn {
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
ret = screen.pbStartForgetScreen([pokemon],0,0)
|
||||
ret = screen.pbStartForgetScreen([pokemon],0,nil)
|
||||
}
|
||||
$game_variables[variableNumber] = ret
|
||||
if ret>=0
|
||||
$game_variables[nameVarNumber] = PBMoves.getName(pokemon.moves[ret].id)
|
||||
$game_variables[nameVarNumber] = pokemon.moves[ret].name
|
||||
else
|
||||
$game_variables[nameVarNumber] = ""
|
||||
end
|
||||
|
||||
@@ -980,11 +980,10 @@ class PokemonDebugPartyScreen
|
||||
def pbChooseMove(pkmn,text,index=0)
|
||||
moveNames = []
|
||||
for i in pkmn.moves
|
||||
break if i.id==0
|
||||
if i.totalpp<=0
|
||||
moveNames.push(_INTL("{1} (PP: ---)",PBMoves.getName(i.id)))
|
||||
if i.total_pp<=0
|
||||
moveNames.push(_INTL("{1} (PP: ---)",i.name))
|
||||
else
|
||||
moveNames.push(_INTL("{1} (PP: {2}/{3})",PBMoves.getName(i.id),i.pp,i.totalpp))
|
||||
moveNames.push(_INTL("{1} (PP: {2}/{3})",i.name,i.pp,i.total_pp))
|
||||
end
|
||||
end
|
||||
return pbShowCommands(text,moveNames,index)
|
||||
|
||||
@@ -347,7 +347,7 @@ module PokemonDebugMixin
|
||||
#===========================================================================
|
||||
when "teachmove"
|
||||
move = pbChooseMoveList
|
||||
if move!=0
|
||||
if move
|
||||
pbLearnMove(pkmn,move)
|
||||
pbRefreshSingle(pkmnid)
|
||||
end
|
||||
@@ -355,7 +355,7 @@ module PokemonDebugMixin
|
||||
when "forgetmove"
|
||||
moveindex = pbChooseMove(pkmn,_INTL("Choose move to forget."))
|
||||
if moveindex>=0
|
||||
movename = PBMoves.getName(pkmn.moves[moveindex].id)
|
||||
movename = pkmn.moves[moveindex].name
|
||||
pkmn.pbDeleteMoveAtIndex(moveindex)
|
||||
pbDisplay(_INTL("{1} forgot {2}.",pkmn.name,movename))
|
||||
pbRefreshSingle(pkmnid)
|
||||
@@ -371,11 +371,11 @@ module PokemonDebugMixin
|
||||
loop do
|
||||
commands = []
|
||||
for i in pkmn.moves
|
||||
break if i.id==0
|
||||
if i.totalpp<=0
|
||||
commands.push(_INTL("{1} (PP: ---)",PBMoves.getName(i.id)))
|
||||
break if !i.id
|
||||
if i.total_pp<=0
|
||||
commands.push(_INTL("{1} (PP: ---)",i.name))
|
||||
else
|
||||
commands.push(_INTL("{1} (PP: {2}/{3})",PBMoves.getName(i.id),i.pp,i.totalpp))
|
||||
commands.push(_INTL("{1} (PP: {2}/{3})",i.name,i.pp,i.total_pp))
|
||||
end
|
||||
end
|
||||
commands.push(_INTL("Restore all PP"))
|
||||
@@ -383,13 +383,13 @@ module PokemonDebugMixin
|
||||
break if cmd<0
|
||||
if cmd>=0 && cmd<commands.length-1 # Move
|
||||
move = pkmn.moves[cmd]
|
||||
movename = PBMoves.getName(move.id)
|
||||
if move.totalpp<=0
|
||||
movename = move.name
|
||||
if move.total_pp<=0
|
||||
pbDisplay(_INTL("{1} has infinite PP.",movename))
|
||||
else
|
||||
cmd2 = 0
|
||||
loop do
|
||||
msg = _INTL("{1}: PP {2}/{3} (PP Up {4}/3)",movename,move.pp,move.totalpp,move.ppup)
|
||||
msg = _INTL("{1}: PP {2}/{3} (PP Up {4}/3)",movename,move.pp,move.total_pp,move.ppup)
|
||||
cmd2 = pbShowCommands(msg,[
|
||||
_INTL("Set PP"),
|
||||
_INTL("Full PP"),
|
||||
@@ -398,13 +398,13 @@ module PokemonDebugMixin
|
||||
case cmd2
|
||||
when 0 # Change PP
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0,move.totalpp)
|
||||
params.setRange(0,move.total_pp)
|
||||
params.setDefaultValue(move.pp)
|
||||
h = pbMessageChooseNumber(
|
||||
_INTL("Set PP of {1} (max. {2}).",movename,move.totalpp),params) { pbUpdate }
|
||||
_INTL("Set PP of {1} (max. {2}).",movename,move.total_pp),params) { pbUpdate }
|
||||
move.pp = h
|
||||
when 1 # Full PP
|
||||
move.pp = move.totalpp
|
||||
move.pp = move.total_pp
|
||||
when 2 # Change PP Up
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0,3)
|
||||
@@ -412,7 +412,7 @@ module PokemonDebugMixin
|
||||
h = pbMessageChooseNumber(
|
||||
_INTL("Set PP Up of {1} (max. 3).",movename),params) { pbUpdate }
|
||||
move.ppup = h
|
||||
move.pp = move.totalpp if move.pp>move.totalpp
|
||||
move.pp = move.total_pp if move.pp>move.total_pp
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -694,7 +694,7 @@ def pbItemEditor
|
||||
itm.field_use,
|
||||
itm.battle_use,
|
||||
itm.type,
|
||||
itm.move || 0
|
||||
itm.move
|
||||
]
|
||||
if pbPropertyList(itm.id.to_s, data, items, true)
|
||||
# Construct item hash
|
||||
@@ -709,7 +709,7 @@ def pbItemEditor
|
||||
:field_use => data[6],
|
||||
:battle_use => data[7],
|
||||
:type => data[8],
|
||||
:move => (data[9] > 0) ? data[9] : nil
|
||||
:move => data[9]
|
||||
}
|
||||
# Add item's data to records
|
||||
GameData::Item::DATA[itm.id_number] = GameData::Item::DATA[itm.id] = GameData::Item.new(item_hash)
|
||||
@@ -938,7 +938,7 @@ def pbPokemonEditor
|
||||
movelist.sort! { |a,b| (a[0]==b[0]) ? a[2]<=>b[2] : a[0]<=>b[0] }
|
||||
originalEggMoves = pbGetSpeciesEggMoves(selection)
|
||||
eggmovelist = []
|
||||
originalEggMoves.each { |m| eggmovelist.push(m) if m!=0 }
|
||||
originalEggMoves.each { |m| eggmovelist.push(m) }
|
||||
regionallist = []
|
||||
for i in 0...regionalDexes.length
|
||||
regionallist.push(regionalDexes[i][selection])
|
||||
@@ -1162,12 +1162,12 @@ def pbRegionalDexEditor(dex)
|
||||
refreshlist = false
|
||||
cmd = pbCommands3(cmdwin,commands,-1,cmd[1],true)
|
||||
case cmd[0]
|
||||
when 1 # Swap move up
|
||||
when 1 # Swap entry up
|
||||
if cmd[1]<tdex.length-1
|
||||
tdex[cmd[1]+1],tdex[cmd[1]] = tdex[cmd[1]],tdex[cmd[1]+1]
|
||||
refreshlist = true
|
||||
end
|
||||
when 2 # Swap move down
|
||||
when 2 # Swap entry down
|
||||
if cmd[1]>0
|
||||
tdex[cmd[1]-1],tdex[cmd[1]] = tdex[cmd[1]],tdex[cmd[1]-1]
|
||||
refreshlist = true
|
||||
|
||||
@@ -48,7 +48,7 @@ end
|
||||
# Save ability data to PBS file
|
||||
#===============================================================================
|
||||
def pbSaveAbilities
|
||||
File.open("PBS/abilities.txt","wb") { |f|
|
||||
File.open("PBS/abilities.txt", "wb") { |f|
|
||||
f.write(0xEF.chr)
|
||||
f.write(0xBB.chr)
|
||||
f.write(0xBF.chr)
|
||||
@@ -72,39 +72,34 @@ end
|
||||
# Save move data to PBS file
|
||||
#===============================================================================
|
||||
def pbSaveMoveData
|
||||
movesData = pbLoadMovesData
|
||||
return if !movesData
|
||||
File.open("PBS/moves.txt","wb") { |f|
|
||||
File.open("PBS/moves.txt", "wb") { |f|
|
||||
f.write(0xEF.chr)
|
||||
f.write(0xBB.chr)
|
||||
f.write(0xBF.chr)
|
||||
f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file."))
|
||||
f.write("\r\n")
|
||||
currentType = -1
|
||||
for i in 1..(PBMoves.maxValue rescue PBMoves.getCount-1 rescue pbGetMessageCount(MessageTypes::Moves)-1)
|
||||
moveData = movesData[i]
|
||||
next if !moveData # No move with that ID defined
|
||||
if currentType!=moveData[MoveData::TYPE]
|
||||
currentType = moveData[MoveData::TYPE]
|
||||
current_type = -1
|
||||
GameData::Move.each do |m|
|
||||
if current_type != m.type
|
||||
current_type = m.type
|
||||
f.write("\#-------------------------------\r\n")
|
||||
end
|
||||
f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s",
|
||||
moveData[MoveData::ID],
|
||||
moveData[MoveData::INTERNAL_NAME],
|
||||
csvQuote(moveData[MoveData::NAME]),
|
||||
csvQuote(moveData[MoveData::FUNCTION_CODE]),
|
||||
moveData[MoveData::BASE_DAMAGE],
|
||||
(getConstantName(PBTypes,moveData[MoveData::TYPE]) rescue pbGetTypeConst(moveData[MoveData::TYPE]) rescue ""),
|
||||
["Physical","Special","Status"][moveData[MoveData::CATEGORY]],
|
||||
moveData[MoveData::ACCURACY],
|
||||
moveData[MoveData::TOTAL_PP],
|
||||
moveData[MoveData::EFFECT_CHANCE],
|
||||
(getConstantName(PBTargets,moveData[MoveData::TARGET]) rescue sprintf("%02X",moveData[MoveData::TARGET])),
|
||||
moveData[MoveData::PRIORITY],
|
||||
csvQuote(moveData[MoveData::FLAGS]),
|
||||
csvQuoteAlways(moveData[MoveData::DESCRIPTION])
|
||||
f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s\r\n",
|
||||
m.id_number,
|
||||
csvQuote(m.id.to_s),
|
||||
csvQuote(m.real_name),
|
||||
csvQuote(m.function_code),
|
||||
m.base_damage,
|
||||
(getConstantName(PBTypes, m.type) rescue pbGetTypeConst(m.type) rescue ""),
|
||||
["Physical", "Special", "Status"][m.category],
|
||||
m.accuracy,
|
||||
m.total_pp,
|
||||
m.effect_chance,
|
||||
(getConstantName(PBTargets, m.target) rescue sprintf("%02X", m.target)),
|
||||
m.priority,
|
||||
csvQuote(m.flags),
|
||||
csvQuoteAlways(m.real_description)
|
||||
))
|
||||
f.write("\r\n")
|
||||
end
|
||||
}
|
||||
end
|
||||
@@ -185,7 +180,7 @@ end
|
||||
# Save metadata data to PBS file
|
||||
#===============================================================================
|
||||
def pbSaveMetadata
|
||||
File.open("PBS/metadata.txt","wb") { |f|
|
||||
File.open("PBS/metadata.txt", "wb") { |f|
|
||||
f.write(0xEF.chr)
|
||||
f.write(0xBB.chr)
|
||||
f.write(0xBF.chr)
|
||||
@@ -231,7 +226,7 @@ end
|
||||
# Save item data to PBS file
|
||||
#===============================================================================
|
||||
def pbSaveItems
|
||||
File.open("PBS/items.txt","wb") { |f|
|
||||
File.open("PBS/items.txt", "wb") { |f|
|
||||
f.write(0xEF.chr)
|
||||
f.write(0xBB.chr)
|
||||
f.write(0xBF.chr)
|
||||
@@ -243,11 +238,10 @@ def pbSaveItems
|
||||
current_pocket = i.pocket
|
||||
f.write("\#-------------------------------\r\n")
|
||||
end
|
||||
move_name = ""
|
||||
if i.move
|
||||
move_name = getConstantName(PBMoves, i.move) rescue pbGetMoveConst(i.move) rescue ""
|
||||
end
|
||||
f.write(sprintf("%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n",
|
||||
move_name = (i.move) ? GameData::Move.get(i.move).id.to_s : ""
|
||||
sprintf_text = "%d,%s,%s,%s,%d,%d,%s,%d,%d,%d\r\n"
|
||||
sprintf_text = "%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n" if move_name != ""
|
||||
f.write(sprintf(sprintf_text,
|
||||
i.id_number,
|
||||
csvQuote(i.id.to_s),
|
||||
csvQuote(i.real_name),
|
||||
@@ -270,7 +264,7 @@ end
|
||||
# Save berry plant data to PBS file
|
||||
#===============================================================================
|
||||
def pbSaveBerryPlants
|
||||
File.open("PBS/berryplants.txt","wb") { |f|
|
||||
File.open("PBS/berryplants.txt", "wb") { |f|
|
||||
f.write(0xEF.chr)
|
||||
f.write(0xBB.chr)
|
||||
f.write(0xBF.chr)
|
||||
@@ -329,17 +323,18 @@ def pbSaveMachines
|
||||
f.write(0xBF.chr)
|
||||
f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file."))
|
||||
f.write("\r\n")
|
||||
for i in 1...machines.length
|
||||
keys = machines.keys.sort { |a, b| GameData::Move.get(a).id_number <=> GameData::Move.get(b).id_number }
|
||||
for i in 0...keys.length
|
||||
Graphics.update if i%50==0
|
||||
Win32API.SetWindowText(_INTL("Writing move {1}/{2}",i,machines.length)) if i%20==0
|
||||
next if !machines[i]
|
||||
movename = getConstantName(PBMoves,i) rescue pbGetMoveConst(i) rescue nil
|
||||
Win32API.SetWindowText(_INTL("Writing move {1}/{2}",i,keys.length)) if i%20==0
|
||||
next if !machines[keys[i]]
|
||||
movename = GameData::Move.get(keys[i]).id.to_s
|
||||
next if !movename || movename==""
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%s]\r\n",movename))
|
||||
x = []
|
||||
for j in 0...machines[i].length
|
||||
speciesname = getConstantName(PBSpecies,machines[i][j]) rescue pbGetSpeciesConst(machines[i][j]) rescue nil
|
||||
machines[keys[i]].each do |species|
|
||||
speciesname = getConstantName(PBSpecies,species) rescue pbGetSpeciesConst(species) rescue nil
|
||||
next if !speciesname || speciesname==""
|
||||
x.push(speciesname)
|
||||
end
|
||||
@@ -487,7 +482,7 @@ def pbSaveTrainerBattles
|
||||
if poke[TrainerData::MOVES] && poke[TrainerData::MOVES].length>0
|
||||
movestring = ""
|
||||
for i in 0...poke[TrainerData::MOVES].length
|
||||
movename = getConstantName(PBMoves,poke[TrainerData::MOVES][i]) rescue pbGetMoveConst(poke[TrainerData::MOVES][i]) rescue nil
|
||||
movename = GameData::Move.get(poke[TrainerData::MOVES][i]).id.to_s
|
||||
next if !movename
|
||||
movestring.concat(",") if i>0
|
||||
movestring.concat(movename)
|
||||
@@ -747,7 +742,7 @@ def pbSavePokemonData
|
||||
level = m[0]
|
||||
move = m[1]
|
||||
pokedata.write(",") if !first
|
||||
cmove = getConstantName(PBMoves,move) rescue pbGetMoveConst(move)
|
||||
cmove = GameData::Move.get(move).id.to_s
|
||||
pokedata.write(sprintf("%d,%s",level,cmove))
|
||||
first = false
|
||||
end
|
||||
@@ -759,7 +754,7 @@ def pbSavePokemonData
|
||||
eggMoves[i].each do |m|
|
||||
next if !m || m==0
|
||||
pokedata.write(",") if !first
|
||||
cmove = getConstantName(PBMoves,m) rescue pbGetMoveConst(m)
|
||||
cmove = GameData::Move.get(m).id.to_s
|
||||
pokedata.write("#{cmove}")
|
||||
first = false
|
||||
end
|
||||
@@ -1053,7 +1048,7 @@ def pbSavePokemonFormsData
|
||||
incense = nil if incense==origdata["incense"]
|
||||
pokedexform = speciesData[i][SpeciesData::POKEDEX_FORM] || 0 # No nil check
|
||||
megastone = speciesData[i][SpeciesData::MEGA_STONE] # No nil check
|
||||
megamove = speciesData[i][SpeciesData::MEGA_MOVE] || 0 # No nil check
|
||||
megamove = speciesData[i][SpeciesData::MEGA_MOVE] # No nil check
|
||||
unmega = speciesData[i][SpeciesData::UNMEGA_FORM] || 0 # No nil check
|
||||
megamessage = speciesData[i][SpeciesData::MEGA_MESSAGE] || 0 # No nil check
|
||||
pokedata.write("\#-------------------------------\r\n")
|
||||
@@ -1064,8 +1059,8 @@ def pbSavePokemonFormsData
|
||||
citem = GameData::Item.get(megastone).id.to_s
|
||||
pokedata.write("MegaStone = #{citem}\r\n")
|
||||
end
|
||||
if megamove>0
|
||||
cmove = getConstantName(PBMoves,megamove) rescue pbGetMoveConst(megamove)
|
||||
if megamove
|
||||
cmove = GameData::Move.get(megamove).id.to_s
|
||||
pokedata.write("MegaMove = #{cmove}\r\n")
|
||||
end
|
||||
pokedata.write("UnmegaForm = #{unmega}\r\n") if unmega>0
|
||||
@@ -1163,7 +1158,7 @@ def pbSavePokemonFormsData
|
||||
level = m[0]
|
||||
move = m[1]
|
||||
pokedata.write(",") if !first
|
||||
cmove = getConstantName(PBMoves,move) rescue pbGetMoveConst(move)
|
||||
cmove = GameData::Move.get(move).id.to_s
|
||||
pokedata.write(sprintf("%d,%s",level,cmove))
|
||||
first = false
|
||||
end
|
||||
@@ -1189,7 +1184,7 @@ def pbSavePokemonFormsData
|
||||
eggList.each do |m|
|
||||
next if !m || m==0
|
||||
pokedata.write(",") if !first
|
||||
cmove = getConstantName(PBMoves,m) rescue pbGetMoveConst(m)
|
||||
cmove = GameData::Move.get(m).id.to_s
|
||||
pokedata.write("#{cmove}")
|
||||
first = false
|
||||
end
|
||||
@@ -1351,7 +1346,7 @@ def pbSaveShadowMoves
|
||||
f.write(sprintf("%s = ",constname))
|
||||
movenames = []
|
||||
for m in move
|
||||
movenames.push((getConstantName(PBMoves,m) rescue pbGetMoveConst(m) rescue nil))
|
||||
movenames.push(GameData::Move.get(m).id.to_s)
|
||||
end
|
||||
f.write(sprintf("%s\r\n",movenames.compact.join(",")))
|
||||
end
|
||||
@@ -1443,14 +1438,10 @@ def pbFastInspect(pkmn,moves,species,items,natures)
|
||||
evlist += evs[i]
|
||||
end
|
||||
end
|
||||
c4 = (moves[pkmn.move1]) ? moves[pkmn.move1] :
|
||||
(moves[pkmn.move1] = (getConstantName(PBMoves,pkmn.move1) rescue pbGetMoveConst(pkmn.move1)))
|
||||
c5 = (moves[pkmn.move2]) ? moves[pkmn.move2] :
|
||||
(moves[pkmn.move2] = (getConstantName(PBMoves,pkmn.move2) rescue pbGetMoveConst(pkmn.move2)))
|
||||
c6 = (moves[pkmn.move3]) ? moves[pkmn.move3] :
|
||||
(moves[pkmn.move3] = (getConstantName(PBMoves,pkmn.move3) rescue pbGetMoveConst(pkmn.move3)))
|
||||
c7 = (moves[pkmn.move4]) ? moves[pkmn.move4] :
|
||||
(moves[pkmn.move4] = (getConstantName(PBMoves,pkmn.move4) rescue pbGetMoveConst(pkmn.move4)))
|
||||
c4 = (moves[pkmn.move1]) ? moves[pkmn.move1] : (moves[pkmn.move1] = GameData::Move.get(pkmn.move1).id_to_s)
|
||||
c5 = (moves[pkmn.move2]) ? moves[pkmn.move2] : (moves[pkmn.move2] = GameData::Move.get(pkmn.move2).id_to_s)
|
||||
c6 = (moves[pkmn.move3]) ? moves[pkmn.move3] : (moves[pkmn.move3] = GameData::Move.get(pkmn.move3).id_to_s)
|
||||
c7 = (moves[pkmn.move4]) ? moves[pkmn.move4] : (moves[pkmn.move4] = GameData::Move.get(pkmn.move4).id_to_s)
|
||||
return "#{c1};#{c2};#{c3};#{evlist};#{c4},#{c5},#{c6},#{c7}"
|
||||
end
|
||||
|
||||
|
||||
@@ -296,17 +296,17 @@ end
|
||||
|
||||
|
||||
module MoveProperty
|
||||
def self.set(_settingname,oldsetting)
|
||||
ret = pbChooseMoveList((oldsetting) ? oldsetting : 1)
|
||||
return (ret<=0) ? (oldsetting) ? oldsetting : 0 : ret
|
||||
def self.set(_settingname, oldsetting)
|
||||
ret = pbChooseMoveList(oldsetting || nil)
|
||||
return ret || oldsetting
|
||||
end
|
||||
|
||||
def self.defaultValue
|
||||
return 0
|
||||
return nil
|
||||
end
|
||||
|
||||
def self.format(value)
|
||||
return (value) ? PBMoves.getName(value) : "-"
|
||||
return (value && GameData::Move.exists?(value)) ? GameData::Move.get(value).real_name : "-"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -317,9 +317,9 @@ class MoveProperty2
|
||||
@pokemondata = pokemondata
|
||||
end
|
||||
|
||||
def set(_settingname,oldsetting)
|
||||
ret = pbChooseMoveListForSpecies(@pokemondata[0],(oldsetting) ? oldsetting : 1)
|
||||
return (ret>0) ? ret : (oldsetting) ? oldsetting : nil
|
||||
def set(_settingname, oldsetting)
|
||||
ret = pbChooseMoveListForSpecies(@pokemondata[TrainerData::SPECIES], oldsetting || nil)
|
||||
return ret || oldsetting
|
||||
end
|
||||
|
||||
def defaultValue
|
||||
@@ -327,7 +327,7 @@ class MoveProperty2
|
||||
end
|
||||
|
||||
def format(value)
|
||||
return (value) ? PBMoves.getName(value) : "-"
|
||||
return (value && GameData::Move.exists?(value)) ? GameData::Move.get(value).real_name : "-"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -399,14 +399,13 @@ class IVsProperty
|
||||
for i in 0...6
|
||||
oldsetting[i] = oldsetting[0] if !oldsetting[i]
|
||||
end
|
||||
properties = [
|
||||
[_INTL("HP"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's HP stat (0-{1}).",@limit)],
|
||||
[_INTL("Attack"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Attack stat (0-{1}).",@limit)],
|
||||
[_INTL("Defense"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Defense stat (0-{1}).",@limit)],
|
||||
[_INTL("Speed"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Speed stat (0-{1}).",@limit)],
|
||||
[_INTL("Sp. Atk"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Sp. Atk stat (0-{1}).",@limit)],
|
||||
[_INTL("Sp. Def"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Sp. Def stat (0-{1}).",@limit)]
|
||||
]
|
||||
properties = []
|
||||
properties[PBStats::HP] = [_INTL("HP"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's HP stat (0-{1}).", @limit)]
|
||||
properties[PBStats::ATTACK] = [_INTL("Attack"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Attack stat (0-{1}).", @limit)]
|
||||
properties[PBStats::DEFENSE] = [_INTL("Defense"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Defense stat (0-{1}).", @limit)]
|
||||
properties[PBStats::SPATK] = [_INTL("Sp. Atk"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Sp. Atk stat (0-{1}).", @limit)]
|
||||
properties[PBStats::SPDEF] = [_INTL("Sp. Def"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Sp. Def stat (0-{1}).", @limit)]
|
||||
properties[PBStats::SPEED] = [_INTL("Speed"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Speed stat (0-{1}).", @limit)]
|
||||
pbPropertyList(settingname,oldsetting,properties,false)
|
||||
hasNonNil = false
|
||||
hasAltVal = false
|
||||
@@ -452,14 +451,13 @@ class EVsProperty
|
||||
for i in 0...6
|
||||
oldsetting[i] = oldsetting[0] if !oldsetting[i]
|
||||
end
|
||||
properties = [
|
||||
[_INTL("HP"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's HP stat (0-{1}).",@limit)],
|
||||
[_INTL("Attack"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Attack stat (0-{1}).",@limit)],
|
||||
[_INTL("Defense"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Defense stat (0-{1}).",@limit)],
|
||||
[_INTL("Speed"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Speed stat (0-{1}).",@limit)],
|
||||
[_INTL("Sp. Atk"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Sp. Atk stat (0-{1}).",@limit)],
|
||||
[_INTL("Sp. Def"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Sp. Def stat (0-{1}).",@limit)]
|
||||
]
|
||||
properties = []
|
||||
properties[PBStats::HP] = [_INTL("HP"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's HP stat (0-{1}).", @limit)]
|
||||
properties[PBStats::ATTACK] = [_INTL("Attack"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Attack stat (0-{1}).", @limit)]
|
||||
properties[PBStats::DEFENSE] = [_INTL("Defense"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Defense stat (0-{1}).", @limit)]
|
||||
properties[PBStats::SPATK] = [_INTL("Sp. Atk"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Sp. Atk stat (0-{1}).", @limit)]
|
||||
properties[PBStats::SPDEF] = [_INTL("Sp. Def"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Sp. Def stat (0-{1}).", @limit)]
|
||||
properties[PBStats::SPEED] = [_INTL("Speed"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Speed stat (0-{1}).", @limit)]
|
||||
loop do
|
||||
pbPropertyList(settingname,oldsetting,properties,false)
|
||||
evtotal = 0
|
||||
@@ -467,8 +465,7 @@ class EVsProperty
|
||||
evtotal += oldsetting[i] if oldsetting[i]
|
||||
end
|
||||
if evtotal>Pokemon::EV_LIMIT
|
||||
pbMessage(_INTL("Total EVs ({1}) are greater than allowed ({2}). Please reduce them.",
|
||||
evtotal, Pokemon::EV_LIMIT))
|
||||
pbMessage(_INTL("Total EVs ({1}) are greater than allowed ({2}). Please reduce them.", evtotal, Pokemon::EV_LIMIT))
|
||||
else
|
||||
break
|
||||
end
|
||||
@@ -545,14 +542,14 @@ module PlayerProperty
|
||||
def self.set(settingname,oldsetting)
|
||||
oldsetting = [0,"xxx","xxx","xxx","xxx","xxx","xxx","xxx"] if !oldsetting
|
||||
properties = [
|
||||
[_INTL("Trainer Type"),TrainerTypeProperty,_INTL("Trainer type of this player.")],
|
||||
[_INTL("Sprite"),CharacterProperty,_INTL("Walking character sprite.")],
|
||||
[_INTL("Cycling"),CharacterProperty,_INTL("Cycling character sprite.")],
|
||||
[_INTL("Surfing"),CharacterProperty,_INTL("Surfing character sprite.")],
|
||||
[_INTL("Running"),CharacterProperty,_INTL("Running character sprite.")],
|
||||
[_INTL("Diving"),CharacterProperty,_INTL("Diving character sprite.")],
|
||||
[_INTL("Fishing"),CharacterProperty,_INTL("Fishing character sprite.")],
|
||||
[_INTL("Field Move"),CharacterProperty,_INTL("Using a field move character sprite.")]
|
||||
[_INTL("Trainer Type"), TrainerTypeProperty, _INTL("Trainer type of this player.")],
|
||||
[_INTL("Sprite"), CharacterProperty, _INTL("Walking character sprite.")],
|
||||
[_INTL("Cycling"), CharacterProperty, _INTL("Cycling character sprite.")],
|
||||
[_INTL("Surfing"), CharacterProperty, _INTL("Surfing character sprite.")],
|
||||
[_INTL("Running"), CharacterProperty, _INTL("Running character sprite.")],
|
||||
[_INTL("Diving"), CharacterProperty, _INTL("Diving character sprite.")],
|
||||
[_INTL("Fishing"), CharacterProperty, _INTL("Fishing character sprite.")],
|
||||
[_INTL("Field Move"), CharacterProperty, _INTL("Using a field move character sprite.")]
|
||||
]
|
||||
pbPropertyList(settingname,oldsetting,properties,false)
|
||||
return oldsetting
|
||||
@@ -717,7 +714,7 @@ end
|
||||
|
||||
|
||||
module ItemNameProperty
|
||||
def self.set(settingname,oldsetting)
|
||||
def self.set(settingname, oldsetting)
|
||||
return pbMessageFreeText(_INTL("Set the value for {1}.",settingname),
|
||||
(oldsetting) ? oldsetting : "",false,30)
|
||||
end
|
||||
@@ -735,14 +732,14 @@ end
|
||||
|
||||
module PocketProperty
|
||||
def self.pocketnames
|
||||
return [_INTL("Items"),_INTL("Medicine"),_INTL("Poké Balls"),
|
||||
_INTL("TMs & HMs"),_INTL("Berries"),_INTL("Mail"),
|
||||
_INTL("Battle Items"),_INTL("Key Items")]
|
||||
return [_INTL("Items"), _INTL("Medicine"), _INTL("Poké Balls"),
|
||||
_INTL("TMs & HMs"), _INTL("Berries"), _INTL("Mail"),
|
||||
_INTL("Battle Items"), _INTL("Key Items")]
|
||||
end
|
||||
|
||||
def self.set(_settingname,oldsetting)
|
||||
cmd = pbMessage(_INTL("Choose a pocket for this item."),pocketnames(),-1)
|
||||
return (cmd>=0) ? cmd+1 : oldsetting
|
||||
def self.set(_settingname, oldsetting)
|
||||
cmd = pbMessage(_INTL("Choose a pocket for this item."), pocketnames(), -1)
|
||||
return (cmd >= 0) ? cmd + 1 : oldsetting
|
||||
end
|
||||
|
||||
def self.defaultValue
|
||||
@@ -750,8 +747,8 @@ module PocketProperty
|
||||
end
|
||||
|
||||
def self.format(value)
|
||||
return _INTL("No Pocket") if value==0
|
||||
return (value) ? pocketnames[value-1] : value.inspect
|
||||
return _INTL("No Pocket") if value == 0
|
||||
return (value) ? pocketnames[value - 1] : value.inspect
|
||||
end
|
||||
end
|
||||
|
||||
@@ -761,12 +758,12 @@ module BaseStatsProperty
|
||||
def self.set(settingname,oldsetting)
|
||||
return oldsetting if !oldsetting
|
||||
properties = []
|
||||
properties[PBStats::HP] = _INTL("Base HP"),NonzeroLimitProperty.new(255),_INTL("Base HP stat of the Pokémon.")
|
||||
properties[PBStats::ATTACK] = _INTL("Base Attack"),NonzeroLimitProperty.new(255),_INTL("Base Attack stat of the Pokémon.")
|
||||
properties[PBStats::DEFENSE] = _INTL("Base Defense"),NonzeroLimitProperty.new(255),_INTL("Base Defense stat of the Pokémon.")
|
||||
properties[PBStats::SPATK] = _INTL("Base Sp. Attack"),NonzeroLimitProperty.new(255),_INTL("Base Special Attack stat of the Pokémon.")
|
||||
properties[PBStats::SPDEF] = _INTL("Base Sp. Defense"),NonzeroLimitProperty.new(255),_INTL("Base Special Defense stat of the Pokémon.")
|
||||
properties[PBStats::SPEED] = _INTL("Base Speed"),NonzeroLimitProperty.new(255),_INTL("Base Speed stat of the Pokémon.")
|
||||
properties[PBStats::HP] = _INTL("Base HP"), NonzeroLimitProperty.new(255), _INTL("Base HP stat of the Pokémon.")
|
||||
properties[PBStats::ATTACK] = _INTL("Base Attack"), NonzeroLimitProperty.new(255), _INTL("Base Attack stat of the Pokémon.")
|
||||
properties[PBStats::DEFENSE] = _INTL("Base Defense"), NonzeroLimitProperty.new(255), _INTL("Base Defense stat of the Pokémon.")
|
||||
properties[PBStats::SPATK] = _INTL("Base Sp. Attack"), NonzeroLimitProperty.new(255), _INTL("Base Special Attack stat of the Pokémon.")
|
||||
properties[PBStats::SPDEF] = _INTL("Base Sp. Defense"), NonzeroLimitProperty.new(255), _INTL("Base Special Defense stat of the Pokémon.")
|
||||
properties[PBStats::SPEED] = _INTL("Base Speed"), NonzeroLimitProperty.new(255), _INTL("Base Speed stat of the Pokémon.")
|
||||
if !pbPropertyList(settingname,oldsetting,properties,true)
|
||||
oldsetting = nil
|
||||
else
|
||||
@@ -790,12 +787,12 @@ module EffortValuesProperty
|
||||
def self.set(settingname,oldsetting)
|
||||
return oldsetting if !oldsetting
|
||||
properties = []
|
||||
properties[PBStats::HP] = _INTL("HP EVs"),LimitProperty.new(255),_INTL("Number of HP Effort Value points gained from the Pokémon.")
|
||||
properties[PBStats::ATTACK] = _INTL("Attack EVs"),LimitProperty.new(255),_INTL("Number of Attack Effort Value points gained from the Pokémon.")
|
||||
properties[PBStats::DEFENSE] = _INTL("Defense EVs"),LimitProperty.new(255),_INTL("Number of Defense Effort Value points gained from the Pokémon.")
|
||||
properties[PBStats::SPATK] = _INTL("Sp. Attack EVs"),LimitProperty.new(255),_INTL("Number of Special Attack Effort Value points gained from the Pokémon.")
|
||||
properties[PBStats::SPDEF] = _INTL("Sp. Defense EVs"),LimitProperty.new(255),_INTL("Number of Special Defense Effort Value points gained from the Pokémon.")
|
||||
properties[PBStats::SPEED] = _INTL("Speed EVs"),LimitProperty.new(255),_INTL("Number of Speed Effort Value points gained from the Pokémon.")
|
||||
properties[PBStats::HP] = [_INTL("HP EVs"), LimitProperty.new(255), _INTL("Number of HP Effort Value points gained from the Pokémon.")]
|
||||
properties[PBStats::ATTACK] = [_INTL("Attack EVs"), LimitProperty.new(255), _INTL("Number of Attack Effort Value points gained from the Pokémon.")]
|
||||
properties[PBStats::DEFENSE] = [_INTL("Defense EVs"), LimitProperty.new(255), _INTL("Number of Defense Effort Value points gained from the Pokémon.")]
|
||||
properties[PBStats::SPATK] = [_INTL("Sp. Attack EVs"), LimitProperty.new(255), _INTL("Number of Special Attack Effort Value points gained from the Pokémon.")]
|
||||
properties[PBStats::SPDEF] = [_INTL("Sp. Defense EVs"), LimitProperty.new(255), _INTL("Number of Special Defense Effort Value points gained from the Pokémon.")]
|
||||
properties[PBStats::SPEED] = [_INTL("Speed EVs"), LimitProperty.new(255), _INTL("Number of Speed Effort Value points gained from the Pokémon.")]
|
||||
if !pbPropertyList(settingname,oldsetting,properties,true)
|
||||
oldsetting = nil
|
||||
else
|
||||
@@ -833,127 +830,133 @@ end
|
||||
|
||||
|
||||
module MovePoolProperty
|
||||
def self.set(_settingname,oldsetting)
|
||||
ret = oldsetting
|
||||
cmdwin = pbListWindow([],200)
|
||||
commands = []
|
||||
def self.set(_settingname, oldsetting)
|
||||
# Get all moves in move pool
|
||||
realcmds = []
|
||||
realcmds.push([-1,0,-1])
|
||||
realcmds.push([-1, nil, -1, "-"]) # Level, move ID, index in this list, name
|
||||
for i in 0...oldsetting.length
|
||||
realcmds.push([oldsetting[i][0],oldsetting[i][1],i])
|
||||
realcmds.push([oldsetting[i][0], oldsetting[i][1], i, GameData::Move.get(oldsetting[i][1]).real_name])
|
||||
end
|
||||
refreshlist = true; oldsel = -1
|
||||
cmd = [0,0]
|
||||
# Edit move pool
|
||||
cmdwin = pbListWindow([], 200)
|
||||
oldsel = -1
|
||||
ret = oldsetting
|
||||
cmd = [0, 0]
|
||||
commands = []
|
||||
refreshlist = true
|
||||
loop do
|
||||
if refreshlist
|
||||
realcmds.sort! { |a,b| (a[0]==b[0]) ? a[2]<=>b[2] : a[0]<=>b[0] }
|
||||
realcmds.sort! { |a, b| (a[0] == b[0]) ? a[2] <=> b[2] : a[0] <=> b[0] }
|
||||
commands = []
|
||||
for i in 0...realcmds.length
|
||||
if realcmds[i][0]==-1
|
||||
realcmds.each_with_index do |entry, i|
|
||||
if entry[0] == -1
|
||||
commands.push(_INTL("[ADD MOVE]"))
|
||||
else
|
||||
commands.push(_INTL("{1}: {2}",realcmds[i][0],PBMoves.getName(realcmds[i][1])))
|
||||
commands.push(_INTL("{1}: {2}", entry[0], entry[3]))
|
||||
end
|
||||
cmd[1] = i if oldsel>=0 && realcmds[i][2]==oldsel
|
||||
cmd[1] = i if oldsel >= 0 && entry[2] == oldsel
|
||||
end
|
||||
end
|
||||
refreshlist = false; oldsel = -1
|
||||
cmd = pbCommands3(cmdwin,commands,-1,cmd[1],true)
|
||||
if cmd[0]==1 # Swap move up
|
||||
if cmd[1]<realcmds.length-1 && realcmds[cmd[1]][0]==realcmds[cmd[1]+1][0]
|
||||
realcmds[cmd[1]+1][2],realcmds[cmd[1]][2] = realcmds[cmd[1]][2],realcmds[cmd[1]+1][2]
|
||||
refreshlist = false
|
||||
oldsel = -1
|
||||
cmd = pbCommands3(cmdwin, commands, -1, cmd[1], true)
|
||||
case cmd[0]
|
||||
when 1 # Swap move up (if both moves have the same level)
|
||||
if cmd[1] < realcmds.length - 1 && realcmds[cmd[1]][0] == realcmds[cmd[1] + 1][0]
|
||||
realcmds[cmd[1] + 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] + 1][2]
|
||||
refreshlist = true
|
||||
end
|
||||
elsif cmd[0]==2 # Swap move down
|
||||
if cmd[1]>0 && realcmds[cmd[1]][0]==realcmds[cmd[1]-1][0]
|
||||
realcmds[cmd[1]-1][2],realcmds[cmd[1]][2] = realcmds[cmd[1]][2],realcmds[cmd[1]-1][2]
|
||||
when 2 # Swap move down (if both moves have the same level)
|
||||
if cmd[1] > 0 && realcmds[cmd[1]][0] == realcmds[cmd[1] - 1][0]
|
||||
realcmds[cmd[1] - 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] - 1][2]
|
||||
refreshlist = true
|
||||
end
|
||||
elsif cmd[0]==0
|
||||
if cmd[1]>=0
|
||||
when 0
|
||||
if cmd[1] >= 0 # Chose an entry
|
||||
entry = realcmds[cmd[1]]
|
||||
if entry[0]==-1 # Add new move
|
||||
if entry[0] == -1 # Add new move
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0,PBExperience.maxLevel)
|
||||
params.setRange(0, PBExperience.maxLevel)
|
||||
params.setDefaultValue(1)
|
||||
params.setCancelValue(-1)
|
||||
newlevel = pbMessageChooseNumber(_INTL("Choose a level."),params)
|
||||
if newlevel>=0
|
||||
if newlevel >= 0
|
||||
newmove = pbChooseMoveList
|
||||
if newmove>0
|
||||
if newmove
|
||||
havemove = -1
|
||||
for i in 0...realcmds.length
|
||||
havemove = realcmds[i][2] if realcmds[i][0]==newlevel && realcmds[i][1]==newmove
|
||||
realcmds.each do |e|
|
||||
havemove = e[2] if e[0] == newlevel && e[1] == newmove
|
||||
end
|
||||
if havemove>=0
|
||||
if havemove >= 0
|
||||
oldsel = havemove
|
||||
else
|
||||
maxid = -1
|
||||
for i in realcmds; maxid = [maxid,i[2]].max; end
|
||||
realcmds.push([newlevel,newmove,maxid+1])
|
||||
realcmds.each { |e| maxid = [maxid, e[2]].max }
|
||||
realcmds.push([newlevel, newmove, maxid + 1, GameData::Move.get(newmove).real_name])
|
||||
end
|
||||
refreshlist = true
|
||||
end
|
||||
end
|
||||
else # Edit move
|
||||
cmd2 = pbMessage(_INTL("\\ts[]Do what with this move?"),
|
||||
[_INTL("Change level"),_INTL("Change move"),_INTL("Delete"),_INTL("Cancel")],4)
|
||||
if cmd2==0
|
||||
else # Edit existing move
|
||||
case pbMessage(_INTL("\\ts[]Do what with this move?"),
|
||||
[_INTL("Change level"), _INTL("Change move"), _INTL("Delete"), _INTL("Cancel")], 4)
|
||||
when 0 # Change level
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0,PBExperience.maxLevel)
|
||||
params.setRange(0, PBExperience.maxLevel)
|
||||
params.setDefaultValue(entry[0])
|
||||
newlevel = pbMessageChooseNumber(_INTL("Choose a new level."),params)
|
||||
if newlevel>=0 && newlevel!=entry[0]
|
||||
newlevel = pbMessageChooseNumber(_INTL("Choose a new level."), params)
|
||||
if newlevel >= 0 && newlevel != entry[0]
|
||||
havemove = -1
|
||||
for i in 0...realcmds.length
|
||||
havemove = realcmds[i][2] if realcmds[i][0]==newlevel && realcmds[i][1]==entry[1]
|
||||
realcmds.each do |e|
|
||||
havemove = e[2] if e[0] == newlevel && e[1] == entry[1]
|
||||
end
|
||||
if havemove>=0
|
||||
if havemove >= 0 # Move already known at new level; delete this move
|
||||
realcmds[cmd[1]] = nil
|
||||
realcmds.compact!
|
||||
oldsel = havemove
|
||||
else
|
||||
else # Apply the new level
|
||||
entry[0] = newlevel
|
||||
oldsel = entry[2]
|
||||
end
|
||||
refreshlist = true
|
||||
end
|
||||
elsif cmd2==1
|
||||
when 1 # Change move
|
||||
newmove = pbChooseMoveList(entry[1])
|
||||
if newmove>0
|
||||
if newmove
|
||||
havemove = -1
|
||||
for i in 0...realcmds.length
|
||||
havemove = realcmds[i][2] if realcmds[i][0]==entry[0] && realcmds[i][1]==newmove
|
||||
realcmds.each do |e|
|
||||
havemove = e[2] if e[0] == entry[0] && e[1] == newmove
|
||||
end
|
||||
if havemove>=0
|
||||
if havemove >= 0 # New move already known at level; delete this move
|
||||
realcmds[cmd[1]] = nil
|
||||
realcmds.compact!
|
||||
oldsel = havemove
|
||||
else
|
||||
else # Apply the new move
|
||||
entry[1] = newmove
|
||||
entry[3] = GameData::Move.get(newmove).real_name
|
||||
oldsel = entry[2]
|
||||
end
|
||||
refreshlist = true
|
||||
end
|
||||
elsif cmd2==2
|
||||
when 2 # Delete
|
||||
realcmds[cmd[1]] = nil
|
||||
realcmds.compact!
|
||||
cmd[1] = [cmd[1],realcmds.length-1].min
|
||||
cmd[1] = [cmd[1], realcmds.length - 1].min
|
||||
refreshlist = true
|
||||
end
|
||||
end
|
||||
else
|
||||
cmd2 = pbMessage(_INTL("Save changes?"),
|
||||
[_INTL("Yes"),_INTL("No"),_INTL("Cancel")],3)
|
||||
if cmd2==0 || cmd2==1
|
||||
if cmd2==0
|
||||
for i in 0...realcmds.length
|
||||
realcmds[i].pop
|
||||
realcmds[i] = nil if realcmds[i][0]==0
|
||||
end
|
||||
realcmds.compact!
|
||||
ret = realcmds
|
||||
else # Cancel/quit
|
||||
case pbMessage(_INTL("Save changes?"),
|
||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||
when 0
|
||||
for i in 0...realcmds.length
|
||||
realcmds[i].pop # Remove name
|
||||
realcmds[i].pop # Remove index in this list
|
||||
end
|
||||
realcmds.compact!
|
||||
ret = realcmds
|
||||
break
|
||||
when 1
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -970,8 +973,8 @@ module MovePoolProperty
|
||||
def self.format(value)
|
||||
ret = ""
|
||||
for i in 0...value.length
|
||||
ret << "," if i>0
|
||||
ret << sprintf("#{value[i][0]},#{PBMoves.getName(value[i][1])}")
|
||||
ret << "," if i > 0
|
||||
ret << sprintf("%s,%s", value[i][0], GameData::Move.get(value[i][1]).real_name)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -980,83 +983,78 @@ end
|
||||
|
||||
|
||||
module EggMovesProperty
|
||||
def self.set(_settingname,oldsetting)
|
||||
ret = oldsetting
|
||||
cmdwin = pbListWindow([],200)
|
||||
commands = []
|
||||
def self.set(_settingname, oldsetting)
|
||||
# Get all egg moves
|
||||
realcmds = []
|
||||
realcmds.push([0,_INTL("[ADD MOVE]"),-1])
|
||||
realcmds.push([nil, _INTL("[ADD MOVE]"), -1])
|
||||
for i in 0...oldsetting.length
|
||||
realcmds.push([oldsetting[i],PBMoves.getName(oldsetting[i]),0])
|
||||
realcmds.push([oldsetting[i], GameData::Move.get(oldsetting[i]).real_name, 0])
|
||||
end
|
||||
refreshlist = true; oldsel = -1
|
||||
# Edit egg moves list
|
||||
cmdwin = pbListWindow([], 200)
|
||||
oldsel = nil
|
||||
ret = oldsetting
|
||||
cmd = 0
|
||||
commands = []
|
||||
refreshlist = true
|
||||
loop do
|
||||
if refreshlist
|
||||
realcmds.sort! { |a,b| (a[2]==b[2]) ? a[1]<=>b[1] : a[2]<=>b[2] }
|
||||
realcmds.sort! { |a, b| (a[2] == b[2]) ? a[1] <=> b[1] : a[2] <=> b[2] }
|
||||
commands = []
|
||||
for i in 0...realcmds.length
|
||||
commands.push(realcmds[i][1])
|
||||
cmd = i if oldsel>=0 && realcmds[i][0]==oldsel
|
||||
realcmds.each_with_index do |entry, i|
|
||||
commands.push(entry[1])
|
||||
cmd = i if oldsel && entry[0] == oldsel
|
||||
end
|
||||
end
|
||||
refreshlist = false; oldsel = -1
|
||||
cmd = pbCommands2(cmdwin,commands,-1,cmd,true)
|
||||
if cmd>=0
|
||||
refreshlist = false
|
||||
oldsel = nil
|
||||
cmd = pbCommands2(cmdwin, commands, -1, cmd, true)
|
||||
if cmd >= 0 # Chose an entry
|
||||
entry = realcmds[cmd]
|
||||
if entry[0]==0 # Add new move
|
||||
if entry[2] == -1 # Add new move
|
||||
newmove = pbChooseMoveList
|
||||
if newmove>0
|
||||
havemove = false
|
||||
for i in 0...realcmds.length
|
||||
havemove = true if realcmds[i][0]==newmove
|
||||
end
|
||||
if havemove
|
||||
oldsel = newmove
|
||||
if newmove
|
||||
if realcmds.any? { |e| e[0] == newmove }
|
||||
oldsel = newmove # Already have move; just move cursor to it
|
||||
else
|
||||
realcmds.push([newmove,PBMoves.getName(newmove),0])
|
||||
realcmds.push([newmove, GameData::Move.get(newmove).name, 0])
|
||||
end
|
||||
refreshlist = true
|
||||
end
|
||||
else # Edit move
|
||||
cmd2 = pbMessage(_INTL("\\ts[]Do what with this move?"),
|
||||
[_INTL("Change move"),_INTL("Delete"),_INTL("Cancel")],3)
|
||||
if cmd2==0
|
||||
case pbMessage(_INTL("\\ts[]Do what with this move?"),
|
||||
[_INTL("Change move"), _INTL("Delete"), _INTL("Cancel")], 3)
|
||||
when 0 # Change move
|
||||
newmove = pbChooseMoveList(entry[0])
|
||||
if newmove>0
|
||||
havemove = false
|
||||
for i in 0...realcmds.length
|
||||
havemove = true if realcmds[i][0]==newmove
|
||||
end
|
||||
if havemove
|
||||
if newmove
|
||||
if realcmds.any? { |e| e[0] == newmove } # Already have move; delete this one
|
||||
realcmds[cmd] = nil
|
||||
realcmds.compact!
|
||||
cmd = [cmd,realcmds.length-1].min
|
||||
else
|
||||
realcmds[cmd] = [newmove,PBMoves.getName(newmove),0]
|
||||
cmd = [cmd, realcmds.length - 1].min
|
||||
else # Change move
|
||||
realcmds[cmd] = [newmove, GameData::Move.get(newmove).name, 0]
|
||||
end
|
||||
oldsel = newmove
|
||||
refreshlist = true
|
||||
end
|
||||
elsif cmd2==1
|
||||
when 1 # Delete
|
||||
realcmds[cmd] = nil
|
||||
realcmds.compact!
|
||||
cmd = [cmd,realcmds.length-1].min
|
||||
cmd = [cmd, realcmds.length - 1].min
|
||||
refreshlist = true
|
||||
end
|
||||
end
|
||||
else
|
||||
cmd2 = pbMessage(_INTL("Save changes?"),
|
||||
[_INTL("Yes"),_INTL("No"),_INTL("Cancel")],3)
|
||||
if cmd2==0 || cmd2==1
|
||||
if cmd2==0
|
||||
for i in 0...realcmds.length
|
||||
realcmds[i] = realcmds[i][0]
|
||||
realcmds[i] = nil if realcmds[i]==0
|
||||
end
|
||||
realcmds.compact!
|
||||
ret = realcmds
|
||||
else # Cancel/quit
|
||||
case pbMessage(_INTL("Save changes?"),
|
||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||
when 0
|
||||
for i in 0...realcmds.length
|
||||
realcmds[i] = realcmds[i][0]
|
||||
end
|
||||
realcmds.compact!
|
||||
ret = realcmds
|
||||
break
|
||||
when 1
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -1072,8 +1070,8 @@ module EggMovesProperty
|
||||
def self.format(value)
|
||||
ret = ""
|
||||
for i in 0...value.length
|
||||
ret << "," if i>0
|
||||
ret << sprintf("#{PBMoves.getName(value[i])}")
|
||||
ret << "," if i > 0
|
||||
ret << GameData::Move.get(value[i]).real_name
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -1254,7 +1252,7 @@ class EvolutionsProperty
|
||||
case param_type
|
||||
when :Item
|
||||
newparam = pbChooseItemList
|
||||
when :PBMoves
|
||||
when :Move
|
||||
newparam = pbChooseMoveList
|
||||
when :PBSpecies
|
||||
newparam = pbChooseSpeciesList
|
||||
@@ -1343,7 +1341,7 @@ class EvolutionsProperty
|
||||
case param_type
|
||||
when :Item
|
||||
newparam = pbChooseItemList(entry[1])
|
||||
when :PBMoves
|
||||
when :Move
|
||||
newparam = pbChooseMoveList(entry[1])
|
||||
when :PBSpecies
|
||||
newparam = pbChooseSpeciesList(entry[1])
|
||||
|
||||
@@ -17,8 +17,7 @@ def pbGetLegalMoves(species)
|
||||
tmdat = pbLoadSpeciesTMData
|
||||
GameData::Item.each do |i|
|
||||
next if !i.move
|
||||
atk = getConst(PBMoves, i.move)
|
||||
moves.push(atk) if tmdat[atk] && tmdat[atk].include?(species)
|
||||
moves.push(i.move) if tmdat[i.move] && tmdat[i.move].include?(species)
|
||||
end
|
||||
babyspecies = pbGetBabySpecies(species)
|
||||
eggMoves = pbGetSpeciesEggMoves(babyspecies)
|
||||
@@ -228,7 +227,7 @@ def pbGetGenderConst(i)
|
||||
end
|
||||
|
||||
def pbGetHabitatConst(i)
|
||||
ret = MakeshiftConsts.get(53,i,PBHabitats)
|
||||
ret = MakeshiftConsts.get(54,i,PBHabitats)
|
||||
if !ret
|
||||
ret = ["","Grassland","Forest","WatersEdge","Sea","Cave","Mountain",
|
||||
"RoughTerrain","Urban","Rare"]
|
||||
@@ -243,9 +242,10 @@ end
|
||||
# return MakeshiftConsts.get(MessageTypes::Abilities,i,PBAbilities)
|
||||
#end
|
||||
|
||||
def pbGetMoveConst(i)
|
||||
return MakeshiftConsts.get(MessageTypes::Moves,i,PBMoves)
|
||||
end
|
||||
# Unused
|
||||
#def pbGetMoveConst(i)
|
||||
# return MakeshiftConsts.get(MessageTypes::Moves,i,PBMoves)
|
||||
#end
|
||||
|
||||
# Unused
|
||||
#def pbGetItemConst(i)
|
||||
@@ -283,47 +283,44 @@ end
|
||||
# is the ID of the move to initially select.
|
||||
def pbChooseMoveList(default=0)
|
||||
commands = []
|
||||
for i in 1..PBMoves.maxValue
|
||||
cname = getConstantName(PBMoves,i) rescue nil
|
||||
commands.push([i,PBMoves.getName(i)]) if cname
|
||||
end
|
||||
return pbChooseList(commands,default,0)
|
||||
GameData::Move.each { |i| commands.push([i.id_number, i.name, i.id]) }
|
||||
return pbChooseList(commands, default, nil, -1)
|
||||
end
|
||||
|
||||
def pbChooseMoveListForSpecies(species,defaultMoveID=0)
|
||||
cmdwin = pbListWindow([],200)
|
||||
def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||
cmdwin = pbListWindow([], 200)
|
||||
commands = []
|
||||
moveDefault = 0
|
||||
# Get all legal moves
|
||||
legalMoves = pbGetLegalMoves(species)
|
||||
for move in legalMoves
|
||||
commands.push([move,PBMoves.getName(move)])
|
||||
legalMoves.each do |move|
|
||||
move_data = GameData::Move.get(move)
|
||||
commands.push([move_data.id_number, move_data.name, move_data.id])
|
||||
end
|
||||
commands.sort! { |a,b| a[1]<=>b[1] }
|
||||
if defaultMoveID>0
|
||||
commands.each_with_index do |_item,i|
|
||||
moveDefault = i if moveDefault==0 && i[0]==defaultMoveID
|
||||
commands.sort! { |a, b| a[1] <=> b[1] }
|
||||
moveDefault = 0
|
||||
if defaultMoveID
|
||||
commands.each_with_index do |_item, i|
|
||||
moveDefault = i if moveDefault == 0 && i[2] == defaultMoveID
|
||||
end
|
||||
end
|
||||
# Get all moves
|
||||
commands2 = []
|
||||
for i in 1..PBMoves.maxValue
|
||||
if PBMoves.getName(i)!=nil && PBMoves.getName(i)!=""
|
||||
commands2.push([i,PBMoves.getName(i)])
|
||||
end
|
||||
end
|
||||
commands2.sort! { |a,b| a[1]<=>b[1] }
|
||||
if defaultMoveID>0
|
||||
commands2.each_with_index do |_item,i|
|
||||
moveDefault = i if moveDefault==0 && i[0]==defaultMoveID
|
||||
GameData::Move.each do |move_data|
|
||||
commands2.push([move_data.id_number, move_data.name, move_data.id])
|
||||
end
|
||||
commands2.sort! { |a, b| a[0] <=> b[0] }
|
||||
if defaultMoveID
|
||||
commands2.each_with_index do |_item, i|
|
||||
moveDefault = i if moveDefault == 0 && i[2] == defaultMoveID
|
||||
end
|
||||
end
|
||||
# Choose from all moves
|
||||
commands.concat(commands2)
|
||||
realcommands = []
|
||||
for command in commands
|
||||
realcommands.push("#{command[1]}")
|
||||
end
|
||||
ret = pbCommands2(cmdwin,realcommands,-1,moveDefault,true)
|
||||
commands.each { |cmd| realcommands.push(cmd[1]) }
|
||||
ret = pbCommands2(cmdwin, realcommands, -1, moveDefault, true)
|
||||
cmdwin.dispose
|
||||
return (ret>=0) ? commands[ret][0] : 0
|
||||
return (ret >= 0) ? commands[ret][2] : nil
|
||||
end
|
||||
|
||||
# Displays an alphabetically sorted list of all types, and returns the ID of the
|
||||
@@ -352,7 +349,7 @@ end
|
||||
# (or -1 if the selection was canceled). "default", if specified, is the ID of
|
||||
# the ability to initially select. Pressing Input::A will toggle the list
|
||||
# sorting between numerical and alphabetical.
|
||||
def pbChooseAbilityList(default = 0)
|
||||
def pbChooseAbilityList(default = nil)
|
||||
commands = []
|
||||
GameData::Ability.each { |a| commands.push([a.id_number, a.name, a.id]) }
|
||||
return pbChooseList(commands, default, nil, -1)
|
||||
@@ -364,7 +361,7 @@ def pbChooseBallList(defaultMoveID = -1)
|
||||
moveDefault = 0
|
||||
for key in $BallTypes.keys
|
||||
item = GameData::Item.try_get($BallTypes[key])
|
||||
balls.push([key.to_i, item.name]) if item
|
||||
commands.push([key.to_i, item.name]) if item
|
||||
end
|
||||
commands.sort! { |a, b| a[1] <=> b[1] }
|
||||
if defaultMoveID >= 0
|
||||
|
||||
@@ -133,7 +133,7 @@ class ByteArray
|
||||
end
|
||||
end
|
||||
|
||||
# Used for tm.txt data
|
||||
# Unused
|
||||
class WordArray
|
||||
include Enumerable
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ module Compiler
|
||||
end
|
||||
return enumer.const_get(ret.to_sym)
|
||||
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
|
||||
if [:Ability, :Item].include?(enumer)
|
||||
if [:Ability, :Item, :Move].include?(enumer)
|
||||
enumer = GameData.const_get(enumer.to_sym)
|
||||
begin
|
||||
if ret == "" || !enumer.exists?(ret.to_sym)
|
||||
@@ -353,7 +353,7 @@ module Compiler
|
||||
return nil if ret=="" || !(enumer.const_defined?(ret) rescue false)
|
||||
return enumer.const_get(ret.to_sym)
|
||||
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
|
||||
if [:Ability, :Item].include?(enumer)
|
||||
if [:Ability, :Item, :Move].include?(enumer)
|
||||
enumer = GameData.const_get(enumer.to_sym)
|
||||
return nil if ret == "" || !enumer.exists?(ret.to_sym)
|
||||
return ret.to_sym
|
||||
@@ -568,7 +568,7 @@ module Compiler
|
||||
clonitem.sub!(/\s*$/,"")
|
||||
itm = GameData::Item.try_get(clonitem)
|
||||
if !itm
|
||||
raise _INTL("Undefined item constant name: %s\r\nName must consist only of letters, numbers and\r\nunderscores, and can't begin with a number.\r\nMake sure the item is defined in\r\nPBS/items.txt.\r\n{1}",FileLineData.linereport)
|
||||
raise _INTL("Undefined item constant name: %s\r\nName must consist only of letters, numbers and\r\nunderscores, and can't begin with a number.\r\nMake sure the item is defined in\r\nPBS/items.txt.\r\n{1}", item, FileLineData.linereport)
|
||||
end
|
||||
return itm.id.to_s
|
||||
end
|
||||
@@ -582,11 +582,16 @@ module Compiler
|
||||
return pbGetConst(PBSpecies,clonitem,_INTL("Undefined species constant name: [%s]\r\nName must consist only of letters, numbers, and\r\nunderscores and can't begin with a number.\r\nMake sure the name is defined in\r\nPBS/pokemon.txt.\r\n{1}",FileLineData.linereport))
|
||||
end
|
||||
|
||||
def parseMove(item)
|
||||
clonitem = item.upcase
|
||||
clonitem.sub!(/^\s*/,"")
|
||||
clonitem.sub!(/\s*$/,"")
|
||||
return pbGetConst(PBMoves,clonitem,_INTL("Undefined move constant name: %s\r\nName must consist only of letters, numbers, and\r\nunderscores and can't begin with a number.\r\nMake sure the name is defined in\r\nPBS/moves.txt.\r\n{1}",FileLineData.linereport))
|
||||
def parseMove(move, skip_unknown = false)
|
||||
clonmove = move.upcase
|
||||
clonmove.sub!(/^\s*/, "")
|
||||
clonmove.sub!(/\s*$/, "")
|
||||
mov = GameData::Move.try_get(clonmove)
|
||||
if !mov
|
||||
return nil if skip_unknown
|
||||
raise _INTL("Undefined move constant name: %s\r\nName must consist only of letters, numbers and\r\nunderscores, and can't begin with a number.\r\nMake sure the move is defined in\r\nPBS/moves.txt.\r\n{1}", move, FileLineData.linereport)
|
||||
end
|
||||
return mov.id.to_s
|
||||
end
|
||||
|
||||
# Unused
|
||||
@@ -625,19 +630,19 @@ module Compiler
|
||||
yield(_INTL("Compiling move data"))
|
||||
compile_moves # Depends on PBTypes
|
||||
yield(_INTL("Compiling item data"))
|
||||
compile_items # Depends on PBMoves
|
||||
compile_items # Depends on Move
|
||||
yield(_INTL("Compiling berry plant data"))
|
||||
compile_berry_plants # Depends on Item
|
||||
yield(_INTL("Compiling Pokémon data"))
|
||||
compile_pokemon # Depends on PBMoves, Item, PBTypes, Ability
|
||||
compile_pokemon # Depends on Move, Item, PBTypes, Ability
|
||||
yield(_INTL("Compiling Pokémon forms data"))
|
||||
compile_pokemon_forms # Depends on PBSpecies, PBMoves, Item, PBTypes, Ability
|
||||
compile_pokemon_forms # Depends on PBSpecies, Move, Item, PBTypes, Ability
|
||||
yield(_INTL("Compiling machine data"))
|
||||
compile_move_compatibilities # Depends on PBSpecies, PBMoves
|
||||
compile_move_compatibilities # Depends on PBSpecies, Move
|
||||
yield(_INTL("Compiling Trainer type data"))
|
||||
compile_trainer_types # No dependencies
|
||||
yield(_INTL("Compiling Trainer data"))
|
||||
compile_trainers # Depends on PBSpecies, Item, PBMoves
|
||||
compile_trainers # Depends on PBSpecies, Item, Move
|
||||
yield(_INTL("Compiling phone data"))
|
||||
compile_phone # Depends on PBTrainers
|
||||
yield(_INTL("Compiling metadata"))
|
||||
@@ -647,7 +652,7 @@ module Compiler
|
||||
yield(_INTL("Compiling encounter data"))
|
||||
compile_encounters # Depends on PBSpecies
|
||||
yield(_INTL("Compiling shadow moveset data"))
|
||||
compile_shadow_movesets # Depends on PBSpecies, PBMoves
|
||||
compile_shadow_movesets # Depends on PBSpecies, Move
|
||||
yield(_INTL("Compiling animations"))
|
||||
compile_animations
|
||||
yield(_INTL("Converting events"))
|
||||
|
||||
@@ -505,62 +505,56 @@ module Compiler
|
||||
# Compile move data
|
||||
#=============================================================================
|
||||
def compile_moves
|
||||
records = []
|
||||
moveNames = []
|
||||
moveDescs = []
|
||||
maxValue = 0
|
||||
count = 0
|
||||
pbCompilerEachPreppedLine("PBS/moves.txt") { |line,lineno|
|
||||
record = []
|
||||
lineRecord = pbGetCsvRecord(line,lineno,[0,"vnssueeuuuyiss",
|
||||
nil,nil,nil,nil,nil,PBTypes,["Physical","Special","Status"],
|
||||
nil,nil,nil,PBTargets,nil,nil,nil
|
||||
GameData::Move::DATA.clear
|
||||
move_names = []
|
||||
move_descriptions = []
|
||||
# Read each line of moves.txt at a time and compile it into an move
|
||||
pbCompilerEachPreppedLine("PBS/moves.txt") { |line, line_no|
|
||||
line = pbGetCsvRecord(line, line_no, [0, "vnssueeuuuyiss",
|
||||
nil, nil, nil, nil, nil, PBTypes, ["Physical", "Special", "Status"],
|
||||
nil, nil, nil, PBTargets, nil, nil, nil
|
||||
])
|
||||
if records[lineRecord[0]]
|
||||
raise _INTL("Move ID number '{1}' is used twice.\r\n{2}",lineRecord[0],FileLineData.linereport)
|
||||
move_number = line[0]
|
||||
move_symbol = line[1].to_sym
|
||||
if GameData::Move::DATA[move_number]
|
||||
raise _INTL("Move ID number '{1}' is used twice.\r\n{2}", move_number, FileLineData.linereport)
|
||||
elsif GameData::Move::DATA[move_symbol]
|
||||
raise _INTL("Move ID '{1}' is used twice.\r\n{2}", move_symbol, FileLineData.linereport)
|
||||
end
|
||||
if lineRecord[6]==2 && lineRecord[4]!=0
|
||||
raise _INTL("Status moves must have a base damage of 0, use either Physical or Special.\r\n{1}",FileLineData.linereport)
|
||||
# Sanitise data
|
||||
if line[6] == 2 && line[4] != 0
|
||||
raise _INTL("Move {1} is defined as a Status move with a non-zero base damage.\r\n{2}", line[2], FileLineData.linereport)
|
||||
elsif line[6] != 2 && line[4] == 0
|
||||
print _INTL("Warning: Move {1} was defined as Physical or Special but had a base damage of 0. Changing it to a Status move.\r\n{2}", line[2], FileLineData.linereport)
|
||||
line[6] = 2
|
||||
end
|
||||
if lineRecord[6]!=2 && lineRecord[4]==0
|
||||
print _INTL("Warning: Physical and special moves can't have a base damage of 0, changing to a Status move.\r\n{1}",FileLineData.linereport)
|
||||
lineRecord[6] = 2
|
||||
end
|
||||
record[MoveData::ID] = lineRecord[0]
|
||||
record[MoveData::INTERNAL_NAME] = lineRecord[1]
|
||||
record[MoveData::NAME] = lineRecord[2]
|
||||
record[MoveData::FUNCTION_CODE] = lineRecord[3]
|
||||
record[MoveData::BASE_DAMAGE] = lineRecord[4]
|
||||
record[MoveData::TYPE] = lineRecord[5]
|
||||
record[MoveData::CATEGORY] = lineRecord[6]
|
||||
record[MoveData::ACCURACY] = lineRecord[7]
|
||||
record[MoveData::TOTAL_PP] = lineRecord[8]
|
||||
record[MoveData::EFFECT_CHANCE] = lineRecord[9]
|
||||
record[MoveData::TARGET] = lineRecord[10]
|
||||
record[MoveData::PRIORITY] = lineRecord[11]
|
||||
record[MoveData::FLAGS] = lineRecord[12]
|
||||
record[MoveData::DESCRIPTION] = lineRecord[13]
|
||||
maxValue = [maxValue,lineRecord[0]].max
|
||||
count += 1
|
||||
moveNames[lineRecord[0]] = lineRecord[2] # Name
|
||||
moveDescs[lineRecord[0]] = lineRecord[13] # Description
|
||||
records[lineRecord[0]] = record
|
||||
# Construct move hash
|
||||
move_hash = {
|
||||
:id_number => move_number,
|
||||
:id => move_symbol,
|
||||
:name => line[2],
|
||||
:function_code => line[3],
|
||||
:base_damage => line[4],
|
||||
:type => line[5],
|
||||
:category => line[6],
|
||||
:accuracy => line[7],
|
||||
:total_pp => line[8],
|
||||
:effect_chance => line[9],
|
||||
:target => line[10],
|
||||
:priority => line[11],
|
||||
:flags => line[12],
|
||||
:description => line[13]
|
||||
}
|
||||
# Add move's data to records
|
||||
GameData::Move::DATA[move_number] = GameData::Move::DATA[move_symbol] = GameData::Move.new(move_hash)
|
||||
move_names[move_number] = move_hash[:name]
|
||||
move_descriptions[move_number] = move_hash[:description]
|
||||
}
|
||||
save_data(records,"Data/moves.dat")
|
||||
MessageTypes.setMessages(MessageTypes::Moves,moveNames)
|
||||
MessageTypes.setMessages(MessageTypes::MoveDescriptions,moveDescs)
|
||||
code = "class PBMoves\r\n"
|
||||
for rec in records
|
||||
code += "#{rec[MoveData::INTERNAL_NAME]}=#{rec[MoveData::ID]}\r\n" if rec
|
||||
end
|
||||
code += "def self.getName(id)\r\n"
|
||||
code += "id=getID(PBMoves,id)\r\n"
|
||||
code += "return pbGetMessage(MessageTypes::Moves,id); end\r\n"
|
||||
code += "def self.getCount; return #{count}; end\r\n"
|
||||
code += "def self.maxValue; return #{maxValue}; end\r\n"
|
||||
code += "end\r\n"
|
||||
eval(code, TOPLEVEL_BINDING)
|
||||
pbAddScript(code,"PBMoves")
|
||||
# Save all data
|
||||
GameData::Move.save
|
||||
MessageTypes.setMessages(MessageTypes::Moves, move_names)
|
||||
MessageTypes.setMessages(MessageTypes::MoveDescriptions, move_descriptions)
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -598,13 +592,13 @@ module Compiler
|
||||
for i in 0...pbanims.length
|
||||
next if !pbanims[i]
|
||||
if pbanims[i].name[/^OppMove\:\s*(.*)$/]
|
||||
if hasConst?(PBMoves,$~[1])
|
||||
moveid = PBMoves.const_get($~[1])
|
||||
if GameData::Move.exists?($~[1])
|
||||
moveid = GameData::Move.get($~[1]).id_number
|
||||
move2anim[1][moveid] = i
|
||||
end
|
||||
elsif pbanims[i].name[/^Move\:\s*(.*)$/]
|
||||
if hasConst?(PBMoves,$~[1])
|
||||
moveid = PBMoves.const_get($~[1])
|
||||
if GameData::Move.exists?($~[1])
|
||||
moveid = GameData::Move.get($~[1]).id_number
|
||||
move2anim[0][moveid] = i
|
||||
end
|
||||
end
|
||||
@@ -1055,7 +1049,7 @@ module Compiler
|
||||
lineno = 1
|
||||
havesection = false
|
||||
sectionname = nil
|
||||
sections = []
|
||||
sections = {}
|
||||
if safeExists?("PBS/tm.txt")
|
||||
f = File.open("PBS/tm.txt","rb")
|
||||
FileLineData.file = "PBS/tm.txt"
|
||||
@@ -1070,7 +1064,7 @@ module Compiler
|
||||
if sections[sectionname]
|
||||
raise _INTL("TM section [{1}] is defined twice.\r\n{2}",sectionname,FileLineData.linereport)
|
||||
end
|
||||
sections[sectionname] = WordArray.new
|
||||
sections[sectionname] = []
|
||||
havesection = true
|
||||
else
|
||||
if sectionname==nil
|
||||
@@ -1107,8 +1101,9 @@ module Compiler
|
||||
value = value.split(",")
|
||||
species = parseSpecies(key)
|
||||
moves = []
|
||||
for i in 0...[4,value.length].min
|
||||
moves.push((parseMove(value[i]) rescue nil))
|
||||
for i in 0...[Pokemon::MAX_MOVES,value.length].min
|
||||
move = parseMove(value[i], true)
|
||||
moves.push(move) if move
|
||||
end
|
||||
moves.compact!
|
||||
sections[species] = moves if moves.length>0
|
||||
@@ -1316,7 +1311,7 @@ module Compiler
|
||||
raise _INTL("Bad level: {1} (must be 1-{2}).\r\n{3}",record[1],mLevel,FileLineData.linereport)
|
||||
end
|
||||
when "Moves"
|
||||
record = [record] if record.is_a?(Integer)
|
||||
record = [record] if record.is_a?(Symbol)
|
||||
record.compact!
|
||||
when "Ability"
|
||||
if record>5
|
||||
@@ -1407,8 +1402,8 @@ module Compiler
|
||||
pokemonindex += 1
|
||||
trainers[trainerindex][3][pokemonindex] = []
|
||||
record = pbGetCsvRecord(line,lineno,
|
||||
[0,"evEEEEEUEUBEUUSBU",PBSpecies,nil,Item,PBMoves,PBMoves,PBMoves,
|
||||
PBMoves,nil,{"M"=>0,"m"=>0,"Male"=>0,"male"=>0,
|
||||
[0,"evEEEEEUEUBEUUSBU",PBSpecies,nil,:Item,:Move,:Move,:Move,:Move,
|
||||
nil,{"M"=>0,"m"=>0,"Male"=>0,"male"=>0,
|
||||
"0"=>0,"F"=>1,"f"=>1,"Female"=>1,"female"=>1,
|
||||
"1"=>1},nil,nil,PBNatures,nil,nil,nil,nil,nil])
|
||||
# Error checking (the +3 is for properties after the four moves)
|
||||
|
||||
Reference in New Issue
Block a user