Fixed Natural Gift always being Normal-type

This commit is contained in:
Maruno17
2021-04-17 20:21:46 +01:00
parent 4489cde044
commit cef2beb063
2 changed files with 12 additions and 12 deletions

View File

@@ -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

View File

@@ -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