Moved item data constants into module ItemData

This commit is contained in:
Maruno17
2020-10-17 00:56:30 +01:00
parent 2b4f1e1aba
commit 7e627453da
10 changed files with 104 additions and 95 deletions

View File

@@ -41,7 +41,7 @@ class PokeBattle_Battle
#=============================================================================
def pbConsumeItemInBag(item,idxBattler)
return if item==0
useType = pbGetItemData(item,ITEM_BATTLE_USE)
useType = pbGetItemData(item,ItemData::BATTLE_USE)
return if !useType || useType==0 || (useType>=6 && useType<=10) # Not consumed upon use
if pbOwnedByPlayer?(idxBattler)
if !$PokemonBag.pbDeleteItem(item)
@@ -60,7 +60,7 @@ class PokeBattle_Battle
def pbReturnUnusedItemToBag(item,idxBattler)
return if item==0
useType = pbGetItemData(item,ITEM_BATTLE_USE)
useType = pbGetItemData(item,ItemData::BATTLE_USE)
return if !useType || useType==0 || (useType>=6 && useType<=10) # Not consumed upon use
if pbOwnedByPlayer?(idxBattler)
if $PokemonBag && $PokemonBag.pbCanStore?(item)

View File

@@ -70,7 +70,7 @@ class PokeBattle_Battle
b.lastMoveFailed = false # Counts as a successful move for Stomping Tantrum
item = @choices[b.index][1]
next if !item || item<=0
useType = pbGetItemData(item,ITEM_BATTLE_USE)
useType = pbGetItemData(item,ItemData::BATTLE_USE)
next if !useType
case useType
when 1, 2, 6, 7 # Use on Pokémon/Pokémon's move

View File

@@ -7,7 +7,7 @@ class PokeBattle_AI
item, idxTarget = pbEnemyItemToUse(idxBattler)
return false if item==0
# Determine target of item (always the Pokémon choosing the action)
useType = pbGetItemData(item,ITEM_BATTLE_USE)
useType = pbGetItemData(item,ItemData::BATTLE_USE)
if useType && (useType==1 || useType==6) # Use on Pokémon
idxTarget = @battle.battlers[idxTarget].pokemonIndex # Party Pokémon
end

View File

@@ -200,7 +200,7 @@ class PokeBattle_Scene
# Start Bag screen
itemScene = PokemonBag_Scene.new
itemScene.pbStartScene($PokemonBag,true,Proc.new { |item|
useType = pbGetItemData(item,ITEM_BATTLE_USE)
useType = pbGetItemData(item,ItemData::BATTLE_USE)
next useType && useType>0
},false)
# Loop while in Bag screen
@@ -211,7 +211,7 @@ class PokeBattle_Scene
break if item==0
# Choose a command for the selected item
itemName = PBItems.getName(item)
useType = pbGetItemData(item,ITEM_BATTLE_USE)
useType = pbGetItemData(item,ItemData::BATTLE_USE)
cmdUse = -1
commands = []
commands[cmdUse = commands.length] = _INTL("Use") if useType && useType!=0