diff --git a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb index c8dbe8efb..c1a30014c 100644 --- a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb +++ b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb @@ -470,27 +470,27 @@ class PokeBattle_Move_096 < PokeBattle_Move :ENIGMABERRY, :MICLEBERRY, :CUSTAPBERRY, :JABOCABERRY, :ROWAPBERRY, :KEEBERRY, :MARANGABERRY] } - @berry = nil end def pbMoveFailed?(user,targets) # NOTE: Unnerve does not stop a Pokémon using this move. - @berry = user.item - if !@berry || !@berry.is_berry? || !user.itemActive? + item = user.item + if !item || !item.is_berry? || !user.itemActive? @battle.pbDisplay(_INTL("But it failed!")) return true end return false end - # NOTE: The AI calls this method via pbCalcType, but it involves @berry which - # won't always be accurate (although it will always be defined). Since - # the AI won't want to use it if the user has no item anyway, and - # complex item movement is unlikely, perhaps this is good enough. + # NOTE: The AI calls this method via pbCalcType, but it involves user.item + # which here is assumed to be not nil (because item.id is called). Since + # the AI won't want to use it if the user has no item anyway, perhaps + # this is good enough. def pbBaseType(user) + item = user.item ret = :NORMAL @typeArray.each do |type, items| - next if !items.include?(@berry.id) + next if !items.include?(item.id) ret = type if GameData::Type.exists?(type) break end @@ -510,7 +510,7 @@ class PokeBattle_Move_096 < PokeBattle_Move end def pbBaseDamage(baseDmg,user,target) - return pbNaturalGiftBaseDamage(@berry.id) + return pbNaturalGiftBaseDamage(user.item.id) end def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers) @@ -519,7 +519,6 @@ class PokeBattle_Move_096 < PokeBattle_Move # an effect like a target's Red Card. # NOTE: There is no item consumption animation. user.pbConsumeItem(true,true,false) if user.item - @berry = nil end end diff --git a/Data/Scripts/014_Trainers/006_Player_Deprecated.rb b/Data/Scripts/014_Trainers/006_Player_Deprecated.rb index 6239ad8b2..acfb81bef 100644 --- a/Data/Scripts/014_Trainers/006_Player_Deprecated.rb +++ b/Data/Scripts/014_Trainers/006_Player_Deprecated.rb @@ -95,8 +95,8 @@ class PokeBattle_Trainer trainer.party.each { |p| ret.party.push(PokeBattle_Pokemon.convert(p)) } ret.badges = trainer.badges.clone ret.money = trainer.money - trainer.seen.each_with_index { |value, i| ret.pokedex.set_seen(i) if value } - trainer.owned.each_with_index { |value, i| ret.pokedex.set_owned(i) if value } + trainer.seen.each_with_index { |value, i| ret.pokedex.set_seen(i, false) if value } + trainer.owned.each_with_index { |value, i| ret.pokedex.set_owned(i, false) if value } trainer.formseen.each_with_index do |value, i| species_id = GameData::Species.try_get(i)&.species next if species_id.nil? || value.nil? @@ -112,6 +112,7 @@ class PokeBattle_Trainer ret.pokedex.set_shadow_pokemon_owned(i) if value end end + ret.pokedex.refresh_accessible_dexes ret.has_pokedex = trainer.pokedex ret.has_pokegear = trainer.pokegear ret.mystery_gift_unlocked = trainer.mysterygiftaccess if trainer.mysterygiftaccess