Added "Consumable" property to items.txt, light effects now properly centre themselves on the event regardless of graphic size, Disguise/Double Iron Bash Gen 8 changes

This commit is contained in:
Maruno17
2021-07-21 22:46:49 +01:00
parent 03a7ff39ad
commit 551f64e8a1
20 changed files with 184 additions and 162 deletions

View File

@@ -186,7 +186,7 @@ class PokeBattle_Move
target.damageState.totalHPLost += damage
return
end
# Disguise takes the damage
# Disguise/Ice Face takes the damage
return if target.damageState.disguise || target.damageState.iceFace
# Target takes the damage
if damage>=target.hp
@@ -305,6 +305,7 @@ class PokeBattle_Move
end
@battle.pbHideAbilitySplash(target)
target.pbChangeForm(1,_INTL("{1}'s disguise was busted!",target.pbThis))
target.pbReduceHP(target.totalhp / 8, false) if Settings::MECHANICS_GENERATION >= 8
elsif target.damageState.iceFace
@battle.pbShowAbilitySplash(target)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH

View File

@@ -2617,9 +2617,9 @@ end
# accuracy if the target is Minimized. (Double Iron Bash)
#===============================================================================
class PokeBattle_Move_175 < PokeBattle_FlinchMove
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 2; end
def tramplesMinimize?(param=1); return true; end
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 2; end
def tramplesMinimize?(param=1); return Settings::MECHANICS_GENERATION <= 7; end
end

View File

@@ -41,8 +41,7 @@ class PokeBattle_Battle
#=============================================================================
def pbConsumeItemInBag(item,idxBattler)
return if !item
useType = GameData::Item.get(item).battle_use
return if useType==0 || (useType>=6 && useType<=10) # Not consumed upon use
return if !GameData::Item.get(item).consumed_after_use?
if pbOwnedByPlayer?(idxBattler)
if !$PokemonBag.pbDeleteItem(item)
raise _INTL("Tried to consume item that wasn't in the Bag somehow.")
@@ -60,8 +59,7 @@ class PokeBattle_Battle
def pbReturnUnusedItemToBag(item,idxBattler)
return if !item
useType = GameData::Item.get(item).battle_use
return if useType==0 || (useType>=6 && useType<=10) # Not consumed upon use
return if !GameData::Item.get(item).consumed_after_use?
if pbOwnedByPlayer?(idxBattler)
if $PokemonBag && $PokemonBag.pbCanStore?(item)
$PokemonBag.pbStoreItem(item)

View File

@@ -107,21 +107,21 @@ class PokeBattle_Battle
next false if !item
battler = pkmn = nil
case useType
when 1, 2, 6, 7 # Use on Pokémon/Pokémon's move
when 1, 2 # Use on Pokémon/Pokémon's move
next false if !ItemHandlers.hasBattleUseOnPokemon(item)
battler = pbFindBattler(idxPkmn,idxBattler)
pkmn = pbParty(idxBattler)[idxPkmn]
next false if !pbCanUseItemOnPokemon?(item,pkmn,battler,itemScene)
when 3, 8 # Use on battler
when 3 # Use on battler
next false if !ItemHandlers.hasBattleUseOnBattler(item)
battler = pbFindBattler(idxPkmn,idxBattler)
pkmn = battler.pokemon if battler
next false if !pbCanUseItemOnPokemon?(item,pkmn,battler,itemScene)
when 4, 9 # Poké Balls
when 4 # Poké Balls
next false if idxPkmn<0
battler = @battlers[idxPkmn]
pkmn = battler.pokemon if battler
when 5, 10 # No target (Poké Doll, Guard Spec., Launcher items)
when 5 # No target (Poké Doll, Guard Spec., Launcher items)
battler = @battlers[idxBattler]
pkmn = battler.pokemon if battler
else

View File

@@ -71,13 +71,13 @@ class PokeBattle_Battle
item = @choices[b.index][1]
next if !item
case GameData::Item.get(item).battle_use
when 1, 2, 6, 7 # Use on Pokémon/Pokémon's move
when 1, 2 # Use on Pokémon/Pokémon's move
pbUseItemOnPokemon(item, @choices[b.index][2], b) if @choices[b.index][2] >= 0
when 3, 8 # Use on battler
when 3 # Use on battler
pbUseItemOnBattler(item, @choices[b.index][2], b)
when 4, 9 # Use Poké Ball
when 4 # Use Poké Ball
pbUsePokeBallInBattle(item, @choices[b.index][2], b)
when 5, 10 # Use directly
when 5 # Use directly
pbUseItemInBattle(item, @choices[b.index][2], b)
else
next

View File

@@ -8,7 +8,7 @@ class PokeBattle_AI
return false if !item
# Determine target of item (always the Pokémon choosing the action)
useType = GameData::Item.get(item).battle_use
if [1, 2, 3, 6, 7, 8].include?(useType) # Use on Pokémon
if [1, 2, 3].include?(useType) # Use on Pokémon
idxTarget = @battle.battlers[idxTarget].pokemonIndex # Party Pokémon
end
# Register use of item

View File

@@ -221,26 +221,21 @@ class PokeBattle_Scene
next unless cmdUse>=0 && command==cmdUse # Use
# Use types:
# 0 = not usable in battle
# 1 = use on Pokémon (lots of items), consumed
# 2 = use on Pokémon's move (Ethers), consumed
# 3 = use on battler (X items, Persim Berry), consumed
# 4 = use on opposing battler (Poké Balls), consumed
# 5 = use no target (Poké Doll, Guard Spec., Launcher items), consumed
# 6 = use on Pokémon (Blue Flute), not consumed
# 7 = use on Pokémon's move, not consumed
# 8 = use on battler (Red/Yellow Flutes), not consumed
# 9 = use on opposing battler, not consumed
# 10 = use no target (Poké Flute), not consumed
# 1 = use on Pokémon (lots of items, Blue Flute)
# 2 = use on Pokémon's move (Ethers)
# 3 = use on battler (X items, Persim Berry, Red/Yellow Flutes)
# 4 = use on opposing battler (Poké Balls)
# 5 = use no target (Poké Doll, Guard Spec., Poké Flute, Launcher items)
case useType
when 1, 2, 3, 6, 7, 8 # Use on Pokémon/Pokémon's move/battler
when 1, 2, 3 # Use on Pokémon/Pokémon's move/battler
# Auto-choose the Pokémon/battler whose action is being decided if they
# are the only available Pokémon/battler to use the item on
case useType
when 1, 6 # Use on Pokémon
when 1 # Use on Pokémon
if @battle.pbTeamLengthFromBattlerIndex(idxBattler)==1
break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene
end
when 3, 8 # Use on battler
when 3 # Use on battler
if @battle.pbPlayerBattlerCount==1
break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene
end
@@ -273,7 +268,7 @@ class PokeBattle_Scene
pkmn = party[idxPartyRet]
next if !pkmn || pkmn.egg?
idxMove = -1
if useType==2 || useType==7 # Use on Pokémon's move
if useType==2 # Use on Pokémon's move
idxMove = pkmnScreen.pbChooseMove(pkmn,_INTL("Restore which move?"))
next if idxMove<0
end
@@ -283,7 +278,7 @@ class PokeBattle_Scene
break if idxParty>=0
# Cancelled choosing a Pokémon; show the Bag screen again
itemScene.pbFadeInScene
when 4, 9 # Use on opposing battler (Poké Balls)
when 4 # Use on opposing battler (Poké Balls)
idxTarget = -1
if @battle.pbOpposingBattlerCount(idxBattler)==1
@battle.eachOtherSideBattler(idxBattler) { |b| idxTarget = b.index }
@@ -305,7 +300,7 @@ class PokeBattle_Scene
pbFadeOutAndHide(@sprites)
itemScene.pbFadeInScene
end
when 5, 10 # Use with no target
when 5 # Use with no target
break if yield item.id, useType, idxBattler, -1, itemScene
end
end