Added Gen 9 forms code, evolution code, some item effects

This commit is contained in:
Maruno17
2024-06-08 19:35:45 +01:00
parent 6c3d9e77ad
commit 5e23984765
26 changed files with 678 additions and 495 deletions

View File

@@ -87,11 +87,6 @@ class Battle::Battler
# Do other things
@battle.pbClearChoice(@index) # Reset choice
pbOwnSide.effects[PBEffects::LastRoundFainted] = @battle.turnCount
if $game_temp.party_direct_damage_taken &&
$game_temp.party_direct_damage_taken[@pokemonIndex] &&
pbOwnedByPlayer?
$game_temp.party_direct_damage_taken[@pokemonIndex] = 0
end
# Check other battlers' abilities that trigger upon a battler fainting
pbAbilitiesOnFainting
# Check for end of primordial weather

View File

@@ -238,6 +238,9 @@ class Battle::Battler
# Record move as having been used
@lastMoveUsed = move.id
@lastMoveUsedType = move.calcType # For Conversion 2
if @pokemon.isSpecies?(:PRIMEAPE) && @lastMoveUsed == :RAGEFIST
@pokemon.evolution_counter += 1
end
if !specialUsage
@lastRegularMoveUsed = move.id # For Disable, Encore, Instruct, Mimic, Mirror Move, Sketch, Spite
@lastRegularMoveTarget = choice[3] # For Instruct (remembering original target is fine)
@@ -707,7 +710,13 @@ class Battle::Battler
move.pbEffectAgainstTarget(user, b)
end
move.pbEffectGeneral(user)
targets.each { |b| b.pbFaint if b&.fainted? }
targets.each do |b|
next if !b&.fainted?
b.pbFaint
if user.pokemon.isSpecies?(:BISHARP) && b.isSpecies?(:BISHARP) && b.item == :LEADERSCREST
user.pokemon.evolution_counter += 1
end
end
user.pbFaint if user.fainted?
# Additional effect
if !user.hasActiveAbility?(:SHEERFORCE)

View File

@@ -297,10 +297,8 @@ class Battle::Move
@battle.pbDisplay(_INTL("The substitute took damage for {1}!", target.pbThis(true)))
end
if target.damageState.critical
if $game_temp.party_critical_hits_dealt &&
$game_temp.party_critical_hits_dealt[user.pokemonIndex] &&
user.pbOwnedByPlayer?
$game_temp.party_critical_hits_dealt[user.pokemonIndex] += 1
if user.pokemon.isSpecies?(:FARFETCHD) && user.pokemon.form == 1
user.pokemon.evolution_counter += 1
end
if target.damageState.affection_critical
if numTargets > 1
@@ -396,10 +394,8 @@ class Battle::Move
target.tookMoveDamageThisRound = true if damage > 0 && !target.damageState.substitute # For Focus Punch
target.tookDamageThisRound = true if damage > 0 # For Assurance
target.lastAttacker.push(user.index) # For Revenge
if $game_temp.party_direct_damage_taken &&
$game_temp.party_direct_damage_taken[target.pokemonIndex] &&
target.pbOwnedByPlayer?
$game_temp.party_direct_damage_taken[target.pokemonIndex] += damage
if target.pokemon.isSpecies?(:YAMASK) && target.pokemon.form == 1
target.pokemon.evolution_counter += damage
end
end
end

View File

@@ -424,6 +424,9 @@ class Battle::Move::RecoilMove < Battle::Move
return if user.hasActiveAbility?(:ROCKHEAD)
amt = pbRecoilDamage(user, target)
amt = 1 if amt < 1
if user.pokemon.isSpecies?(:BASCULIN) && [2, 3].include?(user.pokemon.form)
user.pokemon.evolution_counter += amt
end
user.pbReduceHP(amt, false)
@battle.pbDisplay(_INTL("{1} is damaged by recoil!", user.pbThis))
user.pbItemHPHealCheck

View File

@@ -847,7 +847,8 @@ class Battle::Move::RemoveScreens < Battle::Move
end
#===============================================================================
# User is protected against moves with the "B" flag this round. (Detect, Protect)
# User is protected against moves with the "CanProtect" flag this round.
# (Detect, Protect)
#===============================================================================
class Battle::Move::ProtectUser < Battle::Move::ProtectMove
def initialize(battle, move)
@@ -857,8 +858,8 @@ class Battle::Move::ProtectUser < Battle::Move::ProtectMove
end
#===============================================================================
# User is protected against moves with the "B" flag this round. If a Pokémon
# makes contact with the user while this effect applies, that Pokémon is
# User is protected against moves with the "CanProtect" flag this round. If a
# Pokémon makes contact with the user while this effect applies, that Pokémon is
# poisoned. (Baneful Bunker)
#===============================================================================
class Battle::Move::ProtectUserBanefulBunker < Battle::Move::ProtectMove

View File

@@ -49,13 +49,9 @@ module Battle::CatchAndStoreMixin
if idx < party_size - 1
@initialItems[0][idx] = @initialItems[0][idx + 1]
$game_temp.party_levels_before_battle[idx] = $game_temp.party_levels_before_battle[idx + 1]
$game_temp.party_critical_hits_dealt[idx] = $game_temp.party_critical_hits_dealt[idx + 1]
$game_temp.party_direct_damage_taken[idx] = $game_temp.party_direct_damage_taken[idx + 1]
else
@initialItems[0][idx] = nil
$game_temp.party_levels_before_battle[idx] = nil
$game_temp.party_critical_hits_dealt[idx] = nil
$game_temp.party_direct_damage_taken[idx] = nil
end
end
break

View File

@@ -959,12 +959,14 @@ Battle::ItemEffects::DamageCalcFromUser.add(:NORMALGEM,
}
)
Battle::ItemEffects::DamageCalcFromUser.add(:PIXIEPLATE,
Battle::ItemEffects::DamageCalcFromUser.add(:FAIRYFEATHER,
proc { |item, user, target, move, mults, power, type|
mults[:power_multiplier] *= 1.2 if type == :FAIRY
}
)
Battle::ItemEffects::DamageCalcFromUser.copy(:FAIRYFEATHER, :PIXIEPLATE)
Battle::ItemEffects::DamageCalcFromUser.add(:POISONBARB,
proc { |item, user, target, move, mults, power, type|
mults[:power_multiplier] *= 1.2 if type == :POISON