mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Fixed X items not being used properly (again)
This commit is contained in:
@@ -3,7 +3,7 @@ class PokeBattle_Battle
|
|||||||
# Choosing to use an item
|
# Choosing to use an item
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages=true)
|
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages=true)
|
||||||
if pkmn.egg?
|
if !pkmn || pkmn.egg?
|
||||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -101,18 +101,22 @@ class PokeBattle_Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Uses an item on a Pokémon in battle that belongs to the trainer.
|
# Uses an item on a Pokémon in battle that belongs to the trainer.
|
||||||
def pbUseItemOnBattler(item,idxBattler,userBattler)
|
def pbUseItemOnBattler(item,idxParty,userBattler)
|
||||||
trainerName = pbGetOwnerName(userBattler.index)
|
trainerName = pbGetOwnerName(userBattler.index)
|
||||||
pbUseItemMessage(item,trainerName)
|
pbUseItemMessage(item,trainerName)
|
||||||
idxBattler = userBattler.index if idxBattler<0
|
battler = pbFindBattler(idxParty,userBattler.index)
|
||||||
battler = @battlers[idxBattler]
|
|
||||||
ch = @choices[userBattler.index]
|
ch = @choices[userBattler.index]
|
||||||
if ItemHandlers.triggerCanUseInBattle(item,battler.pokemon,battler,ch[3],true,self,@scene,false)
|
if battler
|
||||||
ItemHandlers.triggerBattleUseOnBattler(item,battler,@scene)
|
if ItemHandlers.triggerCanUseInBattle(item,battler.pokemon,battler,ch[3],true,self,@scene,false)
|
||||||
ch[1] = 0 # Delete item from choice
|
ItemHandlers.triggerBattleUseOnBattler(item,battler,@scene)
|
||||||
return
|
ch[1] = 0 # Delete item from choice
|
||||||
|
return
|
||||||
|
else
|
||||||
|
pbDisplay(_INTL("But it had no effect!"))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
pbDisplay(_INTL("But it's not where this item can be used!"))
|
||||||
end
|
end
|
||||||
pbDisplay(_INTL("But it's not where this item can be used!"))
|
|
||||||
# Return unused item to Bag
|
# Return unused item to Bag
|
||||||
pbReturnUnusedItemToBag(item,userBattler.index)
|
pbReturnUnusedItemToBag(item,userBattler.index)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class PokeBattle_AI
|
|||||||
return false if item==0
|
return false if item==0
|
||||||
# Determine target of item (always the Pokémon choosing the action)
|
# Determine target of item (always the Pokémon choosing the action)
|
||||||
useType = pbGetItemData(item,ITEM_BATTLE_USE)
|
useType = pbGetItemData(item,ITEM_BATTLE_USE)
|
||||||
if useType && (useType==1 || useType==6) # Use on Pokémon
|
if useType && [1, 2, 3, 6, 7, 8].include?(useType) # Use on Pokémon
|
||||||
idxTarget = @battle.battlers[idxTarget].pokemonIndex # Party Pokémon
|
idxTarget = @battle.battlers[idxTarget].pokemonIndex # Party Pokémon
|
||||||
end
|
end
|
||||||
# Register use of item
|
# Register use of item
|
||||||
|
|||||||
Reference in New Issue
Block a user