Moved move data constants into module MoveData

This commit is contained in:
Maruno17
2020-10-17 00:29:58 +01:00
parent d3ec5c2c53
commit c30e302ccf
15 changed files with 131 additions and 129 deletions

View File

@@ -1,17 +1,19 @@
MOVE_ID = 0 module MoveData
MOVE_INTERNAL_NAME = 1 ID = 0
MOVE_NAME = 2 INTERNAL_NAME = 1
MOVE_FUNCTION_CODE = 3 NAME = 2
MOVE_BASE_DAMAGE = 4 FUNCTION_CODE = 3
MOVE_TYPE = 5 BASE_DAMAGE = 4
MOVE_CATEGORY = 6 TYPE = 5
MOVE_ACCURACY = 7 CATEGORY = 6
MOVE_TOTAL_PP = 8 ACCURACY = 7
MOVE_EFFECT_CHANCE = 9 TOTAL_PP = 8
MOVE_TARGET = 10 EFFECT_CHANCE = 9
MOVE_PRIORITY = 11 TARGET = 10
MOVE_FLAGS = 12 PRIORITY = 11
MOVE_DESCRIPTION = 13 FLAGS = 12
DESCRIPTION = 13
end
class PokemonTemp class PokemonTemp
attr_accessor :movesData attr_accessor :movesData
@@ -55,7 +57,7 @@ class PBMove
# Initializes this object to the specified move ID. # Initializes this object to the specified move ID.
def initialize(move_id) def initialize(move_id)
@id = move_id @id = move_id
@pp = pbGetMoveData(move_id, MOVE_TOTAL_PP) || 0 @pp = pbGetMoveData(move_id, MoveData::TOTAL_PP) || 0
@ppup = 0 @ppup = 0
end end
@@ -69,12 +71,12 @@ class PBMove
# Gets this move's type. # Gets this move's type.
def type def type
return pbGetMoveData(@id, MOVE_TYPE) || 0 return pbGetMoveData(@id, MoveData::TYPE) || 0
end end
# Gets the maximum PP for this move. # Gets the maximum PP for this move.
def totalpp def totalpp
max_pp = pbGetMoveData(@id, MOVE_TOTAL_PP) || 0 max_pp = pbGetMoveData(@id, MoveData::TOTAL_PP) || 0
return max_pp + max_pp * @ppup / 5 return max_pp + max_pp * @ppup / 5
end end
end end
@@ -88,15 +90,15 @@ class PBMoveData
def initialize(move_id) def initialize(move_id)
move_data = pbGetMoveData(move_id) move_data = pbGetMoveData(move_id)
@function = move_data[MOVE_FUNCTION_CODE] @function = move_data[MoveData::FUNCTION_CODE]
@basedamage = move_data[MOVE_BASE_DAMAGE] @basedamage = move_data[MoveData::BASE_DAMAGE]
@type = move_data[MOVE_TYPE] @type = move_data[MoveData::TYPE]
@category = move_data[MOVE_CATEGORY] @category = move_data[MoveData::CATEGORY]
@accuracy = move_data[MOVE_ACCURACY] @accuracy = move_data[MoveData::ACCURACY]
@totalpp = move_data[MOVE_TOTAL_PP] @totalpp = move_data[MoveData::TOTAL_PP]
@addlEffect = move_data[MOVE_EFFECT_CHANCE] @addlEffect = move_data[MoveData::EFFECT_CHANCE]
@target = move_data[MOVE_TARGET] @target = move_data[MoveData::TARGET]
@priority = move_data[MOVE_PRIORITY] @priority = move_data[MoveData::PRIORITY]
@flags = move_data[MOVE_FLAGS] @flags = move_data[MoveData::FLAGS]
end end
end end

View File

@@ -583,7 +583,7 @@ class PokeBattle_Battler
def inTwoTurnAttack?(*arg) def inTwoTurnAttack?(*arg)
return false if @effects[PBEffects::TwoTurnAttack]==0 return false if @effects[PBEffects::TwoTurnAttack]==0
ttaFunction = pbGetMoveData(@effects[PBEffects::TwoTurnAttack],MOVE_FUNCTION_CODE) ttaFunction = pbGetMoveData(@effects[PBEffects::TwoTurnAttack],MoveData::FUNCTION_CODE)
arg.each { |a| return true if a==ttaFunction } arg.each { |a| return true if a==ttaFunction }
return false return false
end end

View File

@@ -30,16 +30,16 @@ class PokeBattle_Move
@name = PBMoves.getName(@id) # Get the move's name @name = PBMoves.getName(@id) # Get the move's name
# Get data on the move # Get data on the move
moveData = pbGetMoveData(@id) moveData = pbGetMoveData(@id)
@function = moveData[MOVE_FUNCTION_CODE] @function = moveData[MoveData::FUNCTION_CODE]
@baseDamage = moveData[MOVE_BASE_DAMAGE] @baseDamage = moveData[MoveData::BASE_DAMAGE]
@type = moveData[MOVE_TYPE] @type = moveData[MoveData::TYPE]
@category = moveData[MOVE_CATEGORY] @category = moveData[MoveData::CATEGORY]
@accuracy = moveData[MOVE_ACCURACY] @accuracy = moveData[MoveData::ACCURACY]
@pp = move.pp # Can be changed with Mimic/Transform @pp = move.pp # Can be changed with Mimic/Transform
@addlEffect = moveData[MOVE_EFFECT_CHANCE] @addlEffect = moveData[MoveData::EFFECT_CHANCE]
@target = moveData[MOVE_TARGET] @target = moveData[MoveData::TARGET]
@priority = moveData[MOVE_PRIORITY] @priority = moveData[MoveData::PRIORITY]
@flags = moveData[MOVE_FLAGS] @flags = moveData[MoveData::FLAGS]
@calcType = -1 @calcType = -1
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize @powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
@snatched = false @snatched = false
@@ -50,7 +50,7 @@ class PokeBattle_Move
# function code (found in the script section PokeBattle_MoveEffect). # function code (found in the script section PokeBattle_MoveEffect).
def PokeBattle_Move.pbFromPBMove(battle,move) def PokeBattle_Move.pbFromPBMove(battle,move)
move = PBMove.new(0) if !move move = PBMove.new(0) if !move
moveFunction = pbGetMoveData(move.id,MOVE_FUNCTION_CODE) || "000" moveFunction = pbGetMoveData(move.id,MoveData::FUNCTION_CODE) || "000"
className = sprintf("PokeBattle_Move_%s",moveFunction) className = sprintf("PokeBattle_Move_%s",moveFunction)
if Object.const_defined?(className) if Object.const_defined?(className)
return Object.const_get(className).new(battle,move) return Object.const_get(className).new(battle,move)

View File

@@ -1708,8 +1708,8 @@ class PokeBattle_Move_05C < PokeBattle_Move
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed) lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
if target.lastRegularMoveUsed<=0 || if target.lastRegularMoveUsed<=0 ||
user.pbHasMove?(target.lastRegularMoveUsed) || user.pbHasMove?(target.lastRegularMoveUsed) ||
@moveBlacklist.include?(lastMoveData[MOVE_FUNCTION_CODE]) || @moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
isConst?(lastMoveData[MOVE_TYPE],PBTypes,:SHADOW) isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -1759,8 +1759,8 @@ class PokeBattle_Move_05D < PokeBattle_Move
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed) lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
if target.lastRegularMoveUsed<=0 || if target.lastRegularMoveUsed<=0 ||
user.pbHasMove?(target.lastRegularMoveUsed) || user.pbHasMove?(target.lastRegularMoveUsed) ||
@moveBlacklist.include?(lastMoveData[MOVE_FUNCTION_CODE]) || @moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
isConst?(lastMoveData[MOVE_TYPE],PBTypes,:SHADOW) isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -1837,7 +1837,7 @@ class PokeBattle_Move_05F < PokeBattle_Move
def pbFailsAgainstTarget?(user,target) def pbFailsAgainstTarget?(user,target)
if target.lastMoveUsed<=0 || if target.lastMoveUsed<=0 ||
target.lastMoveUsedType<0 || target.lastMoveUsedType<0 ||
PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MOVE_TYPE)) PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MoveData::TYPE))
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end

View File

@@ -1125,7 +1125,7 @@ class PokeBattle_Move_0AE < PokeBattle_Move
def pbFailsAgainstTarget?(user,target) def pbFailsAgainstTarget?(user,target)
if target.lastRegularMoveUsed<=0 || if target.lastRegularMoveUsed<=0 ||
!pbGetMoveData(target.lastRegularMoveUsed,MOVE_FLAGS)[/e/] # Not copyable by Mirror Move !pbGetMoveData(target.lastRegularMoveUsed,MoveData::FLAGS)[/e/] # Not copyable by Mirror Move
@battle.pbDisplay(_INTL("The mirror move failed!")) @battle.pbDisplay(_INTL("The mirror move failed!"))
return true return true
end end
@@ -1216,7 +1216,7 @@ class PokeBattle_Move_0AF < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if @battle.lastMoveUsed<=0 || if @battle.lastMoveUsed<=0 ||
@moveBlacklist.include?(pbGetMoveData(@battle.lastMoveUsed,MOVE_FUNCTION_CODE)) @moveBlacklist.include?(pbGetMoveData(@battle.lastMoveUsed,MoveData::FUNCTION_CODE))
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -1560,7 +1560,7 @@ class PokeBattle_Move_0B5 < PokeBattle_Move
next if NEWEST_BATTLE_MECHANICS && pkmn.egg? next if NEWEST_BATTLE_MECHANICS && pkmn.egg?
pkmn.moves.each do |move| pkmn.moves.each do |move|
next if !move || move.id<=0 next if !move || move.id<=0
next if @moveBlacklist.include?(pbGetMoveData(move.id,MOVE_FUNCTION_CODE)) next if @moveBlacklist.include?(pbGetMoveData(move.id,MoveData::FUNCTION_CODE))
next if isConst?(move.type,PBTypes,:SHADOW) next if isConst?(move.type,PBTypes,:SHADOW)
@assistMoves.push(move.id) @assistMoves.push(move.id)
end end
@@ -1678,14 +1678,14 @@ class PokeBattle_Move_0B6 < PokeBattle_Move
1000.times do 1000.times do
move = @battle.pbRandom(PBMoves.maxValue)+1 # Random move move = @battle.pbRandom(PBMoves.maxValue)+1 # Random move
next if !movesData[move] next if !movesData[move]
next if @moveBlacklist.include?(movesData[move][MOVE_FUNCTION_CODE]) next if @moveBlacklist.include?(movesData[move][MoveData::FUNCTION_CODE])
blMove = false blMove = false
@moveBlacklistSignatures.each do |m| @moveBlacklistSignatures.each do |m|
next if !isConst?(move,PBMoves,m) next if !isConst?(move,PBMoves,m)
blMove = true; break blMove = true; break
end end
next if blMove next if blMove
next if isConst?(movesData[move][MOVE_TYPE],PBTypes,:SHADOW) next if isConst?(movesData[move][MoveData::TYPE],PBTypes,:SHADOW)
@metronomeMove = move @metronomeMove = move
break break
end end
@@ -1881,7 +1881,7 @@ class PokeBattle_Move_0BC < PokeBattle_Move
return true return true
end end
if target.lastRegularMoveUsed<=0 || if target.lastRegularMoveUsed<=0 ||
@moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MOVE_FUNCTION_CODE)) @moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MoveData::FUNCTION_CODE))
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end

View File

@@ -2342,7 +2342,7 @@ class PokeBattle_Move_16B < PokeBattle_Move
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
if @moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MOVE_FUNCTION_CODE)) if @moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MoveData::FUNCTION_CODE))
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end

View File

@@ -20,10 +20,10 @@ class PokeBattle_AI
if !target.fainted? && target.lastMoveUsed>0 && if !target.fainted? && target.lastMoveUsed>0 &&
(target.level-battler.level).abs<=6 (target.level-battler.level).abs<=6
moveData = pbGetMoveData(target.lastMoveUsed) moveData = pbGetMoveData(target.lastMoveUsed)
moveType = moveData[MOVE_TYPE] moveType = moveData[MoveData::TYPE]
typeMod = pbCalcTypeMod(moveType,target,battler) typeMod = pbCalcTypeMod(moveType,target,battler)
if PBTypes.superEffective?(typeMod) && moveData[MOVE_BASE_DAMAGE]>50 if PBTypes.superEffective?(typeMod) && moveData[MoveData::BASE_DAMAGE]>50
switchChance = (moveData[MOVE_BASE_DAMAGE]>70) ? 30 : 20 switchChance = (moveData[MoveData::BASE_DAMAGE]>70) ? 30 : 20
shouldSwitch = (pbAIRandom(100)<switchChance) shouldSwitch = (pbAIRandom(100)<switchChance)
end end
end end
@@ -165,10 +165,10 @@ class PokeBattle_AI
pkmn.moves.each do |m| pkmn.moves.each do |m|
next if m.id==0 next if m.id==0
moveData = movesData[m.id] moveData = movesData[m.id]
next if moveData[MOVE_BASE_DAMAGE]==0 next if moveData[MoveData::BASE_DAMAGE]==0
@battle.battlers[idxBattler].eachOpposing do |b| @battle.battlers[idxBattler].eachOpposing do |b|
bTypes = b.pbTypes(true) bTypes = b.pbTypes(true)
sum += PBTypes.getCombinedEffectiveness(moveData[MOVE_TYPE], sum += PBTypes.getCombinedEffectiveness(moveData[MoveData::TYPE],
bTypes[0],bTypes[1],bTypes[2]) bTypes[0],bTypes[1],bTypes[2])
end end
end end

View File

@@ -1278,8 +1278,8 @@ class PokeBattle_AI
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed) lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
if user.effects[PBEffects::Transform] || if user.effects[PBEffects::Transform] ||
target.lastRegularMoveUsed<=0 || target.lastRegularMoveUsed<=0 ||
moveBlacklist.include?(lastMoveData[MOVE_FUNCTION_CODE]) || moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
isConst?(lastMoveData[MOVE_TYPE],PBTypes,:SHADOW) isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
score -= 90 score -= 90
end end
user.eachMove do |m| user.eachMove do |m|
@@ -1297,8 +1297,8 @@ class PokeBattle_AI
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed) lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
if user.effects[PBEffects::Transform] || if user.effects[PBEffects::Transform] ||
target.lastRegularMoveUsed<=0 || target.lastRegularMoveUsed<=0 ||
moveBlacklist.include?(lastMoveData[MOVE_FUNCTION_CODE]) || moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
isConst?(lastMoveData[MOVE_TYPE],PBTypes,:SHADOW) isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
score -= 90 score -= 90
end end
user.eachMove do |m| user.eachMove do |m|
@@ -1327,7 +1327,7 @@ class PokeBattle_AI
isConst?(user.ability,PBAbilities,:RKSSYSTEM) isConst?(user.ability,PBAbilities,:RKSSYSTEM)
score -= 90 score -= 90
elsif target.lastMoveUsed<=0 || elsif target.lastMoveUsed<=0 ||
PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MOVE_TYPE)) PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MoveData::TYPE))
score -= 90 score -= 90
else else
aType = -1 aType = -1
@@ -1551,9 +1551,9 @@ class PokeBattle_AI
score -= 60 score -= 60
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0 elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0
moveData = pbGetMoveData(target.lastMoveUsed) moveData = pbGetMoveData(target.lastMoveUsed)
if moveData[MOVE_BASE_DAMAGE]>0 && if moveData[MoveData::BASE_DAMAGE]>0 &&
(MOVE_CATEGORY_PER_MOVE && moveData[MOVE_CATEGORY]==0) || (MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==0) ||
(!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData[MOVE_TYPE])) (!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData[MoveData::TYPE]))
score -= 60 score -= 60
end end
end end
@@ -1569,9 +1569,9 @@ class PokeBattle_AI
score -= 60 score -= 60
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0 elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0
moveData = pbGetMoveData(target.lastMoveUsed) moveData = pbGetMoveData(target.lastMoveUsed)
if moveData[MOVE_BASE_DAMAGE]>0 && if moveData[MoveData::BASE_DAMAGE]>0 &&
(MOVE_CATEGORY_PER_MOVE && moveData[MOVE_CATEGORY]==1) || (MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==1) ||
(!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData[MOVE_TYPE])) (!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData[MoveData::TYPE]))
score -= 60 score -= 60
end end
end end
@@ -1764,7 +1764,7 @@ class PokeBattle_AI
score -= 40 score -= 40
if skill>=PBTrainerAI.highSkill if skill>=PBTrainerAI.highSkill
score -= 100 if target.lastRegularMoveUsed<=0 || score -= 100 if target.lastRegularMoveUsed<=0 ||
!pbGetMoveData(target.lastRegularMoveUsed,MOVE_FLAGS)[/e/] # Not copyable by Mirror Move !pbGetMoveData(target.lastRegularMoveUsed,MoveData::FLAGS)[/e/] # Not copyable by Mirror Move
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "0AF" when "0AF"
@@ -1813,13 +1813,13 @@ class PokeBattle_AI
score -= 90 score -= 90
else else
moveData = pbGetMoveData(target.lastRegularMoveUsed) moveData = pbGetMoveData(target.lastRegularMoveUsed)
if moveData[MOVE_CATEGORY]==2 && # Status move if moveData[MoveData::CATEGORY]==2 && # Status move
(moveData[MOVE_TARGET]==PBTargets::User || (moveData[MoveData::TARGET]==PBTargets::User ||
moveData[MOVE_TARGET]==PBTargets::BothSides) moveData[MoveData::TARGET]==PBTargets::BothSides)
score += 60 score += 60
elsif moveData[MOVE_CATEGORY]!=2 && # Damaging move elsif moveData[MoveData::CATEGORY]!=2 && # Damaging move
moveData[MOVE_TARGET]==PBTargets::NearOther && moveData[MoveData::TARGET]==PBTargets::NearOther &&
PBTypes.ineffective?(pbCalcTypeMod(moveData[MOVE_TYPE],target,user)) PBTypes.ineffective?(pbCalcTypeMod(moveData[MoveData::TYPE],target,user))
score += 60 score += 60
end end
end end
@@ -2096,7 +2096,7 @@ class PokeBattle_AI
:CHOICEBAND,:CHOICESCARF,:CHOICESPECS]) :CHOICEBAND,:CHOICESCARF,:CHOICESPECS])
score += 50 score += 50
elsif user.item==0 && target.item!=0 elsif user.item==0 && target.item!=0
score -= 30 if pbGetMoveData(user.lastMoveUsed,MOVE_FUNCTION_CODE)=="0F2" # Trick/Switcheroo score -= 30 if pbGetMoveData(user.lastMoveUsed,MoveData::FUNCTION_CODE)=="0F2" # Trick/Switcheroo
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "0F3" when "0F3"

View File

@@ -408,12 +408,12 @@ class PokeBattle_Scene
return anim if anim return anim if anim
# Actual animation not found, get the default animation for the move's type # Actual animation not found, get the default animation for the move's type
moveData = pbGetMoveData(moveID) moveData = pbGetMoveData(moveID)
moveType = moveData[MOVE_TYPE] moveType = moveData[MoveData::TYPE]
moveKind = moveData[MOVE_CATEGORY] moveKind = moveData[MoveData::CATEGORY]
moveKind += 3 if PBTargets.multipleTargets?(moveData[MOVE_TARGET]) || moveKind += 3 if PBTargets.multipleTargets?(moveData[MoveData::TARGET]) ||
PBTargets.targetsFoeSide?(moveData[MOVE_TARGET]) PBTargets.targetsFoeSide?(moveData[MoveData::TARGET])
moveKind += 3 if moveKind==2 && moveData[MOVE_TARGET]!=PBTargets::User && moveKind += 3 if moveKind==2 && moveData[MoveData::TARGET]!=PBTargets::User &&
moveData[MOVE_TARGET]!=PBTargets::UserSide moveData[MoveData::TARGET]!=PBTargets::UserSide
# [one target physical, one target special, user status, # [one target physical, one target special, user status,
# multiple targets physical, multiple targets special, non-user status] # multiple targets physical, multiple targets special, non-user status]
typeDefaultAnim = { typeDefaultAnim = {

View File

@@ -2099,15 +2099,15 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
next if m.statusMove? next if m.statusMove?
moveData = pbGetMoveData(m.id) moveData = pbGetMoveData(m.id)
if type1 if type1
moveType = moveData[MOVE_TYPE] moveType = moveData[MoveData::TYPE]
if NEWEST_BATTLE_MECHANICS && isConst?(m.id,PBMoves,:HIDDENPOWER) if NEWEST_BATTLE_MECHANICS && isConst?(m.id,PBMoves,:HIDDENPOWER)
moveType = pbHiddenPower(b.pokemon)[0] moveType = pbHiddenPower(b.pokemon)[0]
end end
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3) eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
next if PBTypes.ineffective?(eff) next if PBTypes.ineffective?(eff)
next if !PBTypes.superEffective?(eff) && moveData[MOVE_FUNCTION_CODE]!="070" # OHKO next if !PBTypes.superEffective?(eff) && moveData[MoveData::FUNCTION_CODE]!="070" # OHKO
else else
next if moveData[MOVE_FUNCTION_CODE]!="070" # OHKO next if moveData[MoveData::FUNCTION_CODE]!="070" # OHKO
end end
found = true found = true
break break
@@ -2207,17 +2207,17 @@ BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN,
battle.eachOtherSideBattler(battler.index) do |b| battle.eachOtherSideBattler(battler.index) do |b|
b.eachMove do |m| b.eachMove do |m|
moveData = pbGetMoveData(m.id) moveData = pbGetMoveData(m.id)
power = moveData[MOVE_BASE_DAMAGE] power = moveData[MoveData::BASE_DAMAGE]
power = 160 if ["070"].include?(moveData[MOVE_FUNCTION_CODE]) # OHKO power = 160 if ["070"].include?(moveData[MoveData::FUNCTION_CODE]) # OHKO
power = 150 if ["08B"].include?(moveData[MOVE_FUNCTION_CODE]) # Eruption power = 150 if ["08B"].include?(moveData[MoveData::FUNCTION_CODE]) # Eruption
# Counter, Mirror Coat, Metal Burst # Counter, Mirror Coat, Metal Burst
power = 120 if ["071","072","073"].include?(moveData[MOVE_FUNCTION_CODE]) power = 120 if ["071","072","073"].include?(moveData[MoveData::FUNCTION_CODE])
# Sonic Boom, Dragon Rage, Night Shade, Endeavor, Psywave, # Sonic Boom, Dragon Rage, Night Shade, Endeavor, Psywave,
# Return, Frustration, Crush Grip, Gyro Ball, Hidden Power, # Return, Frustration, Crush Grip, Gyro Ball, Hidden Power,
# Natural Gift, Trump Card, Flail, Grass Knot # Natural Gift, Trump Card, Flail, Grass Knot
power = 80 if ["06A","06B","06D","06E","06F", power = 80 if ["06A","06B","06D","06E","06F",
"089","08A","08C","08D","090", "089","08A","08C","08D","090",
"096","097","098","09A"].include?(moveData[MOVE_FUNCTION_CODE]) "096","097","098","09A"].include?(moveData[MoveData::FUNCTION_CODE])
next if power<highestPower next if power<highestPower
forewarnMoves = [] if power>highestPower forewarnMoves = [] if power>highestPower
forewarnMoves.push(m.id) forewarnMoves.push(m.id)

View File

@@ -714,9 +714,9 @@ class PokemonSummary_Scene
@sprites["itemicon"].visible = false if @sprites["itemicon"] @sprites["itemicon"].visible = false if @sprites["itemicon"]
# Get data for selected move # Get data for selected move
moveData = pbGetMoveData(moveid) moveData = pbGetMoveData(moveid)
basedamage = moveData[MOVE_BASE_DAMAGE] basedamage = moveData[MoveData::BASE_DAMAGE]
category = moveData[MOVE_CATEGORY] category = moveData[MoveData::CATEGORY]
accuracy = moveData[MOVE_ACCURACY] accuracy = moveData[MoveData::ACCURACY]
textpos = [] textpos = []
# Write power and accuracy values for selected move # Write power and accuracy values for selected move
if basedamage==0 # Status move if basedamage==0 # Status move

View File

@@ -103,14 +103,14 @@ class MoveRelearner_Scene
moveData=movesData[moveobject] moveData=movesData[moveobject]
if moveData if moveData
imagepos.push(["Graphics/Pictures/types",12,yPos+2,0, imagepos.push(["Graphics/Pictures/types",12,yPos+2,0,
moveData[MOVE_TYPE]*28,64,28]) moveData[MoveData::TYPE]*28,64,28])
textpos.push([PBMoves.getName(moveobject),80,yPos,0, textpos.push([PBMoves.getName(moveobject),80,yPos,0,
Color.new(248,248,248),Color.new(0,0,0)]) Color.new(248,248,248),Color.new(0,0,0)])
if moveData[MOVE_TOTAL_PP]>0 if moveData[MoveData::TOTAL_PP]>0
textpos.push([_INTL("PP"),112,yPos+32,0, textpos.push([_INTL("PP"),112,yPos+32,0,
Color.new(64,64,64),Color.new(176,176,176)]) Color.new(64,64,64),Color.new(176,176,176)])
textpos.push([_INTL("{1}/{2}", textpos.push([_INTL("{1}/{2}",
moveData[MOVE_TOTAL_PP],moveData[MOVE_TOTAL_PP]),230,yPos+32,1, moveData[MoveData::TOTAL_PP],moveData[MoveData::TOTAL_PP]),230,yPos+32,1,
Color.new(64,64,64),Color.new(176,176,176)]) Color.new(64,64,64),Color.new(176,176,176)])
end end
else else
@@ -124,9 +124,9 @@ class MoveRelearner_Scene
0,78+(@sprites["commands"].index-@sprites["commands"].top_item)*64, 0,78+(@sprites["commands"].index-@sprites["commands"].top_item)*64,
0,0,258,72]) 0,0,258,72])
selMoveData=movesData[@moves[@sprites["commands"].index]] selMoveData=movesData[@moves[@sprites["commands"].index]]
basedamage=selMoveData[MOVE_BASE_DAMAGE] basedamage=selMoveData[MoveData::BASE_DAMAGE]
category=selMoveData[MOVE_CATEGORY] category=selMoveData[MoveData::CATEGORY]
accuracy=selMoveData[MOVE_ACCURACY] accuracy=selMoveData[MoveData::ACCURACY]
textpos.push([_INTL("CATEGORY"),272,114,0,Color.new(248,248,248),Color.new(0,0,0)]) 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([_INTL("POWER"),272,146,0,Color.new(248,248,248),Color.new(0,0,0)])
textpos.push([basedamage<=1 ? basedamage==1 ? "???" : "---" : sprintf("%d",basedamage), textpos.push([basedamage<=1 ? basedamage==1 ? "???" : "---" : sprintf("%d",basedamage),

View File

@@ -271,7 +271,7 @@ def pbItemIconFile(item)
bitmapFileName = sprintf("Graphics/Icons/item%03d",item) bitmapFileName = sprintf("Graphics/Icons/item%03d",item)
if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(item) if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(item)
move = pbGetMachine(item) move = pbGetMachine(item)
type = pbGetMoveData(move,MOVE_TYPE) type = pbGetMoveData(move,MoveData::TYPE)
bitmapFileName = sprintf("Graphics/Icons/itemMachine%s",getConstantName(PBTypes,type)) rescue nil bitmapFileName = sprintf("Graphics/Icons/itemMachine%s",getConstantName(PBTypes,type)) rescue nil
if !pbResolveBitmap(bitmapFileName) if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Icons/itemMachine%03d",type) bitmapFileName = sprintf("Graphics/Icons/itemMachine%03d",type)

View File

@@ -84,25 +84,25 @@ def pbSaveMoveData
for i in 1..(PBMoves.maxValue rescue PBMoves.getCount-1 rescue pbGetMessageCount(MessageTypes::Moves)-1) for i in 1..(PBMoves.maxValue rescue PBMoves.getCount-1 rescue pbGetMessageCount(MessageTypes::Moves)-1)
moveData = movesData[i] moveData = movesData[i]
next if !moveData # No move with that ID defined next if !moveData # No move with that ID defined
if currentType!=moveData[MOVE_TYPE] if currentType!=moveData[MoveData::TYPE]
currentType = moveData[MOVE_TYPE] currentType = moveData[MoveData::TYPE]
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
end end
f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s", f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s",
moveData[MOVE_ID], moveData[MoveData::ID],
moveData[MOVE_INTERNAL_NAME], moveData[MoveData::INTERNAL_NAME],
csvQuote(moveData[MOVE_NAME]), csvQuote(moveData[MoveData::NAME]),
csvQuote(moveData[MOVE_FUNCTION_CODE]), csvQuote(moveData[MoveData::FUNCTION_CODE]),
moveData[MOVE_BASE_DAMAGE], moveData[MoveData::BASE_DAMAGE],
(getConstantName(PBTypes,moveData[MOVE_TYPE]) rescue pbGetTypeConst(moveData[MOVE_TYPE]) rescue ""), (getConstantName(PBTypes,moveData[MoveData::TYPE]) rescue pbGetTypeConst(moveData[MoveData::TYPE]) rescue ""),
["Physical","Special","Status"][moveData[MOVE_CATEGORY]], ["Physical","Special","Status"][moveData[MoveData::CATEGORY]],
moveData[MOVE_ACCURACY], moveData[MoveData::ACCURACY],
moveData[MOVE_TOTAL_PP], moveData[MoveData::TOTAL_PP],
moveData[MOVE_EFFECT_CHANCE], moveData[MoveData::EFFECT_CHANCE],
(getConstantName(PBTargets,moveData[MOVE_TARGET]) rescue sprintf("%02X",moveData[MOVE_TARGET])), (getConstantName(PBTargets,moveData[MoveData::TARGET]) rescue sprintf("%02X",moveData[MoveData::TARGET])),
moveData[MOVE_PRIORITY], moveData[MoveData::PRIORITY],
csvQuote(moveData[MOVE_FLAGS]), csvQuote(moveData[MoveData::FLAGS]),
csvQuoteAlways(moveData[MOVE_DESCRIPTION]) csvQuoteAlways(moveData[MoveData::DESCRIPTION])
)) ))
f.write("\r\n") f.write("\r\n")
end end

View File

@@ -610,20 +610,20 @@ def pbCompileMoves
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) 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 lineRecord[6] = 2
end end
record[MOVE_ID] = lineRecord[0] record[MoveData::ID] = lineRecord[0]
record[MOVE_INTERNAL_NAME] = lineRecord[1] record[MoveData::INTERNAL_NAME] = lineRecord[1]
record[MOVE_NAME] = lineRecord[2] record[MoveData::NAME] = lineRecord[2]
record[MOVE_FUNCTION_CODE] = lineRecord[3] record[MoveData::FUNCTION_CODE] = lineRecord[3]
record[MOVE_BASE_DAMAGE] = lineRecord[4] record[MoveData::BASE_DAMAGE] = lineRecord[4]
record[MOVE_TYPE] = lineRecord[5] record[MoveData::TYPE] = lineRecord[5]
record[MOVE_CATEGORY] = lineRecord[6] record[MoveData::CATEGORY] = lineRecord[6]
record[MOVE_ACCURACY] = lineRecord[7] record[MoveData::ACCURACY] = lineRecord[7]
record[MOVE_TOTAL_PP] = lineRecord[8] record[MoveData::TOTAL_PP] = lineRecord[8]
record[MOVE_EFFECT_CHANCE] = lineRecord[9] record[MoveData::EFFECT_CHANCE] = lineRecord[9]
record[MOVE_TARGET] = lineRecord[10] record[MoveData::TARGET] = lineRecord[10]
record[MOVE_PRIORITY] = lineRecord[11] record[MoveData::PRIORITY] = lineRecord[11]
record[MOVE_FLAGS] = lineRecord[12] record[MoveData::FLAGS] = lineRecord[12]
record[MOVE_DESCRIPTION] = lineRecord[13] record[MoveData::DESCRIPTION] = lineRecord[13]
maxValue = [maxValue,lineRecord[0]].max maxValue = [maxValue,lineRecord[0]].max
count += 1 count += 1
moveNames[lineRecord[0]] = lineRecord[2] # Name moveNames[lineRecord[0]] = lineRecord[2] # Name
@@ -635,7 +635,7 @@ def pbCompileMoves
MessageTypes.setMessages(MessageTypes::MoveDescriptions,moveDescs) MessageTypes.setMessages(MessageTypes::MoveDescriptions,moveDescs)
code = "class PBMoves\r\n" code = "class PBMoves\r\n"
for rec in records for rec in records
code += "#{rec[MOVE_INTERNAL_NAME]}=#{rec[MOVE_ID]}\r\n" if rec code += "#{rec[MoveData::INTERNAL_NAME]}=#{rec[MoveData::ID]}\r\n" if rec
end end
code += "def self.getName(id)\r\n" code += "def self.getName(id)\r\n"
code += "id=getID(PBMoves,id)\r\n" code += "id=getID(PBMoves,id)\r\n"