mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Updated happiness values (assuming Timburr/Stunfisk not changing are mistakes), added new type of evolution that triggers after any battle, added code to let Galarian Farfetch'd evolve after dealing 3 critical hits
This commit is contained in:
@@ -7,6 +7,7 @@ module GameData
|
||||
attr_reader :level_up_proc
|
||||
attr_reader :use_item_proc
|
||||
attr_reader :on_trade_proc
|
||||
attr_reader :after_battle_proc
|
||||
attr_reader :event_proc
|
||||
attr_reader :after_evolution_proc
|
||||
|
||||
@@ -26,6 +27,7 @@ module GameData
|
||||
@level_up_proc = hash[:level_up_proc]
|
||||
@use_item_proc = hash[:use_item_proc]
|
||||
@on_trade_proc = hash[:on_trade_proc]
|
||||
@after_battle_proc = hash[:after_battle_proc]
|
||||
@event_proc = hash[:event_proc]
|
||||
@after_evolution_proc = hash[:after_evolution_proc]
|
||||
end
|
||||
@@ -42,6 +44,10 @@ module GameData
|
||||
return (@on_trade_proc) ? @on_trade_proc.call(*args) : nil
|
||||
end
|
||||
|
||||
def call_after_battle(*args)
|
||||
return (@after_battle_proc) ? @after_battle_proc.call(*args) : nil
|
||||
end
|
||||
|
||||
def call_event(*args)
|
||||
return (@event_proc) ? @event_proc.call(*args) : nil
|
||||
end
|
||||
@@ -604,6 +610,19 @@ GameData::Evolution.register({
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Evolution methods that are triggered after any battle
|
||||
#===============================================================================
|
||||
GameData::Evolution.register({
|
||||
:id => :BattleDealCriticalHit,
|
||||
:parameter => Integer,
|
||||
:after_battle_proc => proc { |pkmn, party_index, parameter|
|
||||
next $PokemonTemp.party_critical_hits_dealt &&
|
||||
$PokemonTemp.party_critical_hits_dealt[party_index] &&
|
||||
$PokemonTemp.party_critical_hits_dealt[party_index] >= parameter
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Evolution methods that are triggered by an event
|
||||
#===============================================================================
|
||||
|
||||
@@ -272,6 +272,7 @@ class PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true)))
|
||||
end
|
||||
if target.damageState.critical
|
||||
$PokemonTemp.party_critical_hits_dealt[user.pokemonIndex] += 1 if user.pbOwnedByPlayer?
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("A critical hit on {1}!",target.pbThis(true)))
|
||||
else
|
||||
|
||||
@@ -13,7 +13,8 @@ end
|
||||
class PokemonTemp
|
||||
attr_accessor :encounterTriggered
|
||||
attr_accessor :encounterType
|
||||
attr_accessor :evolutionLevels
|
||||
attr_accessor :party_levels_before_battle
|
||||
attr_accessor :party_critical_hits_dealt
|
||||
|
||||
def battleRules
|
||||
@battleRules = {} if !@battleRules
|
||||
@@ -187,9 +188,11 @@ end
|
||||
Events.onStartBattle += proc { |_sender|
|
||||
# Record current levels of Pokémon in party, to see if they gain a level
|
||||
# during battle and may need to evolve afterwards
|
||||
$PokemonTemp.evolutionLevels = []
|
||||
$PokemonTemp.party_levels_before_battle = []
|
||||
$PokemonTemp.party_critical_hits_dealt = []
|
||||
for i in 0...$Trainer.party.length
|
||||
$PokemonTemp.evolutionLevels[i] = $Trainer.party[i].level
|
||||
$PokemonTemp.party_levels_before_battle[i] = $Trainer.party[i].level
|
||||
$PokemonTemp.party_critical_hits_dealt = 0
|
||||
end
|
||||
}
|
||||
|
||||
@@ -566,12 +569,12 @@ end
|
||||
Events.onEndBattle += proc { |_sender,e|
|
||||
decision = e[0]
|
||||
canLose = e[1]
|
||||
if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES || (decision!=2 && decision!=5) # not a loss or a draw
|
||||
if $PokemonTemp.evolutionLevels
|
||||
pbEvolutionCheck($PokemonTemp.evolutionLevels)
|
||||
$PokemonTemp.evolutionLevels = nil
|
||||
end
|
||||
end
|
||||
# Check for evolutions
|
||||
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
||||
(decision!=2 && decision!=5) # not a loss or a draw
|
||||
$PokemonTemp.party_levels_before_battle = nil
|
||||
$PokemonTemp.party_critical_hits_dealt = nil
|
||||
# Check for blacking out or gaining Pickup/Huney Gather items
|
||||
case decision
|
||||
when 1, 4 # Win, capture
|
||||
$Trainer.pokemon_party.each do |pkmn|
|
||||
@@ -587,17 +590,25 @@ Events.onEndBattle += proc { |_sender,e|
|
||||
end
|
||||
}
|
||||
|
||||
def pbEvolutionCheck(currentLevels)
|
||||
for i in 0...currentLevels.length
|
||||
pkmn = $Trainer.party[i]
|
||||
next if !pkmn || (pkmn.hp==0 && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON)
|
||||
next if currentLevels[i] && pkmn.level==currentLevels[i]
|
||||
newSpecies = pkmn.check_evolution_on_level_up
|
||||
next if !newSpecies
|
||||
evo = PokemonEvolutionScene.new
|
||||
evo.pbStartScreen(pkmn,newSpecies)
|
||||
evo.pbEvolution
|
||||
evo.pbEndScreen
|
||||
def pbEvolutionCheck
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
next if !pkmn || pkmn.egg?
|
||||
next if pkmn.fainted? && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON
|
||||
# Find an evolution
|
||||
new_species = nil
|
||||
if new_species.nil? && $PokemonTemp.party_levels_before_battle &&
|
||||
$PokemonTemp.party_levels_before_battle[i] &&
|
||||
$PokemonTemp.party_levels_before_battle[i] < pkmn.level
|
||||
new_species = pkmn.check_evolution_on_level_up
|
||||
end
|
||||
new_species = pkmn.check_evolution_after_battle(i) if new_species.nil?
|
||||
# Evolve Pokémon if possible
|
||||
if !new_species.nil?
|
||||
evo = PokemonEvolutionScene.new
|
||||
evo.pbStartScreen(pkmn, new_species)
|
||||
evo.pbEvolution
|
||||
evo.pbEndScreen
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -961,6 +961,15 @@ class Pokemon
|
||||
}
|
||||
end
|
||||
|
||||
# Checks whether this Pokemon can evolve after a battle.
|
||||
# @return [Symbol, nil] the ID of the species to evolve into
|
||||
def check_evolution_after_battle(party_index)
|
||||
return check_evolution_internal { |pkmn, new_species, method, parameter|
|
||||
success = GameData::Evolution.get(method).call_after_battle(pkmn, party_index, parameter)
|
||||
next (success) ? new_species : nil
|
||||
}
|
||||
end
|
||||
|
||||
# Checks whether this Pokemon can evolve by a triggered event.
|
||||
# @param value [Integer] a value that may be used by the evolution method
|
||||
# @return [Symbol, nil] the ID of the species to evolve into
|
||||
|
||||
@@ -77,9 +77,6 @@ Can use Fly from within the Town Map if possible. (Good QoL, add if possible.)
|
||||
|
||||
Make example event that combines the Gen 8 fossils.
|
||||
|
||||
New evolution methods:
|
||||
- Galarian Farfetch'd: performing 3 critical hits in a single battle.
|
||||
|
||||
Add AI for new moves/items/abilities.
|
||||
|
||||
Zacian/Zamazenta need code that changes their movesets upon entering/leaving
|
||||
@@ -136,6 +133,7 @@ is done regardless of Generation, and doesn't need to be limited to Gen 8+.
|
||||
New evolution methods:
|
||||
- Kubfu (triggered by an event; Kubfu's form can be set beforehand by the event,
|
||||
so don't worry about the multiple forms it can evolve into)
|
||||
- Galarian Farfetch'd (performing 3 critical hits in a single battle)
|
||||
|
||||
Escape Rope's code now supports both consumable and non-consumable versions,
|
||||
depending on whether it is a key item. All it needs is a proper definition in
|
||||
|
||||
Reference in New Issue
Block a user