Ability splash screen for stats changing abilities in secondary abilities

This commit is contained in:
infinitefusion
2023-05-28 14:51:32 -04:00
parent 59fea87b0d
commit b24fbf533d
20 changed files with 55 additions and 42 deletions

View File

@@ -95,7 +95,7 @@ class PokeBattle_Battler
def pbRaiseStatStageByAbility(stat,increment,user,splashAnim=true, abilityName=nil)
return false if fainted?
ret = false
@battle.pbShowAbilitySplash(user) if splashAnim
@battle.pbShowAbilitySplash(user,false,true,abilityName) #if splashAnim
if pbCanRaiseStatStage?(stat,user,nil,PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
ret = pbRaiseStatStage(stat,increment,user)
@@ -224,9 +224,9 @@ class PokeBattle_Battler
return true
end
def pbLowerStatStageByAbility(stat,increment,user,splashAnim=true,checkContact=false)
def pbLowerStatStageByAbility(stat,increment,user,splashAnim=true,checkContact=false,ability_name=nil)
ret = false
@battle.pbShowAbilitySplash(user) if splashAnim
@battle.pbShowAbilitySplash(user,false ,false ,ability_name) if splashAnim
if pbCanLowerStatStage?(stat,user,nil,PokeBattle_SceneConstants::USE_ABILITY_SPLASH) &&
(!checkContact || affectedByContactEffect?(PokeBattle_SceneConstants::USE_ABILITY_SPLASH))
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@@ -252,7 +252,7 @@ class PokeBattle_Battler
return false
end
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
return pbLowerStatStageByAbility(:ATTACK,1,user,false)
return pbLowerStatStageByAbility(:ATTACK,1,user,false,false ,user.abilityName)
end
# NOTE: These checks exist to ensure appropriate messages are shown if
# Intimidate is blocked somehow (i.e. the messages should mention the

View File

@@ -769,10 +769,10 @@ class PokeBattle_Battle
def pbShowAbilitySplash(battler,delay=false,logTrigger=true)
def pbShowAbilitySplash(battler,delay=false,logTrigger=true,abilityName=nil)
PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}") if logTrigger
return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@scene.pbShowAbilitySplash(battler)
@scene.pbShowAbilitySplash(battler,false ,abilityName)
if delay
Graphics.frame_rate.times { @scene.pbUpdate } # 1 second
end

View File

@@ -497,14 +497,14 @@ BattleHandlers::StatLossImmunityAllyAbility.add(:FLOWERVEIL,
BattleHandlers::AbilityOnStatLoss.add(:COMPETITIVE,
proc { |ability,battler,stat,user|
next if user && !user.opposes?(battler)
battler.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,2,battler)
battler.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,2,battler,GameData::Ability.get(ability).real_name)
}
)
BattleHandlers::AbilityOnStatLoss.add(:DEFIANT,
proc { |ability,battler,stat,user|
next if user && !user.opposes?(battler)
battler.pbRaiseStatStageByAbility(:ATTACK,2,battler)
battler.pbRaiseStatStageByAbility(:ATTACK,2,battler,GameData::Ability.get(ability).real_name)
}
)
@@ -555,7 +555,7 @@ BattleHandlers::PriorityBracketChangeAbility.add(:STALL,
BattleHandlers::AbilityOnFlinch.add(:STEADFAST,
proc { |ability,battler,battle|
battler.pbRaiseStatStageByAbility(:SPEED,1,battler)
battler.pbRaiseStatStageByAbility(:SPEED,1,battler,GameData::Ability.get(ability).real_name)
}
)
@@ -1441,7 +1441,7 @@ BattleHandlers::TargetAbilityOnHit.add(:FLAMEBODY,
BattleHandlers::TargetAbilityOnHit.add(:GOOEY,
proc { |ability,user,target,move,battle|
next if !move.pbContactMove?(user)
user.pbLowerStatStageByAbility(:SPEED,1,target,true,true)
user.pbLowerStatStageByAbility(:SPEED,1,target,true,true,GameData::Ability.get(ability).real_name)
}
)
@@ -1500,7 +1500,7 @@ BattleHandlers::TargetAbilityOnHit.copy(:IRONBARBS,:ROUGHSKIN)
BattleHandlers::TargetAbilityOnHit.add(:JUSTIFIED,
proc { |ability,user,target,move,battle|
next if move.calcType != :DARK
target.pbRaiseStatStageByAbility(:ATTACK,1,target)
target.pbRaiseStatStageByAbility(:ATTACK,1,target,GameData::Ability.get(ability).real_name)
}
)
@@ -1549,13 +1549,13 @@ BattleHandlers::TargetAbilityOnHit.add(:POISONPOINT,
BattleHandlers::TargetAbilityOnHit.add(:RATTLED,
proc { |ability,user,target,move,battle|
next if ![:BUG, :DARK, :GHOST].include?(move.calcType)
target.pbRaiseStatStageByAbility(:SPEED,1,target)
target.pbRaiseStatStageByAbility(:SPEED,1,target,GameData::Ability.get(ability).real_name)
}
)
BattleHandlers::TargetAbilityOnHit.add(:STAMINA,
proc { |ability,user,target,move,battle|
target.pbRaiseStatStageByAbility(:DEFENSE,1,target)
target.pbRaiseStatStageByAbility(:DEFENSE,1,target,GameData::Ability.get(ability).real_name)
}
)
@@ -1580,7 +1580,7 @@ BattleHandlers::TargetAbilityOnHit.add(:STATIC,
BattleHandlers::TargetAbilityOnHit.add(:WATERCOMPACTION,
proc { |ability,user,target,move,battle|
next if move.calcType != :WATER
target.pbRaiseStatStageByAbility(:DEFENSE,2,target)
target.pbRaiseStatStageByAbility(:DEFENSE,2,target,GameData::Ability.get(ability).real_name)
}
)
@@ -1590,9 +1590,9 @@ BattleHandlers::TargetAbilityOnHit.add(:WEAKARMOR,
next if !target.pbCanLowerStatStage?(:DEFENSE, target) &&
!target.pbCanRaiseStatStage?(:SPEED, target)
battle.pbShowAbilitySplash(target)
target.pbLowerStatStageByAbility(:DEFENSE, 1, target, false)
target.pbLowerStatStageByAbility(:DEFENSE, 1, target, false,GameData::Ability.get(ability).real_name)
target.pbRaiseStatStageByAbility(:SPEED,
(Settings::MECHANICS_GENERATION >= 7) ? 2 : 1, target, false)
(Settings::MECHANICS_GENERATION >= 7) ? 2 : 1, target, false,GameData::Ability.get(ability).real_name)
battle.pbHideAbilitySplash(target)
}
)
@@ -1639,7 +1639,7 @@ BattleHandlers::UserAbilityEndOfMove.add(:BEASTBOOST,
GameData::Stat.each_main_battle do |s|
next if userStats[s.id] < highestStatValue
if user.pbCanRaiseStatStage?(s.id, user)
user.pbRaiseStatStageByAbility(s.id, numFainted, user)
user.pbRaiseStatStageByAbility(s.id, numFainted, user,GameData::Ability.get(ability).real_name)
end
break
end
@@ -1692,7 +1692,7 @@ BattleHandlers::UserAbilityEndOfMove.add(:MOXIE,
numFainted = 0
targets.each { |b| numFainted += 1 if b.damageState.fainted }
next if numFainted==0 || !user.pbCanRaiseStatStage?(:ATTACK,user)
user.pbRaiseStatStageByAbility(:ATTACK,numFainted,user)
user.pbRaiseStatStageByAbility(:ATTACK,numFainted,user,GameData::Ability.get(ability).real_name)
}
)
@@ -1705,7 +1705,7 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:BERSERK,
next if !move.damagingMove?
next if target.damageState.initialHP<target.totalhp/2 || target.hp>=target.totalhp/2
next if !target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
target.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,1,target)
target.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,1,target,GameData::Ability.get(ability).real_name)
}
)
@@ -1947,12 +1947,12 @@ BattleHandlers::EOREffectAbility.add(:MOODY,
battle.pbShowAbilitySplash(battler)
if randomUp.length>0
r = battle.pbRandom(randomUp.length)
battler.pbRaiseStatStageByAbility(randomUp[r],2,battler,false)
battler.pbRaiseStatStageByAbility(randomUp[r],2,battler,false,GameData::Ability.get(ability).real_name)
randomDown.delete(randomUp[r])
end
if randomDown.length>0
r = battle.pbRandom(randomDown.length)
battler.pbLowerStatStageByAbility(randomDown[r],1,battler,false)
battler.pbLowerStatStageByAbility(randomDown[r],1,battler,false,GameData::Ability.get(ability).real_name)
end
battle.pbHideAbilitySplash(battler)
battler.pbItemStatRestoreCheck if randomDown.length>0
@@ -1964,7 +1964,8 @@ BattleHandlers::EOREffectAbility.add(:SPEEDBOOST,
# A Pokémon's turnCount is 0 if it became active after the beginning of a
# round
if battler.turnCount>0 && battler.pbCanRaiseStatStage?(:SPEED,battler)
battler.pbRaiseStatStageByAbility(:SPEED,1,battler)
ability_name = GameData::Ability.get(ability).real_name
battler.pbRaiseStatStageByAbility(:SPEED,1,battler,true,ability_name)
end
}
)
@@ -2141,7 +2142,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:DOWNLOAD,
oSpDef += b.spdef
end
stat = (oDef<oSpDef) ? :ATTACK : :SPECIAL_ATTACK
battler.pbRaiseStatStageByAbility(stat,1,battler)
battler.pbRaiseStatStageByAbility(stat,1,battler,GameData::Ability.get(ability).real_name)
}
)
@@ -2410,7 +2411,7 @@ BattleHandlers::AbilityChangeOnBattlerFainting.copy(:POWEROFALCHEMY,:RECEIVER)
BattleHandlers::AbilityOnBattlerFainting.add(:SOULHEART,
proc { |ability,battler,fainted,battle|
battler.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,1,battler)
battler.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,1,battler,GameData::Ability.get(ability).real_name)
}
)

View File

@@ -394,6 +394,7 @@ class AbilitySplashBar < SpriteWrapper
def initialize(side,viewport=nil, secondAbility=false)
super(viewport)
@ability_name=nil
@secondAbility=secondAbility
@side = side
@battler = nil
@@ -436,6 +437,10 @@ class AbilitySplashBar < SpriteWrapper
@bgSprite.z = value-1
end
def ability_name=(value)
@ability_name=value
end
def opacity=(value)
super
@bgSprite.opacity = value
@@ -469,6 +474,7 @@ class AbilitySplashBar < SpriteWrapper
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR,true]) if !@secondAbility
# Draw Pokémon's ability
abilityName = @secondAbility ? @battler.ability2Name : @battler.abilityName
abilityName = @ability_name if @ability_name
#return if abilityName ==""
textPos.push([abilityName,textX,26,@side==1,
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR,true])

View File

@@ -173,19 +173,19 @@ class PokeBattle_Scene
#=============================================================================
# Ability splash bar animations
#=============================================================================
def pbShowAbilitySplash(battler)
return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
side = battler.index%2
pbHideAbilitySplash(battler) if @sprites["abilityBar_#{side}"].visible
@sprites["abilityBar_#{side}"].battler = battler
abilitySplashAnim = AbilitySplashAppearAnimation.new(@sprites,@viewport,side)
loop do
abilitySplashAnim.update
pbUpdate
break if abilitySplashAnim.animDone?
end
abilitySplashAnim.dispose
end
# def pbShowAbilitySplash(battler)
# return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
# side = battler.index%2
# pbHideAbilitySplash(battler) if @sprites["abilityBar_#{side}"].visible
# @sprites["abilityBar_#{side}"].battler = battler
# abilitySplashAnim = AbilitySplashAppearAnimation.new(@sprites,@viewport,side)
# loop do
# abilitySplashAnim.update
# pbUpdate
# break if abilitySplashAnim.animDone?
# end
# abilitySplashAnim.dispose
# end

View File

@@ -58,7 +58,7 @@ module BattleHandlers
def self.triggerCertainSwitchingUserAbility(ability,switcher,battle)
ability1 = ability
ability2 = battler.ability2
ability2 = switcher.ability2
ret = CertainSwitchingUserAbility.trigger(ability1,switcher,battle) || CertainSwitchingUserAbility.trigger(ability2,switcher,battle)
return (ret!=nil) ? ret : false
@@ -66,7 +66,7 @@ module BattleHandlers
def self.triggerCertainSwitchingUserAbility(ability,switcher,battle)
ability1 = ability
ability2 = battler.ability2
ability2 = switcher.ability2
ret = CertainSwitchingUserAbility.trigger(ability1,switcher,battle) || CertainSwitchingUserAbility.trigger(ability2,switcher,battle)
return (ret!=nil) ? ret : false
@@ -74,7 +74,7 @@ module BattleHandlers
def self.triggerTrappingTargetAbility(ability,switcher,bearer,battle)
ability1 = ability
ability2 = battler.ability2
ability2 = switcher.ability2
ret = TrappingTargetAbility.trigger(ability1,switcher,bearer,battle) || TrappingTargetAbility.trigger(ability2,switcher,bearer,battle)
return (ret!=nil) ? ret : false
end

View File

@@ -44,7 +44,7 @@ class AbilitySplashDisappearAnimation < PokeBattle_Animation
end
class PokeBattle_Scene
def pbShowAbilitySplash(battler,secondAbility=false)
def pbShowAbilitySplash(battler,secondAbility=false, abilityName=nil)
return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
side = battler.index%2
if secondAbility
@@ -52,6 +52,12 @@ class PokeBattle_Scene
else
pbHideAbilitySplash(battler) if @sprites["abilityBar_#{side}"].visible
end
if abilityName
@sprites["abilityBar_#{side}"].ability_name = abilityName if !secondAbility
@sprites["ability2Bar_#{side}"].ability_name = abilityName if secondAbility
end
@sprites["abilityBar_#{side}"].battler = battler
@sprites["ability2Bar_#{side}"].battler = battler if @sprites["ability2Bar_#{side}"]

View File

@@ -2,7 +2,7 @@
EXPORT_EXCEPT_MAP_IDS= [768,722,723,724,720]
def exportAllMaps
for id in 768..784
for id in 1..798
begin
MapExporter.export(id, [:Events]) if !EXPORT_EXCEPT_MAP_IDS.include?(id)
rescue