Double abilities

This commit is contained in:
infinitefusion
2023-05-22 13:16:41 -04:00
parent db774ec5c0
commit 82149eddb9
14 changed files with 333 additions and 225 deletions

Binary file not shown.

View File

@@ -325,6 +325,16 @@ module GameData
end end
pkmn.ability_index = pkmn_data[:ability_index] pkmn.ability_index = pkmn_data[:ability_index]
pkmn.ability = pkmn_data[:ability] pkmn.ability = pkmn_data[:ability]
if $game_switches[SWITCH_DOUBLE_ABILITIES] && pkmn.isFusion?
secondary_ability_index = pkmn.ability_index == 0 ? 1 : 0
pkmn.ability2_index = secondary_ability_index
pkmn.ability2 = pkmn.getAbilityList[secondary_ability_index][0]
print _INTL("Primary: {1}, Secondary: {2}",pkmn.ability.id, pkmn.ability2.id)
end
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1) pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
pkmn.shiny = (pkmn_data[:shininess]) ? true : false pkmn.shiny = (pkmn_data[:shininess]) ? true : false
if pkmn_data[:nature] if pkmn_data[:nature]

View File

@@ -22,6 +22,7 @@ class PokeBattle_Battler
@hp = @totalhp = 0 @hp = @totalhp = 0
@type1 = @type2 = nil @type1 = @type2 = nil
@ability_id = nil @ability_id = nil
@ability2_id = nil
@item_id = nil @item_id = nil
@gender = 0 @gender = 0
@attack = @defense = @spatk = @spdef = @speed = 0 @attack = @defense = @spatk = @spdef = @speed = 0
@@ -81,6 +82,7 @@ class PokeBattle_Battler
@type1 = pkmn.type1 @type1 = pkmn.type1
@type2 = pkmn.type2 @type2 = pkmn.type2
@ability_id = pkmn.ability_id @ability_id = pkmn.ability_id
@ability2_id = pkmn.ability2_id
@item_id = pkmn.item_id @item_id = pkmn.item_id
@gender = pkmn.gender @gender = pkmn.gender
@attack = pkmn.attack @attack = pkmn.attack

View File

@@ -283,6 +283,7 @@ class PokeBattle_Battler
@effects[PBEffects::TransformSpecies] = target.species @effects[PBEffects::TransformSpecies] = target.species
pbChangeTypes(target) pbChangeTypes(target)
self.ability = target.ability self.ability = target.ability
self.ability2 = target.ability2 if target.ability2
@attack = target.attack @attack = target.attack
@defense = target.defense @defense = target.defense
@spatk = target.spatk @spatk = target.spatk

View File

@@ -2,8 +2,9 @@ class PokeBattle_Battler
#============================================================================= #=============================================================================
# Effect per hit # Effect per hit
#============================================================================= #=============================================================================
def pbEffectsOnMakingHit(move,user,target) #
if target.damageState.calcDamage>0 && !target.damageState.substitute
def triggerAbilityEffectsOnHit(move,user,target)
# Target's ability # Target's ability
if target.abilityActive?(true) if target.abilityActive?(true)
oldHP = user.hp oldHP = user.hp
@@ -15,6 +16,11 @@ class PokeBattle_Battler
BattleHandlers.triggerUserAbilityOnHit(user.ability,user,target,move,@battle) BattleHandlers.triggerUserAbilityOnHit(user.ability,user,target,move,@battle)
user.pbItemHPHealCheck user.pbItemHPHealCheck
end end
end
def pbEffectsOnMakingHit(move,user,target)
if target.damageState.calcDamage>0 && !target.damageState.substitute
triggerAbilityEffectsOnHit(move,user,target)
# Target's item # Target's item
if target.itemActive?(true) if target.itemActive?(true)
oldHP = user.hp oldHP = user.hp
@@ -92,6 +98,7 @@ class PokeBattle_Battler
# User's ability # User's ability
if user.abilityActive? if user.abilityActive?
BattleHandlers.triggerUserAbilityEndOfMove(user.ability,user,targets,move,@battle) BattleHandlers.triggerUserAbilityEndOfMove(user.ability,user,targets,move,@battle)
BattleHandlers.triggerUserAbilityEndOfMove(user.ability2,user,targets,move,@battle) if user.ability2
end end
# Greninja - Battle Bond # Greninja - Battle Bond
if !user.fainted? && !user.effects[PBEffects::Transform] && if !user.fainted? && !user.effects[PBEffects::Transform] &&
@@ -161,6 +168,7 @@ class PokeBattle_Battler
next if b.damageState.unaffected || switchedBattlers.include?(b.index) next if b.damageState.unaffected || switchedBattlers.include?(b.index)
next if !b.abilityActive? next if !b.abilityActive?
BattleHandlers.triggerTargetAbilityAfterMoveUse(b.ability,b,user,move,switchedBattlers,@battle) BattleHandlers.triggerTargetAbilityAfterMoveUse(b.ability,b,user,move,switchedBattlers,@battle)
BattleHandlers.triggerTargetAbilityAfterMoveUse(b.ability2,b,user,move,switchedBattlers,@battle) if b.ability2
if !switchedBattlers.include?(b.index) && move.damagingMove? if !switchedBattlers.include?(b.index) && move.damagingMove?
if b.pbAbilitiesOnDamageTaken(b.damageState.initialHP) # Emergency Exit, Wimp Out if b.pbAbilitiesOnDamageTaken(b.damageState.initialHP) # Emergency Exit, Wimp Out
switchWimpOut.push(b.index) switchWimpOut.push(b.index)

View File

@@ -767,6 +767,8 @@ class PokeBattle_Battle
@scene.pbCommonAnimation(name,user,targets) if @showAnims @scene.pbCommonAnimation(name,user,targets) if @showAnims
end end
def pbShowAbilitySplash(battler,delay=false,logTrigger=true) def pbShowAbilitySplash(battler,delay=false,logTrigger=true)
PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}") if logTrigger PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}") if logTrigger
return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH

View File

@@ -25,7 +25,6 @@ class PokemonDataBox < SpriteWrapper
FEMALE_BASE_COLOR = Color.new(248, 88, 40) FEMALE_BASE_COLOR = Color.new(248, 88, 40)
FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR
def initialize(battler, sideSize, viewport = nil) def initialize(battler, sideSize, viewport = nil)
super(viewport) super(viewport)
@battler = battler @battler = battler
@@ -55,7 +54,8 @@ class PokemonDataBox < SpriteWrapper
@showHP = true @showHP = true
@showExp = true @showExp = true
end end
else # Multiple Pokémon on side, use the thin dara box BG else
# Multiple Pokémon on side, use the thin dara box BG
bgFilename = ["Graphics/Pictures/Battle/databox_thin", bgFilename = ["Graphics/Pictures/Battle/databox_thin",
"Graphics/Pictures/Battle/databox_thin_foe"][@battler.index % 2] "Graphics/Pictures/Battle/databox_thin_foe"][@battler.index % 2]
end end
@@ -363,8 +363,10 @@ class PokemonDataBox < SpriteWrapper
# Data box bobbing while Pokémon is selected # Data box bobbing while Pokémon is selected
if @selected == 1 || @selected == 2 # Choosing commands/targeted or damaged if @selected == 1 || @selected == 2 # Choosing commands/targeted or damaged
case (frameCounter / QUARTER_ANIM_PERIOD).floor case (frameCounter / QUARTER_ANIM_PERIOD).floor
when 1 then self.y = @spriteY-2 when 1 then
when 3 then self.y = @spriteY+2 self.y = @spriteY - 2
when 3 then
self.y = @spriteY + 2
end end
end end
end end
@@ -381,8 +383,6 @@ class PokemonDataBox < SpriteWrapper
end end
end end
#=============================================================================== #===============================================================================
# Splash bar to announce a triggered ability # Splash bar to announce a triggered ability
#=============================================================================== #===============================================================================
@@ -464,7 +464,12 @@ class AbilitySplashBar < SpriteWrapper
textPos.push([_INTL("{1}'s", @battler.name), textX, -4, @side == 1, textPos.push([_INTL("{1}'s", @battler.name), textX, -4, @side == 1,
TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true]) TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true])
# Draw Pokémon's ability # Draw Pokémon's ability
textPos.push([@battler.abilityName,textX,26,@side==1, text = @battler.abilityName
if $game_switches[SWITCH_DOUBLE_ABILITIES]
text = _INTL("{1},{2}", @battler.abilityName, @battler.ability2Name)
end
textPos.push([text, textX, 26, @side == 1,
TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true]) TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true])
pbDrawTextPositions(self.bitmap, textPos) pbDrawTextPositions(self.bitmap, textPos)
end end
@@ -475,8 +480,6 @@ class AbilitySplashBar < SpriteWrapper
end end
end end
#=============================================================================== #===============================================================================
# Pokémon sprite (used in battle) # Pokémon sprite (used in battle)
#=============================================================================== #===============================================================================
@@ -513,8 +516,13 @@ class PokemonBattlerSprite < RPG::Sprite
super super
end end
def x; return @spriteX; end def x
def y; return @spriteY; end return @spriteX;
end
def y
return @spriteY;
end
def x=(value) def x=(value)
@spriteX = value @spriteX = value
@@ -528,8 +536,13 @@ class PokemonBattlerSprite < RPG::Sprite
super(value + @spriteYExtra) super(value + @spriteYExtra)
end end
def width; return (self.bitmap) ? self.bitmap.width : 0; end def width
def height; return (self.bitmap) ? self.bitmap.height : 0; end return (self.bitmap) ? self.bitmap.width : 0;
end
def height
return (self.bitmap) ? self.bitmap.height : 0;
end
def visible=(value) def visible=(value)
@spriteVisible = value if !@updating # For selection/targeting flashing @spriteVisible = value if !@updating # For selection/targeting flashing
@@ -597,8 +610,10 @@ class PokemonBattlerSprite < RPG::Sprite
@spriteYExtra = 0 @spriteYExtra = 0
if @selected == 1 # When choosing commands for this Pokémon if @selected == 1 # When choosing commands for this Pokémon
case (frameCounter / QUARTER_ANIM_PERIOD).floor case (frameCounter / QUARTER_ANIM_PERIOD).floor
when 1 then @spriteYExtra = 2 when 1 then
when 3 then @spriteYExtra = -2 @spriteYExtra = 2
when 3 then
@spriteYExtra = -2
end end
end end
self.x = self.x self.x = self.x
@@ -607,16 +622,16 @@ class PokemonBattlerSprite < RPG::Sprite
# Pokémon sprite blinking when targeted # Pokémon sprite blinking when targeted
if @selected == 2 && @spriteVisible if @selected == 2 && @spriteVisible
case (frameCounter / SIXTH_ANIM_PERIOD).floor case (frameCounter / SIXTH_ANIM_PERIOD).floor
when 2, 5 then self.visible = false when 2, 5 then
else self.visible = true self.visible = false
else
self.visible = true
end end
end end
@updating = false @updating = false
end end
end end
#=============================================================================== #===============================================================================
# Shadow sprite for Pokémon (used in battle) # Shadow sprite for Pokémon (used in battle)
#=============================================================================== #===============================================================================
@@ -641,8 +656,13 @@ class PokemonBattlerShadowSprite < RPG::Sprite
super super
end end
def width; return (self.bitmap) ? self.bitmap.width : 0; end def width
def height; return (self.bitmap) ? self.bitmap.height : 0; end return (self.bitmap) ? self.bitmap.width : 0;
end
def height
return (self.bitmap) ? self.bitmap.height : 0;
end
# Set sprite's origin to centre # Set sprite's origin to centre
def pbSetOrigin def pbSetOrigin

View File

@@ -173,7 +173,7 @@ class PokeBattle_Scene
#============================================================================= #=============================================================================
# Ability splash bar animations # Ability splash bar animations
#============================================================================= #=============================================================================
def pbShowAbilitySplash(battler) def pbShowAbilitySplash(battler,ability_name=nil)
return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
side = battler.index%2 side = battler.index%2
pbHideAbilitySplash(battler) if @sprites["abilityBar_#{side}"].visible pbHideAbilitySplash(battler) if @sprites["abilityBar_#{side}"].visible
@@ -187,6 +187,7 @@ class PokeBattle_Scene
abilitySplashAnim.dispose abilitySplashAnim.dispose
end end
def pbHideAbilitySplash(battler) def pbHideAbilitySplash(battler)
return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH return if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
side = battler.index%2 side = battler.index%2

View File

@@ -674,10 +674,22 @@ class PokemonSummary_Scene
] ]
# Draw ability name and description # Draw ability name and description
ability = @pokemon.ability ability = @pokemon.ability
ability2 = @pokemon.ability2
# if ability
# textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
# drawTextEx(overlay, 224, 320, 282, 2, ability.description, Color.new(64, 64, 64), Color.new(176, 176, 176))
# end
#fixme temp
if ability if ability
textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)]) textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
drawTextEx(overlay, 224, 320, 282, 2, ability.description, Color.new(64, 64, 64), Color.new(176, 176, 176)) if ability2
drawTextEx(overlay, 224, 320, 282, 2, ability2.name, Color.new(64, 64, 64), Color.new(176, 176, 176))
end end
end
# Draw all text # Draw all text
pbDrawTextPositions(overlay, textpos) pbDrawTextPositions(overlay, textpos)
# Draw HP bar # Draw HP bar

View File

@@ -659,7 +659,7 @@ PokemonDebugMenuCommands.register("setitem", {
PokemonDebugMenuCommands.register("setability", { PokemonDebugMenuCommands.register("setability", {
"parent" => "main", "parent" => "main",
"name" => _INTL("Set ability"), "name" => _INTL("Set primary ability"),
"always_show" => true, "always_show" => true,
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
cmd = 0 cmd = 0
@@ -706,6 +706,56 @@ PokemonDebugMenuCommands.register("setability", {
} }
}) })
PokemonDebugMenuCommands.register("setability2", {
"parent" => "main",
"name" => _INTL("Set secondary ability"),
"always_show" => true,
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
cmd = 0
commands = [
_INTL("Set possible ability"),
_INTL("Set any ability"),
_INTL("Reset")
]
loop do
if pkmn.ability
msg = _INTL("Ability 2 is {1} (index {2}).", pkmn.ability2.name, pkmn.ability2_index)
else
msg = _INTL("No ability (index {1}).", pkmn.ability2_index)
end
cmd = screen.pbShowCommands(msg, commands, cmd)
break if cmd < 0
case cmd
when 0 # Set possible ability
abils = pkmn.getAbilityList
ability_commands = []
abil_cmd = 0
for i in abils
ability_commands.push(((i[1] < 2) ? "" : "(H) ") + GameData::Ability.get(i[0]).name)
abil_cmd = ability_commands.length - 1 if pkmn.ability2_id == i[0]
end
abil_cmd = screen.pbShowCommands(_INTL("Choose an ability."), ability_commands, abil_cmd)
next if abil_cmd < 0
pkmn.ability2_index = abils[abil_cmd][1]
pkmn.ability2 = nil
screen.pbRefreshSingle(pkmnid)
when 1 # Set any ability
new_ability = pbChooseAbilityList(pkmn.ability2_id)
if new_ability && new_ability != pkmn.ability2_id
pkmn.ability2 = new_ability
screen.pbRefreshSingle(pkmnid)
end
when 2 # Reset
pkmn.ability2_index = nil
pkmn.ability2 = nil
screen.pbRefreshSingle(pkmnid)
end
end
next false
}
})
PokemonDebugMenuCommands.register("setnature", { PokemonDebugMenuCommands.register("setnature", {
"parent" => "main", "parent" => "main",
"name" => _INTL("Set nature"), "name" => _INTL("Set nature"),

View File

@@ -103,13 +103,9 @@ class FusionSelectOptionsScene < PokemonOption_Scene
@selectedNature=@natureList[value] @selectedNature=@natureList[value]
}, [getNatureDescription(@natureList[0]), getNatureDescription(@natureList[1])] }, [getNatureDescription(@natureList[0]), getNatureDescription(@natureList[1])]
) )
addOptionsExtension(options)
return options return options
end end
def addOptionsExtension(options)
return options
end
def isConfirmedOnKeyPress def isConfirmedOnKeyPress
return true return true

View File

@@ -23,6 +23,7 @@ SWITCH_GAME_DIFFICULTY_HARD = 666
SWITCH_MODERN_MODE=974 SWITCH_MODERN_MODE=974
SWITCH_V5_1=825 SWITCH_V5_1=825
SWITCH_NO_LEVELS_MODE=774 SWITCH_NO_LEVELS_MODE=774
SWITCH_DOUBLE_ABILITIES=773
#Game progression switches #Game progression switches
SWITCH_DURING_INTRO = 917 SWITCH_DURING_INTRO = 917

View File

@@ -1517,6 +1517,11 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
pokemon.ability_index = pokemon.body_original_ability_index if pokemon.body_original_ability_index pokemon.ability_index = pokemon.body_original_ability_index if pokemon.body_original_ability_index
poke2.ability_index = pokemon.head_original_ability_index if pokemon.head_original_ability_index poke2.ability_index = pokemon.head_original_ability_index if pokemon.head_original_ability_index
pokemon.ability2_index=nil
pokemon.ability2=nil
poke2.ability2_index=nil
poke2.ability2=nil
pokemon.debug_shiny = true if pokemon.debug_shiny && pokemon.body_shiny pokemon.debug_shiny = true if pokemon.debug_shiny && pokemon.body_shiny
poke2.debug_shiny = true if pokemon.debug_shiny && poke2.head_shiny poke2.debug_shiny = true if pokemon.debug_shiny && poke2.head_shiny

Binary file not shown.