From c30e302ccf4fc1c487ca33424c96038ef3e31d33 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sat, 17 Oct 2020 00:29:58 +0100 Subject: [PATCH] Moved move data constants into module MoveData --- Data/Scripts/011_Data/003_PBMove.rb | 56 ++++++++++--------- .../001_Battler/001_PokeBattle_Battler.rb | 2 +- .../002_Move/001_PokeBattle_Move.rb | 20 +++---- .../002_Move/005_Move_Effects_000-07F.rb | 10 ++-- .../002_Move/006_Move_Effects_080-0FF.rb | 12 ++-- .../002_Move/007_Move_Effects_100-17F.rb | 2 +- .../012_Battle/004_AI/003_AI_Switch.rb | 10 ++-- .../004_AI/005_AI_Move_EffectScores.rb | 38 ++++++------- .../005_Battle scene/009_Scene_Animations.rb | 12 ++-- .../007_BattleHandlers_Abilities.rb | 16 +++--- Data/Scripts/017_UI/006_PScreen_Summary.rb | 6 +- .../017_UI/023_PScreen_MoveRelearner.rb | 12 ++-- .../003_PSystem_FileUtilities.rb | 2 +- Data/Scripts/021_Debug/005_Editor_SaveData.rb | 32 +++++------ Data/Scripts/022_Compiler/002_Compiler_PBS.rb | 30 +++++----- 15 files changed, 131 insertions(+), 129 deletions(-) diff --git a/Data/Scripts/011_Data/003_PBMove.rb b/Data/Scripts/011_Data/003_PBMove.rb index ba026c502..8363bb0d9 100644 --- a/Data/Scripts/011_Data/003_PBMove.rb +++ b/Data/Scripts/011_Data/003_PBMove.rb @@ -1,17 +1,19 @@ -MOVE_ID = 0 -MOVE_INTERNAL_NAME = 1 -MOVE_NAME = 2 -MOVE_FUNCTION_CODE = 3 -MOVE_BASE_DAMAGE = 4 -MOVE_TYPE = 5 -MOVE_CATEGORY = 6 -MOVE_ACCURACY = 7 -MOVE_TOTAL_PP = 8 -MOVE_EFFECT_CHANCE = 9 -MOVE_TARGET = 10 -MOVE_PRIORITY = 11 -MOVE_FLAGS = 12 -MOVE_DESCRIPTION = 13 +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 @@ -55,7 +57,7 @@ class PBMove # Initializes this object to the specified move ID. def initialize(move_id) @id = move_id - @pp = pbGetMoveData(move_id, MOVE_TOTAL_PP) || 0 + @pp = pbGetMoveData(move_id, MoveData::TOTAL_PP) || 0 @ppup = 0 end @@ -69,12 +71,12 @@ class PBMove # Gets this move's type. def type - return pbGetMoveData(@id, MOVE_TYPE) || 0 + return pbGetMoveData(@id, MoveData::TYPE) || 0 end # Gets the maximum PP for this move. 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 end end @@ -88,15 +90,15 @@ class PBMoveData def initialize(move_id) move_data = pbGetMoveData(move_id) - @function = move_data[MOVE_FUNCTION_CODE] - @basedamage = move_data[MOVE_BASE_DAMAGE] - @type = move_data[MOVE_TYPE] - @category = move_data[MOVE_CATEGORY] - @accuracy = move_data[MOVE_ACCURACY] - @totalpp = move_data[MOVE_TOTAL_PP] - @addlEffect = move_data[MOVE_EFFECT_CHANCE] - @target = move_data[MOVE_TARGET] - @priority = move_data[MOVE_PRIORITY] - @flags = move_data[MOVE_FLAGS] + @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 diff --git a/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb b/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb index 00bbbda2b..0e506f3a0 100644 --- a/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -583,7 +583,7 @@ class PokeBattle_Battler def inTwoTurnAttack?(*arg) 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 } return false end diff --git a/Data/Scripts/012_Battle/002_Move/001_PokeBattle_Move.rb b/Data/Scripts/012_Battle/002_Move/001_PokeBattle_Move.rb index 67a32b21b..6b12bf9a3 100644 --- a/Data/Scripts/012_Battle/002_Move/001_PokeBattle_Move.rb +++ b/Data/Scripts/012_Battle/002_Move/001_PokeBattle_Move.rb @@ -30,16 +30,16 @@ class PokeBattle_Move @name = PBMoves.getName(@id) # Get the move's name # Get data on the move moveData = pbGetMoveData(@id) - @function = moveData[MOVE_FUNCTION_CODE] - @baseDamage = moveData[MOVE_BASE_DAMAGE] - @type = moveData[MOVE_TYPE] - @category = moveData[MOVE_CATEGORY] - @accuracy = moveData[MOVE_ACCURACY] + @function = moveData[MoveData::FUNCTION_CODE] + @baseDamage = moveData[MoveData::BASE_DAMAGE] + @type = moveData[MoveData::TYPE] + @category = moveData[MoveData::CATEGORY] + @accuracy = moveData[MoveData::ACCURACY] @pp = move.pp # Can be changed with Mimic/Transform - @addlEffect = moveData[MOVE_EFFECT_CHANCE] - @target = moveData[MOVE_TARGET] - @priority = moveData[MOVE_PRIORITY] - @flags = moveData[MOVE_FLAGS] + @addlEffect = moveData[MoveData::EFFECT_CHANCE] + @target = moveData[MoveData::TARGET] + @priority = moveData[MoveData::PRIORITY] + @flags = moveData[MoveData::FLAGS] @calcType = -1 @powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize @snatched = false @@ -50,7 +50,7 @@ class PokeBattle_Move # 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,MOVE_FUNCTION_CODE) || "000" + moveFunction = pbGetMoveData(move.id,MoveData::FUNCTION_CODE) || "000" className = sprintf("PokeBattle_Move_%s",moveFunction) if Object.const_defined?(className) return Object.const_get(className).new(battle,move) diff --git a/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb b/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb index 629551f20..beb2c6ecf 100644 --- a/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb +++ b/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb @@ -1708,8 +1708,8 @@ class PokeBattle_Move_05C < PokeBattle_Move lastMoveData = pbGetMoveData(target.lastRegularMoveUsed) if target.lastRegularMoveUsed<=0 || user.pbHasMove?(target.lastRegularMoveUsed) || - @moveBlacklist.include?(lastMoveData[MOVE_FUNCTION_CODE]) || - isConst?(lastMoveData[MOVE_TYPE],PBTypes,:SHADOW) + @moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) || + isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -1759,8 +1759,8 @@ class PokeBattle_Move_05D < PokeBattle_Move lastMoveData = pbGetMoveData(target.lastRegularMoveUsed) if target.lastRegularMoveUsed<=0 || user.pbHasMove?(target.lastRegularMoveUsed) || - @moveBlacklist.include?(lastMoveData[MOVE_FUNCTION_CODE]) || - isConst?(lastMoveData[MOVE_TYPE],PBTypes,:SHADOW) + @moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) || + isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -1837,7 +1837,7 @@ class PokeBattle_Move_05F < PokeBattle_Move def pbFailsAgainstTarget?(user,target) if target.lastMoveUsed<=0 || target.lastMoveUsedType<0 || - PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MOVE_TYPE)) + PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MoveData::TYPE)) @battle.pbDisplay(_INTL("But it failed!")) return true end diff --git a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb index b362b482d..4f849d127 100644 --- a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb +++ b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb @@ -1125,7 +1125,7 @@ class PokeBattle_Move_0AE < PokeBattle_Move def pbFailsAgainstTarget?(user,target) 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!")) return true end @@ -1216,7 +1216,7 @@ class PokeBattle_Move_0AF < PokeBattle_Move def pbMoveFailed?(user,targets) 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!")) return true end @@ -1560,7 +1560,7 @@ class PokeBattle_Move_0B5 < PokeBattle_Move 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,MOVE_FUNCTION_CODE)) + next if @moveBlacklist.include?(pbGetMoveData(move.id,MoveData::FUNCTION_CODE)) next if isConst?(move.type,PBTypes,:SHADOW) @assistMoves.push(move.id) end @@ -1678,14 +1678,14 @@ class PokeBattle_Move_0B6 < PokeBattle_Move 1000.times do move = @battle.pbRandom(PBMoves.maxValue)+1 # Random 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 @moveBlacklistSignatures.each do |m| next if !isConst?(move,PBMoves,m) blMove = true; break end next if blMove - next if isConst?(movesData[move][MOVE_TYPE],PBTypes,:SHADOW) + next if isConst?(movesData[move][MoveData::TYPE],PBTypes,:SHADOW) @metronomeMove = move break end @@ -1881,7 +1881,7 @@ class PokeBattle_Move_0BC < PokeBattle_Move return true end 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!")) return true end diff --git a/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb b/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb index e8fbadf2e..836c8b636 100644 --- a/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb +++ b/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb @@ -2342,7 +2342,7 @@ class PokeBattle_Move_16B < PokeBattle_Move @battle.pbDisplay(_INTL("But it failed!")) return true 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!")) return true end diff --git a/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb b/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb index 197a27201..427a103af 100644 --- a/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb +++ b/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb @@ -20,10 +20,10 @@ class PokeBattle_AI if !target.fainted? && target.lastMoveUsed>0 && (target.level-battler.level).abs<=6 moveData = pbGetMoveData(target.lastMoveUsed) - moveType = moveData[MOVE_TYPE] + moveType = moveData[MoveData::TYPE] typeMod = pbCalcTypeMod(moveType,target,battler) - if PBTypes.superEffective?(typeMod) && moveData[MOVE_BASE_DAMAGE]>50 - switchChance = (moveData[MOVE_BASE_DAMAGE]>70) ? 30 : 20 + if PBTypes.superEffective?(typeMod) && moveData[MoveData::BASE_DAMAGE]>50 + switchChance = (moveData[MoveData::BASE_DAMAGE]>70) ? 30 : 20 shouldSwitch = (pbAIRandom(100)=PBTrainerAI.mediumSkill && target.lastMoveUsed>0 moveData = pbGetMoveData(target.lastMoveUsed) - if moveData[MOVE_BASE_DAMAGE]>0 && - (MOVE_CATEGORY_PER_MOVE && moveData[MOVE_CATEGORY]==0) || - (!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData[MOVE_TYPE])) + if moveData[MoveData::BASE_DAMAGE]>0 && + (MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==0) || + (!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData[MoveData::TYPE])) score -= 60 end end @@ -1569,9 +1569,9 @@ class PokeBattle_AI score -= 60 elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0 moveData = pbGetMoveData(target.lastMoveUsed) - if moveData[MOVE_BASE_DAMAGE]>0 && - (MOVE_CATEGORY_PER_MOVE && moveData[MOVE_CATEGORY]==1) || - (!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData[MOVE_TYPE])) + if moveData[MoveData::BASE_DAMAGE]>0 && + (MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==1) || + (!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData[MoveData::TYPE])) score -= 60 end end @@ -1764,7 +1764,7 @@ class PokeBattle_AI score -= 40 if skill>=PBTrainerAI.highSkill 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 #--------------------------------------------------------------------------- when "0AF" @@ -1813,13 +1813,13 @@ class PokeBattle_AI score -= 90 else moveData = pbGetMoveData(target.lastRegularMoveUsed) - if moveData[MOVE_CATEGORY]==2 && # Status move - (moveData[MOVE_TARGET]==PBTargets::User || - moveData[MOVE_TARGET]==PBTargets::BothSides) + if moveData[MoveData::CATEGORY]==2 && # Status move + (moveData[MoveData::TARGET]==PBTargets::User || + moveData[MoveData::TARGET]==PBTargets::BothSides) score += 60 - elsif moveData[MOVE_CATEGORY]!=2 && # Damaging move - moveData[MOVE_TARGET]==PBTargets::NearOther && - PBTypes.ineffective?(pbCalcTypeMod(moveData[MOVE_TYPE],target,user)) + elsif moveData[MoveData::CATEGORY]!=2 && # Damaging move + moveData[MoveData::TARGET]==PBTargets::NearOther && + PBTypes.ineffective?(pbCalcTypeMod(moveData[MoveData::TYPE],target,user)) score += 60 end end @@ -2096,7 +2096,7 @@ class PokeBattle_AI :CHOICEBAND,:CHOICESCARF,:CHOICESPECS]) score += 50 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 #--------------------------------------------------------------------------- when "0F3" diff --git a/Data/Scripts/012_Battle/005_Battle scene/009_Scene_Animations.rb b/Data/Scripts/012_Battle/005_Battle scene/009_Scene_Animations.rb index 35309f73b..c625b6219 100644 --- a/Data/Scripts/012_Battle/005_Battle scene/009_Scene_Animations.rb +++ b/Data/Scripts/012_Battle/005_Battle scene/009_Scene_Animations.rb @@ -408,12 +408,12 @@ class PokeBattle_Scene return anim if anim # Actual animation not found, get the default animation for the move's type moveData = pbGetMoveData(moveID) - moveType = moveData[MOVE_TYPE] - moveKind = moveData[MOVE_CATEGORY] - moveKind += 3 if PBTargets.multipleTargets?(moveData[MOVE_TARGET]) || - PBTargets.targetsFoeSide?(moveData[MOVE_TARGET]) - moveKind += 3 if moveKind==2 && moveData[MOVE_TARGET]!=PBTargets::User && - moveData[MOVE_TARGET]!=PBTargets::UserSide + 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 # [one target physical, one target special, user status, # multiple targets physical, multiple targets special, non-user status] typeDefaultAnim = { diff --git a/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb b/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb index 6f685224d..3076e206a 100644 --- a/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb +++ b/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb @@ -2099,15 +2099,15 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION, next if m.statusMove? moveData = pbGetMoveData(m.id) if type1 - moveType = moveData[MOVE_TYPE] + moveType = moveData[MoveData::TYPE] if NEWEST_BATTLE_MECHANICS && isConst?(m.id,PBMoves,:HIDDENPOWER) moveType = pbHiddenPower(b.pokemon)[0] end eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3) 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 - next if moveData[MOVE_FUNCTION_CODE]!="070" # OHKO + next if moveData[MoveData::FUNCTION_CODE]!="070" # OHKO end found = true break @@ -2207,17 +2207,17 @@ BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN, battle.eachOtherSideBattler(battler.index) do |b| b.eachMove do |m| moveData = pbGetMoveData(m.id) - power = moveData[MOVE_BASE_DAMAGE] - power = 160 if ["070"].include?(moveData[MOVE_FUNCTION_CODE]) # OHKO - power = 150 if ["08B"].include?(moveData[MOVE_FUNCTION_CODE]) # Eruption + 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 # 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, # 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[MOVE_FUNCTION_CODE]) + "096","097","098","09A"].include?(moveData[MoveData::FUNCTION_CODE]) next if powerhighestPower forewarnMoves.push(m.id) diff --git a/Data/Scripts/017_UI/006_PScreen_Summary.rb b/Data/Scripts/017_UI/006_PScreen_Summary.rb index 463e1f085..e68313d2f 100644 --- a/Data/Scripts/017_UI/006_PScreen_Summary.rb +++ b/Data/Scripts/017_UI/006_PScreen_Summary.rb @@ -714,9 +714,9 @@ class PokemonSummary_Scene @sprites["itemicon"].visible = false if @sprites["itemicon"] # Get data for selected move moveData = pbGetMoveData(moveid) - basedamage = moveData[MOVE_BASE_DAMAGE] - category = moveData[MOVE_CATEGORY] - accuracy = moveData[MOVE_ACCURACY] + 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 diff --git a/Data/Scripts/017_UI/023_PScreen_MoveRelearner.rb b/Data/Scripts/017_UI/023_PScreen_MoveRelearner.rb index 051b1eb5e..8270d0f31 100644 --- a/Data/Scripts/017_UI/023_PScreen_MoveRelearner.rb +++ b/Data/Scripts/017_UI/023_PScreen_MoveRelearner.rb @@ -103,14 +103,14 @@ class MoveRelearner_Scene moveData=movesData[moveobject] if moveData 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, 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, Color.new(64,64,64),Color.new(176,176,176)]) 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)]) end else @@ -124,9 +124,9 @@ class MoveRelearner_Scene 0,78+(@sprites["commands"].index-@sprites["commands"].top_item)*64, 0,0,258,72]) selMoveData=movesData[@moves[@sprites["commands"].index]] - basedamage=selMoveData[MOVE_BASE_DAMAGE] - category=selMoveData[MOVE_CATEGORY] - accuracy=selMoveData[MOVE_ACCURACY] + basedamage=selMoveData[MoveData::BASE_DAMAGE] + category=selMoveData[MoveData::CATEGORY] + accuracy=selMoveData[MoveData::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), diff --git a/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb b/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb index 3e8291b1d..dfba87ae4 100644 --- a/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb +++ b/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb @@ -271,7 +271,7 @@ def pbItemIconFile(item) bitmapFileName = sprintf("Graphics/Icons/item%03d",item) if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(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 if !pbResolveBitmap(bitmapFileName) bitmapFileName = sprintf("Graphics/Icons/itemMachine%03d",type) diff --git a/Data/Scripts/021_Debug/005_Editor_SaveData.rb b/Data/Scripts/021_Debug/005_Editor_SaveData.rb index b52f3d9d4..d2a2e72eb 100644 --- a/Data/Scripts/021_Debug/005_Editor_SaveData.rb +++ b/Data/Scripts/021_Debug/005_Editor_SaveData.rb @@ -84,25 +84,25 @@ def pbSaveMoveData 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[MOVE_TYPE] - currentType = moveData[MOVE_TYPE] + if currentType!=moveData[MoveData::TYPE] + currentType = moveData[MoveData::TYPE] f.write("\#-------------------------------\r\n") end f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s", - moveData[MOVE_ID], - moveData[MOVE_INTERNAL_NAME], - csvQuote(moveData[MOVE_NAME]), - csvQuote(moveData[MOVE_FUNCTION_CODE]), - moveData[MOVE_BASE_DAMAGE], - (getConstantName(PBTypes,moveData[MOVE_TYPE]) rescue pbGetTypeConst(moveData[MOVE_TYPE]) rescue ""), - ["Physical","Special","Status"][moveData[MOVE_CATEGORY]], - moveData[MOVE_ACCURACY], - moveData[MOVE_TOTAL_PP], - moveData[MOVE_EFFECT_CHANCE], - (getConstantName(PBTargets,moveData[MOVE_TARGET]) rescue sprintf("%02X",moveData[MOVE_TARGET])), - moveData[MOVE_PRIORITY], - csvQuote(moveData[MOVE_FLAGS]), - csvQuoteAlways(moveData[MOVE_DESCRIPTION]) + 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("\r\n") end diff --git a/Data/Scripts/022_Compiler/002_Compiler_PBS.rb b/Data/Scripts/022_Compiler/002_Compiler_PBS.rb index 3f7a6e268..2f7ded83f 100644 --- a/Data/Scripts/022_Compiler/002_Compiler_PBS.rb +++ b/Data/Scripts/022_Compiler/002_Compiler_PBS.rb @@ -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) lineRecord[6] = 2 end - record[MOVE_ID] = lineRecord[0] - record[MOVE_INTERNAL_NAME] = lineRecord[1] - record[MOVE_NAME] = lineRecord[2] - record[MOVE_FUNCTION_CODE] = lineRecord[3] - record[MOVE_BASE_DAMAGE] = lineRecord[4] - record[MOVE_TYPE] = lineRecord[5] - record[MOVE_CATEGORY] = lineRecord[6] - record[MOVE_ACCURACY] = lineRecord[7] - record[MOVE_TOTAL_PP] = lineRecord[8] - record[MOVE_EFFECT_CHANCE] = lineRecord[9] - record[MOVE_TARGET] = lineRecord[10] - record[MOVE_PRIORITY] = lineRecord[11] - record[MOVE_FLAGS] = lineRecord[12] - record[MOVE_DESCRIPTION] = lineRecord[13] + 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 @@ -635,7 +635,7 @@ def pbCompileMoves MessageTypes.setMessages(MessageTypes::MoveDescriptions,moveDescs) code = "class PBMoves\r\n" 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 code += "def self.getName(id)\r\n" code += "id=getID(PBMoves,id)\r\n"