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

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

View File

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

View File

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

View File

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