From 34ab0b8afe82cbefb55c3fdd616266dfca59966c Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 7 Nov 2021 18:05:32 +0000 Subject: [PATCH] =?UTF-8?q?Added=20evolution=20method=20for=20Galarian=20Y?= =?UTF-8?q?amask,=20minor=20refactoring=20in=20battle=20code,=20a=20Pok?= =?UTF-8?q?=C3=A9mon's=20ability=20no=20longer=20needs=20resetting=20when?= =?UTF-8?q?=20changing=20its=20ability=5Findex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../001_Hardcoded data/007_Evolution.rb | 19 +++++++++++++++--- .../001_Battler/001_PokeBattle_Battler.rb | 4 ++++ .../001_Battler/003_Battler_ChangeSelf.rb | 1 + .../001_Battler/007_Battler_UseMove.rb | 2 +- .../011_Battle/002_Move/002_Move_Usage.rb | 1 + .../002_Move/005_MoveEffects_Misc.rb | 2 +- .../002_Move/011_MoveEffects_Items.rb | 15 ++++++-------- .../013_MoveEffects_SwitchingActing.rb | 6 +++--- .../003_Battle/002_PokeBattle_Battle.rb | 6 ++++-- .../003_Battle/006_Battle_Action_Switching.rb | 2 +- .../003_Battle/009_Battle_Action_Other.rb | 2 +- .../003_Battle/011_Battle_Phase_Attack.rb | 4 ++-- .../003_BattleHandlers_Abilities.rb | 4 ++-- Data/Scripts/011_Battle/004_AI/004_AI_Move.rb | 2 +- .../011_Battle/004_BattleHandlers_Items.rb | 2 +- .../008_PokeBattle_BattlePeer.rb | 6 +++++- .../001_Overworld_BattleStarting.rb | 3 +++ .../001_Pokemon-related/004_PokemonStorage.rb | 18 ++++++++++++++--- Data/Scripts/014_Pokemon/001_Pokemon.rb | 20 ++++++++++++++----- .../004_UI_Evolution.rb | 1 + Data/Scripts/016_UI/017_UI_PokemonStorage.rb | 18 ++++++++++++++--- Data/Scripts/Gen 8 notes.txt | 19 ++++++++---------- PBS/Gen 8/pokemon_forms.txt | 2 +- PBS/pokemon_forms.txt | 2 +- 24 files changed, 109 insertions(+), 52 deletions(-) diff --git a/Data/Scripts/010_Data/001_Hardcoded data/007_Evolution.rb b/Data/Scripts/010_Data/001_Hardcoded data/007_Evolution.rb index 21bf84c26..4cd5bdb99 100644 --- a/Data/Scripts/010_Data/001_Hardcoded data/007_Evolution.rb +++ b/Data/Scripts/010_Data/001_Hardcoded data/007_Evolution.rb @@ -263,9 +263,6 @@ GameData::Evolution.register({ GameData::Evolution.register({ :id => :Shedinja, :parameter => Integer, - :level_up_proc => proc { |pkmn, parameter| - next false # This is a dummy proc and shouldn't next true - }, :after_evolution_proc => proc { |pkmn, new_species, parameter, evo_species| next false if $player.party_full? next false if !$bag.has?(:POKEBALL) @@ -697,3 +694,19 @@ GameData::Evolution.register({ next true } }) + +GameData::Evolution.register({ + :id => :EventAfterDamageTaken, + :parameter => Integer, + :after_battle_proc => proc { |pkmn, party_index, parameter| + if $game_temp.party_direct_damage_taken && + $game_temp.party_direct_damage_taken[party_index] && + $game_temp.party_direct_damage_taken[party_index] >= parameter + pkmn.ready_to_evolve = true + end + next false + }, + :event_proc => proc { |pkmn, parameter, value| + next pkmn.ready_to_evolve + } +}) diff --git a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb index 71327daef..75dc077bb 100644 --- a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -706,6 +706,10 @@ class PokeBattle_Battler return @battle.pbOwnedByPlayer?(@index) end + def wild? + return @battle.wildBattle? && opposes? + end + # Returns 0 if self is on the player's side, or 1 if self is on the opposing # side. def idxOwnSide diff --git a/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb b/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb index c59e35c03..11cb073c3 100644 --- a/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb +++ b/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb @@ -86,6 +86,7 @@ class PokeBattle_Battler # Do other things @battle.pbClearChoice(@index) # Reset choice pbOwnSide.effects[PBEffects::LastRoundFainted] = @battle.turnCount + $game_temp.party_direct_damage_taken[@pokemonIndex] = 0 if pbOwnedByPlayer? # Check other battlers' abilities that trigger upon a battler fainting pbAbilitiesOnFainting # Check for end of primordial weather diff --git a/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb b/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb index 385fe8833..39094a130 100644 --- a/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb +++ b/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb @@ -5,7 +5,7 @@ class PokeBattle_Battler def pbProcessTurn(choice,tryFlee=true) return false if fainted? # Wild roaming Pokémon always flee if possible - if tryFlee && @battle.wildBattle? && opposes? && + if tryFlee && wild? && @battle.rules["alwaysflee"] && @battle.pbCanRun?(@index) pbBeginTurn(choice) pbSEPlay("Battle flee") diff --git a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb index a23131f1d..461097493 100644 --- a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb +++ b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb @@ -382,5 +382,6 @@ class PokeBattle_Move target.lastHPLostFromFoe = damage # For Metal Burst target.lastFoeAttacker.push(user.index) # For Metal Burst end + $game_temp.party_direct_damage_taken[target.pokemonIndex] += damage if target.pbOwnedByPlayer? end end diff --git a/Data/Scripts/011_Battle/002_Move/005_MoveEffects_Misc.rb b/Data/Scripts/011_Battle/002_Move/005_MoveEffects_Misc.rb index 9b030731e..1dfea5b45 100644 --- a/Data/Scripts/011_Battle/002_Move/005_MoveEffects_Misc.rb +++ b/Data/Scripts/011_Battle/002_Move/005_MoveEffects_Misc.rb @@ -9,7 +9,7 @@ end #=============================================================================== class PokeBattle_Move_DoesNothingCongratuations < PokeBattle_Move def pbEffectGeneral(user) - if @battle.wildBattle? && user.opposes? + if user.wild? @battle.pbDisplay(_INTL("Congratulations from {1}!",user.pbThis(true))) else @battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwnerName(user.index))) diff --git a/Data/Scripts/011_Battle/002_Move/011_MoveEffects_Items.rb b/Data/Scripts/011_Battle/002_Move/011_MoveEffects_Items.rb index 5331c04ff..4cc7bcb06 100644 --- a/Data/Scripts/011_Battle/002_Move/011_MoveEffects_Items.rb +++ b/Data/Scripts/011_Battle/002_Move/011_MoveEffects_Items.rb @@ -4,7 +4,7 @@ #=============================================================================== class PokeBattle_Move_UserTakesTargetItem < PokeBattle_Move def pbEffectAfterAllHits(user,target) - return if @battle.wildBattle? && user.opposes? # Wild Pokémon can't thieve + return if user.wild? # Wild Pokémon can't thieve return if user.fainted? return if target.damageState.unaffected || target.damageState.substitute return if !target.item || user.item @@ -14,8 +14,7 @@ class PokeBattle_Move_UserTakesTargetItem < PokeBattle_Move itemName = target.itemName user.item = target.item # Permanently steal the item from wild Pokémon - if @battle.wildBattle? && target.opposes? && !user.initialItem && - target.item == target.initialItem + if target.wild? && !user.initialItem && target.item == target.initialItem user.setInitialItem(target.item) target.pbRemoveItem else @@ -56,8 +55,7 @@ class PokeBattle_Move_TargetTakesUserItem < PokeBattle_Move itemName = user.itemName target.item = user.item # Permanently steal the item from wild Pokémon - if @battle.wildBattle? && user.opposes? && !target.initialItem && - user.item == user.initialItem + if user.wild? && !target.initialItem && user.item == user.initialItem target.setInitialItem(user.item) user.pbRemoveItem else @@ -74,7 +72,7 @@ end #=============================================================================== class PokeBattle_Move_UserTargetSwapItems < PokeBattle_Move def pbMoveFailed?(user,targets) - if @battle.wildBattle? && user.opposes? + if user.wild? @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -121,8 +119,7 @@ class PokeBattle_Move_UserTargetSwapItems < PokeBattle_Move target.effects[PBEffects::ChoiceBand] = nil if !target.hasActiveAbility?(:GORILLATACTICS) target.effects[PBEffects::Unburden] = (!target.item && oldTargetItem) if target.hasActiveAbility?(:UNBURDEN) # Permanently steal the item from wild Pokémon - if @battle.wildBattle? && target.opposes? && !user.initialItem && - oldTargetItem == target.initialItem + if target.wild? && !user.initialItem && oldTargetItem == target.initialItem user.setInitialItem(oldTargetItem) end @battle.pbDisplay(_INTL("{1} switched items with its opponent!",user.pbThis)) @@ -180,7 +177,7 @@ class PokeBattle_Move_RemoveTargetItem < PokeBattle_Move end def pbEffectAfterAllHits(user,target) - return if @battle.wildBattle? && user.opposes? # Wild Pokémon can't knock off + return if user.wild? # Wild Pokémon can't knock off return if user.fainted? return if target.damageState.unaffected || target.damageState.substitute return if !target.item || target.unlosableItem?(target.item) diff --git a/Data/Scripts/011_Battle/002_Move/013_MoveEffects_SwitchingActing.rb b/Data/Scripts/011_Battle/002_Move/013_MoveEffects_SwitchingActing.rb index 131e63153..99358c303 100644 --- a/Data/Scripts/011_Battle/002_Move/013_MoveEffects_SwitchingActing.rb +++ b/Data/Scripts/011_Battle/002_Move/013_MoveEffects_SwitchingActing.rb @@ -22,7 +22,7 @@ end #=============================================================================== class PokeBattle_Move_SwitchOutUserStatusMove < PokeBattle_Move def pbMoveFailed?(user,targets) - if @battle.wildBattle? && user.opposes? + if user.wild? if !@battle.pbCanRun?(user.index) @battle.pbDisplay(_INTL("But it failed!")) return true @@ -35,7 +35,7 @@ class PokeBattle_Move_SwitchOutUserStatusMove < PokeBattle_Move end def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers) - return if @battle.wildBattle? && user.opposes? + return if user.wild? @battle.pbDisplay(_INTL("{1} went back to {2}!",user.pbThis, @battle.pbGetOwnerName(user.index))) @battle.pbPursuit(user.index) @@ -50,7 +50,7 @@ class PokeBattle_Move_SwitchOutUserStatusMove < PokeBattle_Move end def pbEffectGeneral(user) - if @battle.wildBattle? && user.opposes? + if user.wild? @battle.pbDisplay(_INTL("{1} fled from battle!",user.pbThis)) @battle.decision = 3 # Escaped end diff --git a/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb b/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb index 65f9b43e2..a363d5444 100644 --- a/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb +++ b/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb @@ -232,7 +232,8 @@ class PokeBattle_Battle def pbGetOwnerFromBattlerIndex(idxBattler) idxTrainer = pbGetOwnerIndexFromBattlerIndex(idxBattler) - return (opposes?(idxBattler)) ? @opponent[idxTrainer] : @player[idxTrainer] + trainer = (opposes?(idxBattler)) ? @opponent : @player + return (trainer.nil?) ? nil : trainer[idxTrainer] end def pbGetOwnerIndexFromPartyIndex(idxBattler,idxParty) @@ -248,7 +249,8 @@ class PokeBattle_Battle # switch another trainer's Pokémon. def pbGetOwnerFromPartyIndex(idxBattler,idxParty) idxTrainer = pbGetOwnerIndexFromPartyIndex(idxBattler,idxParty) - return (opposes?(idxBattler)) ? @opponent[idxTrainer] : @player[idxTrainer] + trainer = (opposes?(idxBattler)) ? @opponent : @player + return (trainer.nil?) ? nil : trainer[idxTrainer] end def pbGetOwnerName(idxBattler) diff --git a/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb b/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb index f82615ac4..f4c4dcc4a 100644 --- a/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb +++ b/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb @@ -156,7 +156,7 @@ class PokeBattle_Battle idxBattler = b.index next if !pbCanChooseNonActive?(idxBattler) if !pbOwnedByPlayer?(idxBattler) # Opponent/ally is switching in - next if wildBattle? && opposes?(idxBattler) # Wild Pokémon can't switch + next if b.wild? # Wild Pokémon can't switch idxPartyNew = pbSwitchInBetween(idxBattler) opponent = pbGetOwnerFromBattlerIndex(idxBattler) # NOTE: The player is only offered the chance to switch their own diff --git a/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb b/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb index ab4f24cf6..ff63f9ac2 100644 --- a/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb +++ b/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb @@ -83,7 +83,7 @@ class PokeBattle_Battle def pbCanMegaEvolve?(idxBattler) return false if $game_switches[Settings::NO_MEGA_EVOLUTION] return false if !@battlers[idxBattler].hasMega? - return false if wildBattle? && opposes?(idxBattler) + return false if @battlers[idxBattler].wild? return true if $DEBUG && Input.press?(Input::CTRL) return false if @battlers[idxBattler].effects[PBEffects::SkyDrop]>=0 return false if !pbHasMegaRing?(idxBattler) diff --git a/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb b/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb index 0907e2221..b22261fd9 100644 --- a/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb +++ b/Data/Scripts/011_Battle/003_Battle/011_Battle_Phase_Attack.rb @@ -33,7 +33,7 @@ class PokeBattle_Battle next if b.effects[PBEffects::SkyDrop]>=0 next if b.hasActiveAbility?(:TRUANT) && b.effects[PBEffects::Truant] # Mega Evolve - if !wildBattle? || !b.opposes? + if !b.wild? owner = pbGetOwnerIndexFromBattlerIndex(b.index) pbMegaEvolve(b.index) if @megaEvolution[b.idxOwnSide][owner]==b.index end @@ -93,7 +93,7 @@ class PokeBattle_Battle def pbAttackPhaseMegaEvolution pbPriority.each do |b| - next if wildBattle? && b.opposes? + next if b.wild? next unless @choices[b.index][0]==:UseMove && !b.fainted? owner = pbGetOwnerIndexFromBattlerIndex(b.index) next if @megaEvolution[b.idxOwnSide][owner]!=b.index diff --git a/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb b/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb index 3a5f72a0b..1bd7f5ba7 100644 --- a/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb +++ b/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb @@ -1842,7 +1842,7 @@ BattleHandlers::UserAbilityEndOfMove.add(:MAGICIAN, next if battle.futureSight next if !move.pbDamagingMove? next if user.item - next if battle.wildBattle? && user.opposes? + next if user.wild? targets.each do |b| next if b.damageState.unaffected || b.damageState.substitute next if !b.item @@ -1919,7 +1919,7 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:PICKPOCKET, # NOTE: According to Bulbapedia, this can still trigger to steal the user's # item even if it was switched out by a Red Card. This doesn't make # sense, so this code doesn't do it. - next if battle.wildBattle? && target.opposes? + next if target.wild? next if switched_battlers.include?(user.index) # User was switched out next if !move.contactMove? next if user.effects[PBEffects::Substitute]>0 || target.damageState.substitute diff --git a/Data/Scripts/011_Battle/004_AI/004_AI_Move.rb b/Data/Scripts/011_Battle/004_AI/004_AI_Move.rb index ddc048ee6..8f305c81a 100644 --- a/Data/Scripts/011_Battle/004_AI/004_AI_Move.rb +++ b/Data/Scripts/011_Battle/004_AI/004_AI_Move.rb @@ -5,7 +5,7 @@ class PokeBattle_AI #============================================================================= def pbChooseMoves(idxBattler) user = @battle.battlers[idxBattler] - wildBattler = (@battle.wildBattle? && @battle.opposes?(idxBattler)) + wildBattler = user.wild? skill = 0 if !wildBattler skill = @battle.pbGetOwnerFromBattlerIndex(user.index).skill_level || 0 diff --git a/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb b/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb index e454c3087..cc193887e 100644 --- a/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb +++ b/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb @@ -229,7 +229,7 @@ BattleHandlers::ItemOnStatDropped.add(:EJECTPACK, next false if battler.effects[PBEffects::SkyDrop] >= 0 || battler.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") # Sky Drop next false if battle.pbAllFainted?(battler.idxOpposingSide) - next false if battle.wildBattle? && battler.opposes? # Wild Pokémon can't eject + next false if battler.wild? # Wild Pokémon can't eject next false if !battle.pbCanSwitch?(battler.index) # Battler can't switch out next false if !battle.pbCanChooseNonActive?(battler.index) # No Pokémon can switch in battle.pbCommonAnimation("UseItem", battler) diff --git a/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb b/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb index 9b1c65f2b..a52089998 100644 --- a/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb +++ b/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb @@ -27,7 +27,11 @@ class PokeBattle_RealBattlePeer player.party[player.party.length] = pkmn return -1 end - pkmn.heal if Settings::HEAL_STORED_POKEMON + if Settings::HEAL_STORED_POKEMON + old_ready_evo = pkmn.ready_to_evolve + pkmn.heal + pkmn.ready_to_evolve = old_ready_evo + end oldCurBox = pbCurrentBox storedBox = $PokemonStorage.pbStoreCaught(pkmn) if storedBox<0 diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb index c1c8aef1f..e8e4eaf23 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb @@ -15,6 +15,7 @@ class Game_Temp attr_accessor :encounter_type attr_accessor :party_levels_before_battle attr_accessor :party_critical_hits_dealt + attr_accessor :party_direct_damage_taken def battle_rules @battle_rules = {} if !@battle_rules @@ -192,9 +193,11 @@ Events.onStartBattle += proc { |_sender| # during battle and may need to evolve afterwards $game_temp.party_levels_before_battle = [] $game_temp.party_critical_hits_dealt = [] + $game_temp.party_direct_damage_taken = [] $player.party.each_with_index do |pkmn, i| $game_temp.party_levels_before_battle[i] = pkmn.level $game_temp.party_critical_hits_dealt[i] = 0 + $game_temp.party_direct_damage_taken[i] = 0 end } diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb index ca41b46c7..695874e9c 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb @@ -190,7 +190,11 @@ class PokemonStorage else # Copying into box pkmn = self[boxSrc,indexSrc] raise "Trying to copy nil to storage" if !pkmn - pkmn.heal if Settings::HEAL_STORED_POKEMON + if Settings::HEAL_STORED_POKEMON + old_ready_evo = pkmn.ready_to_evolve + pkmn.heal + pkmn.ready_to_evolve = old_ready_evo + end self[boxDst,indexDst] = pkmn end return true @@ -210,7 +214,11 @@ class PokemonStorage def pbMoveCaughtToBox(pkmn,box) for i in 0...maxPokemon(box) if self[box,i]==nil - pkmn.heal if box >= 0 && Settings::HEAL_STORED_POKEMON + if Settings::HEAL_STORED_POKEMON && box >= 0 + old_ready_evo = pkmn.ready_to_evolve + pkmn.heal + pkmn.ready_to_evolve = old_ready_evo + end self[box,i] = pkmn return true end @@ -219,7 +227,11 @@ class PokemonStorage end def pbStoreCaught(pkmn) - pkmn.heal if Settings::HEAL_STORED_POKEMON if @currentBox >= 0 + if Settings::HEAL_STORED_POKEMON && @currentBox >= 0 + old_ready_evo = pkmn.ready_to_evolve + pkmn.heal + pkmn.ready_to_evolve = old_ready_evo + end for i in 0...maxPokemon(@currentBox) if self[@currentBox,i]==nil self[@currentBox,i] = pkmn diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index 7cf1b02ba..4ee4ccc04 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -26,11 +26,6 @@ class Pokemon # This Pokémon's shininess (true, false, nil). Is recalculated if made nil. # @param value [Boolean, nil] whether this Pokémon is shiny attr_writer :shiny - # The index of this Pokémon's ability (0, 1 are natural abilities, 2+ are - # hidden abilities)as defined for its species/form. An ability may not be - # defined at this index. Is recalculated (as 0 or 1) if made nil. - # @param value [Integer, nil] forced ability index (nil if none is set) - attr_writer :ability_index # @return [Array] the moves known by this Pokémon attr_accessor :moves # @return [Array] the IDs of moves known by this Pokémon when it was obtained @@ -80,6 +75,9 @@ class Pokemon attr_accessor :fused # @return [Integer] this Pokémon's personal ID attr_accessor :personalID + # Used by Galarian Yamask to remember that it took sufficient damage from a + # battle and can evolve. + attr_accessor :ready_to_evolve # Max total IVs IV_STAT_LIMIT = 31 @@ -237,6 +235,7 @@ class Pokemon def hp=(value) @hp = value.clamp(0, @totalhp) heal_status if @hp == 0 + @ready_to_evolve = false if @hp == 0 end # Sets this Pokémon's status. See {GameData::Status} for all possible status effects. @@ -292,6 +291,7 @@ class Pokemon heal_HP heal_status heal_PP + @ready_to_evolve = false end #============================================================================= @@ -402,6 +402,7 @@ class Pokemon return @super_shiny end + # @param value [Boolean] whether this Pokémon is super shiny def super_shiny=(value) @super_shiny = value @shiny = true if @super_shiny @@ -411,12 +412,21 @@ class Pokemon # Ability #============================================================================= + # The index of this Pokémon's ability (0, 1 are natural abilities, 2+ are + # hidden abilities) as defined for its species/form. An ability may not be + # defined at this index. Is recalculated (as 0 or 1) if made nil. # @return [Integer] the index of this Pokémon's ability def ability_index @ability_index = (@personalID & 1) if !@ability_index return @ability_index end + # @param value [Integer, nil] forced ability index (nil if none is set) + def ability_index=(value) + @ability_index = value + @ability = nil + end + # @return [GameData::Ability, nil] an Ability object corresponding to this Pokémon's ability def ability return GameData::Ability.try_get(ability_id) diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb index 314c4d078..13e6d3f37 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb @@ -587,6 +587,7 @@ class PokemonEvolutionScene @pokemon.species = @newspecies @pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM) @pokemon.calc_stats + @pokemon.ready_to_evolve = false # See and own evolved species $player.pokedex.register(@pokemon) $player.pokedex.set_owned(@newspecies) diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index 9e0060a8a..6ded29f2e 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -1727,7 +1727,11 @@ class PokemonStorageScreen end if heldpoke || selected[0]==-1 p = (heldpoke) ? heldpoke : @storage[-1,index] - p.heal if Settings::HEAL_STORED_POKEMON + if Settings::HEAL_STORED_POKEMON + old_ready_evo = p.ready_to_evolve + p.heal + p.ready_to_evolve = old_ready_evo + end end @scene.pbStore(selected,heldpoke,destbox,firstfree) if heldpoke @@ -1771,7 +1775,11 @@ class PokemonStorageScreen pbDisplay("Please remove the mail.") return end - @heldpkmn.heal if Settings::HEAL_STORED_POKEMON if box >= 0 + if Settings::HEAL_STORED_POKEMON && box >= 0 + old_ready_evo = @heldpkmn.ready_to_evolve + @heldpkmn.heal + @heldpkmn.ready_to_evolve = old_ready_evo + end @scene.pbPlace(selected,@heldpkmn) @storage[box,index] = @heldpkmn if box==-1 @@ -1796,7 +1804,11 @@ class PokemonStorageScreen pbDisplay("Please remove the mail.") return false end - @heldpkmn.heal if Settings::HEAL_STORED_POKEMON if box >= 0 + if Settings::HEAL_STORED_POKEMON && box >= 0 + old_ready_evo = @heldpkmn.ready_to_evolve + @heldpkmn.heal + @heldpkmn.ready_to_evolve = old_ready_evo + end @scene.pbSwap(selected,@heldpkmn) tmp = @storage[box,index] @storage[box,index] = @heldpkmn diff --git a/Data/Scripts/Gen 8 notes.txt b/Data/Scripts/Gen 8 notes.txt index 240035807..40fdf4226 100644 --- a/Data/Scripts/Gen 8 notes.txt +++ b/Data/Scripts/Gen 8 notes.txt @@ -20,17 +20,6 @@ Other notes: "The Weakness Policy sharply raised {1}'s Sp. Atk!" "The Weakness Policy was used up..." -New evolution methods: -- Milcery: spinning while holding an item. (Doesn't suit our control scheme. - We're not adding a way to easily spin on the spot just for this, cf. - not having to turn your computer upside-down to evolve Inkay.) -- Galarian Yamask: going to a particular spot after a battle in which it lost - 49+ HP from a single attack and hasn't fainted since then; - healing doesn't affect this. (Utter nonsense, find a better - way - just evolve after a battle in which the damage was - taken.) Confirmed that the damage has to be dealt in a single - attack, not spread across multiple ones. - - Ask whether a captured Pokémon, or an added Pokémon, should be put in storage or added to the party if the party is full. Also provide the option to look at its Pokédex entry. Have a way to force adding it to the party for plot @@ -58,6 +47,11 @@ toggled. (Probably don't bother implementing.) Bicycle that can work on water. +New evolution methods: +- Milcery: spinning while holding an item. (Doesn't suit our control scheme. + We're not adding a way to easily spin on the spot just for this, cf. + not having to turn your computer upside-down to evolve Inkay.) + I think there are some alternate forms which don't have a hidden ability while their base forms do. I don't think the compiler supports this, and instead treats Abilities and HiddenAbilities separately. Can work around this by setting @@ -100,6 +94,9 @@ 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) +- Galarian Yamask: going to a particular spot after a battle in which it lost + 49+ HP in a single battle from direct attacks and hasn't + fainted since then; healing with Potions doesn't affect this. Added AI for new moves/items/abilities. diff --git a/PBS/Gen 8/pokemon_forms.txt b/PBS/Gen 8/pokemon_forms.txt index 01672a1fd..a511d783f 100644 --- a/PBS/Gen 8/pokemon_forms.txt +++ b/PBS/Gen 8/pokemon_forms.txt @@ -1438,7 +1438,7 @@ TutorMoves = ALLYSWITCH,ATTRACT,BRUTALSWING,CALMMIND,DARKPULSE,EARTHPOWER,EARTHQ Pokedex = A clay slab with cursed engravings took possession of a Yamask. The slab is said to be absorbing the Yamask's dark power. Generation = 8 Flags = InheritFormWithEverStone -Evolutions = RUNERIGUS,Level,34 +Evolutions = RUNERIGUS,EventAfterDamageTaken,49 #------------------------------- [DEERLING,1] FormName = Summer Form diff --git a/PBS/pokemon_forms.txt b/PBS/pokemon_forms.txt index 01672a1fd..a511d783f 100644 --- a/PBS/pokemon_forms.txt +++ b/PBS/pokemon_forms.txt @@ -1438,7 +1438,7 @@ TutorMoves = ALLYSWITCH,ATTRACT,BRUTALSWING,CALMMIND,DARKPULSE,EARTHPOWER,EARTHQ Pokedex = A clay slab with cursed engravings took possession of a Yamask. The slab is said to be absorbing the Yamask's dark power. Generation = 8 Flags = InheritFormWithEverStone -Evolutions = RUNERIGUS,Level,34 +Evolutions = RUNERIGUS,EventAfterDamageTaken,49 #------------------------------- [DEERLING,1] FormName = Summer Form