Added class GameData::EncounterType

This commit is contained in:
Maruno17
2021-03-06 22:01:16 +00:00
parent ff0c2f00c8
commit 3a1b9b6dc6
18 changed files with 402 additions and 337 deletions

View File

@@ -242,9 +242,9 @@ ItemHandlers::UseInField.add(:OLDROD,proc { |item|
pbMessage(_INTL("Can't use that here."))
next 0
end
encounter = $PokemonEncounters.has_encounter_type?(EncounterTypes::OldRod)
encounter = $PokemonEncounters.has_encounter_type?(:OldRod)
if pbFishing(encounter,1)
pbEncounter(EncounterTypes::OldRod)
pbEncounter(:OldRod)
end
next 1
})
@@ -256,9 +256,9 @@ ItemHandlers::UseInField.add(:GOODROD,proc { |item|
pbMessage(_INTL("Can't use that here."))
next 0
end
encounter = $PokemonEncounters.has_encounter_type?(EncounterTypes::GoodRod)
encounter = $PokemonEncounters.has_encounter_type?(:GoodRod)
if pbFishing(encounter,2)
pbEncounter(EncounterTypes::GoodRod)
pbEncounter(:GoodRod)
end
next 1
})
@@ -270,9 +270,9 @@ ItemHandlers::UseInField.add(:SUPERROD,proc { |item|
pbMessage(_INTL("Can't use that here."))
next 0
end
encounter = $PokemonEncounters.has_encounter_type?(EncounterTypes::SuperRod)
encounter = $PokemonEncounters.has_encounter_type?(:SuperRod)
if pbFishing(encounter,3)
pbEncounter(EncounterTypes::SuperRod)
pbEncounter(:SuperRod)
end
next 1
})

View File

@@ -254,20 +254,11 @@ def pbEncounterSpecies(phonenum)
encounter_data = GameData::Encounter.get(phonenum[6], $PokemonGlobal.encounter_version)
return "" if !encounter_data
enc_tables = encounter_data.types
species = pbRandomEncounterSpecies(enc_tables[EncounterTypes::Land])
species = pbRandomEncounterSpecies(enc_tables[:Land])
if !species
species = pbRandomEncounterSpecies(enc_tables[EncounterTypes::Cave])
species = pbRandomEncounterSpecies(enc_tables[:Cave])
if !species
species = pbRandomEncounterSpecies(enc_tables[EncounterTypes::LandDay])
if !species
species = pbRandomEncounterSpecies(enc_tables[EncounterTypes::LandMorning])
if !species
species = pbRandomEncounterSpecies(enc_tables[EncounterTypes::LandNight])
if !species
species = pbRandomEncounterSpecies(enc_tables[EncounterTypes::Water])
end
end
end
species = pbRandomEncounterSpecies(enc_tables[:Water])
end
end
return "" if !species

View File

@@ -150,7 +150,7 @@ end
# Event handlers
################################################################################
EncounterModifier.register(proc { |encounter|
if !EncounterTypes.is_normal_land_type?($PokemonTemp.encounterType) ||
if GameData::EncounterType.get($PokemonTemp.encounterType).type != :land ||
$PokemonGlobal.bicycle || $PokemonGlobal.partner
pbPokeRadarCancel
next encounter