wild fusions

This commit is contained in:
infinitefusion
2022-04-30 11:22:01 -04:00
parent 56544412ca
commit ce93ca7919
6 changed files with 529 additions and 495 deletions

View File

@@ -32,7 +32,6 @@ module RPG
end end
def self.need_clearing() def self.need_clearing()
p @cache.size
return @cache.size >= 100 return @cache.size >= 100
end end

View File

@@ -24,16 +24,12 @@ def pbPokerus?
return false return false
end end
class PokemonTemp class PokemonTemp
attr_accessor :batterywarning attr_accessor :batterywarning
attr_accessor :cueBGM attr_accessor :cueBGM
attr_accessor :cueFrames attr_accessor :cueFrames
end end
def pbBatteryLow? def pbBatteryLow?
pstate = System.power_state pstate = System.power_state
# If it's not discharging, it doesn't matter if it's low # If it's not discharging, it doesn't matter if it's low
@@ -68,8 +64,6 @@ Events.onMapUpdate += proc { |_sender,_e|
end end
} }
#=============================================================================== #===============================================================================
# Checks per step # Checks per step
#=============================================================================== #===============================================================================
@@ -191,6 +185,19 @@ Events.onChangeDirection += proc {
pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu
} }
def isFusionForced?
return false if $game_switches[RANDOMIZED_WILD_POKEMON_SWITCH]
return $game_switches[FORCE_FUSE_NEXT_POKEMON_SWITCH] || $game_switches[FORCE_ALL_WILD_FUSIONS_SWITCH]
end
def isFusedEncounter
return false if !FUSED_WILD_POKEMON_SWITCH[35]
return false if $game_switches[RANDOMIZED_WILD_POKEMON_SWITCH]
return true if isFusionForced?()
chance = pbGet(WILD_FUSION_RATE_VAR) == 0 ? 5 : pbGet(WILD_FUSION_RATE_VAR)
return (rand(chance) == 0)
end
def pbBattleOnStepTaken(repel_active) def pbBattleOnStepTaken(repel_active)
return if $Trainer.able_pokemon_count == 0 return if $Trainer.able_pokemon_count == 0
return if !$PokemonEncounters.encounter_possible_here? return if !$PokemonEncounters.encounter_possible_here?
@@ -199,6 +206,14 @@ def pbBattleOnStepTaken(repel_active)
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active) return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
$PokemonTemp.encounterType = encounter_type $PokemonTemp.encounterType = encounter_type
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type) encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
if isFusedEncounter()
encounter_fusedWith = $PokemonEncounters.choose_wild_pokemon(encounter_type)
if encounter[0] != encounter_fusedWith[0]
encounter[0] = getFusionSpecies(encounter[0], encounter_fusedWith[0])
end
end
$game_switches[FORCE_FUSE_NEXT_POKEMON_SWITCH] = false
encounter = EncounterModifier.trigger(encounter) encounter = EncounterModifier.trigger(encounter)
if $PokemonEncounters.allow_encounter?(encounter, repel_active) if $PokemonEncounters.allow_encounter?(encounter, repel_active)
if $PokemonEncounters.have_double_wild_battle? if $PokemonEncounters.have_double_wild_battle?
@@ -215,8 +230,6 @@ def pbBattleOnStepTaken(repel_active)
EncounterModifier.triggerEncounterEnd EncounterModifier.triggerEncounterEnd
end end
#=============================================================================== #===============================================================================
# Checks when moving between maps # Checks when moving between maps
#=============================================================================== #===============================================================================
@@ -307,8 +320,6 @@ Events.onMapSceneChange += proc { |_sender, e|
end end
} }
#=============================================================================== #===============================================================================
# Event locations, terrain tags # Event locations, terrain tags
#=============================================================================== #===============================================================================
@@ -392,8 +403,6 @@ def pbFacingEachOther(event1, event2)
return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1) return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1)
end end
#=============================================================================== #===============================================================================
# Audio playing # Audio playing
#=============================================================================== #===============================================================================
@@ -430,8 +439,6 @@ def pbAutoplayOnSave
end end
end end
#=============================================================================== #===============================================================================
# Event movement # Event movement
#=============================================================================== #===============================================================================
@@ -484,8 +491,6 @@ module PBMoveRoute
ScriptAsync = 101 # 1 param ScriptAsync = 101 # 1 param
end end
def pbMoveRoute(event, commands, waitComplete = false) def pbMoveRoute(event, commands, waitComplete = false)
route = RPG::MoveRoute.new route = RPG::MoveRoute.new
route.repeat = false route.repeat = false
@@ -532,8 +537,6 @@ def pbWait(numFrames)
end end
end end
#=============================================================================== #===============================================================================
# Player/event movement in the field # Player/event movement in the field
#=============================================================================== #===============================================================================
@@ -645,10 +648,14 @@ def pbJumpToward(dist=1,playSound=false,cancelSurf=false)
x = $game_player.x x = $game_player.x
y = $game_player.y y = $game_player.y
case $game_player.direction case $game_player.direction
when 2 then $game_player.jump(0, dist) # down when 2 then
when 4 then $game_player.jump(-dist, 0) # left $game_player.jump(0, dist) # down
when 6 then $game_player.jump(dist, 0) # right when 4 then
when 8 then $game_player.jump(0, -dist) # up $game_player.jump(-dist, 0) # left
when 6 then
$game_player.jump(dist, 0) # right
when 8 then
$game_player.jump(0, -dist) # up
end end
if $game_player.x != x || $game_player.y != y if $game_player.x != x || $game_player.y != y
pbSEPlay("Player jump") if playSound pbSEPlay("Player jump") if playSound
@@ -664,8 +671,6 @@ def pbJumpToward(dist=1,playSound=false,cancelSurf=false)
return false return false
end end
#=============================================================================== #===============================================================================
# Bridges, cave escape points, and setting the heal point # Bridges, cave escape points, and setting the heal point
#=============================================================================== #===============================================================================
@@ -709,8 +714,6 @@ def pbSetPokemonCenter
$PokemonGlobal.pokecenterDirection = $game_player.direction $PokemonGlobal.pokecenterDirection = $game_player.direction
end end
#=============================================================================== #===============================================================================
# Partner trainer # Partner trainer
#=============================================================================== #===============================================================================
@@ -730,8 +733,6 @@ def pbDeregisterPartner
$PokemonGlobal.partner = nil $PokemonGlobal.partner = nil
end end
#=============================================================================== #===============================================================================
# Picking up an item found on the ground # Picking up an item found on the ground
#=============================================================================== #===============================================================================
@@ -774,8 +775,6 @@ def pbItemBall(item,quantity=1,item_name="",canRandom=true)
return false return false
end end
#=============================================================================== #===============================================================================
# Being given an item # Being given an item
#=============================================================================== #===============================================================================

View File

@@ -87,8 +87,9 @@ ItemHandlers::ConfirmUseInField.add(:ESCAPEROPE,proc { |item|
#=============================================================================== #===============================================================================
def pbRepel(item, steps) def pbRepel(item, steps)
message = $game_switches[USED_AN_INCENSE_SWITCH] ? "But an incense's effect still lingers from earlier." : "But a repellent's effect still lingers from earlier."
if $PokemonGlobal.repel > 0 if $PokemonGlobal.repel > 0
pbMessage(_INTL("But a repellent's effect still lingers from earlier.")) pbMessage(_INTL(message))
return 0 return 0
end end
pbUseItemMessage(item) pbUseItemMessage(item)
@@ -96,6 +97,25 @@ def pbRepel(item,steps)
return 3 return 3
end end
def pbIncense(item, steps)
if $PokemonGlobal.repel > 0
pbMessage(_INTL("But a repellent's effect still lingers from earlier."))
return 0
elsif $PokemonGlobal.incense > 0
pbMessage(_INTL("But an incense's effect still lingers from earlier."))
return 0
end
pbUseItemMessage(item)
$PokemonGlobal.incense = steps
return 3
end
ItemHandlers::UseInField.add(:FUSIONREPEL, proc { |item|
$game_switches[FORCE_ALL_WILD_FUSIONS_SWITCH] = true
$game_switches[USED_AN_INCENSE_SWITCH] = true
next pbIncense(item, 50)
})
ItemHandlers::UseInField.add(:REPEL, proc { |item| ItemHandlers::UseInField.add(:REPEL, proc { |item|
next pbRepel(item, 100) next pbRepel(item, 100)
}) })
@@ -112,6 +132,8 @@ Events.onStepTaken += proc {
if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice
$PokemonGlobal.repel -= 1 $PokemonGlobal.repel -= 1
if $PokemonGlobal.repel <= 0 if $PokemonGlobal.repel <= 0
$game_switches[FORCE_ALL_WILD_FUSIONS_SWITCH] = false
$game_switches[USED_AN_INCENSE_SWITCH] = false
if $PokemonBag.pbHasItem?(:REPEL) || if $PokemonBag.pbHasItem?(:REPEL) ||
$PokemonBag.pbHasItem?(:SUPERREPEL) || $PokemonBag.pbHasItem?(:SUPERREPEL) ||
$PokemonBag.pbHasItem?(:MAXREPEL) $PokemonBag.pbHasItem?(:MAXREPEL)
@@ -121,7 +143,7 @@ Events.onStepTaken += proc {
scene = PokemonBag_Scene.new scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $PokemonBag) screen = PokemonBagScreen.new(scene, $PokemonBag)
ret = screen.pbChooseItemScreen(Proc.new { |item| ret = screen.pbChooseItemScreen(Proc.new { |item|
[:REPEL, :SUPERREPEL, :MAXREPEL].include?(item) [:REPEL, :SUPERREPEL, :MAXREPEL, :FUSIONREPEL].include?(item)
}) })
} }
pbUseItem($PokemonBag, ret) if ret pbUseItem($PokemonBag, ret) if ret
@@ -282,7 +304,8 @@ ItemHandlers::UseInField.add(:ITEMFINDER,proc { |item|
end end
pbWait(Graphics.frame_rate * 3 / 10) pbWait(Graphics.frame_rate * 3 / 10)
pbMessage(_INTL("The {1}'s indicating something right underfoot!", GameData::Item.get(item).name)) pbMessage(_INTL("The {1}'s indicating something right underfoot!", GameData::Item.get(item).name))
else # Item is nearby, face towards it else
# Item is nearby, face towards it
direction = $game_player.direction direction = $game_player.direction
if offsetX.abs > offsetY.abs if offsetX.abs > offsetY.abs
direction = (offsetX < 0) ? 4 : 6 direction = (offsetX < 0) ? 4 : 6
@@ -290,10 +313,14 @@ ItemHandlers::UseInField.add(:ITEMFINDER,proc { |item|
direction = (offsetY < 0) ? 8 : 2 direction = (offsetY < 0) ? 8 : 2
end end
case direction case direction
when 2 then $game_player.turn_down when 2 then
when 4 then $game_player.turn_left $game_player.turn_down
when 6 then $game_player.turn_right when 4 then
when 8 then $game_player.turn_up $game_player.turn_left
when 6 then
$game_player.turn_right
when 8 then
$game_player.turn_up
end end
pbWait(Graphics.frame_rate * 3 / 10) pbWait(Graphics.frame_rate * 3 / 10)
pbMessage(_INTL("Huh? The {1}'s responding!\1", GameData::Item.get(item).name)) pbMessage(_INTL("Huh? The {1}'s responding!\1", GameData::Item.get(item).name))
@@ -936,7 +963,6 @@ ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE,proc { |item,pkmn,scene|
next true next true
}) })
ItemHandlers::UseOnPokemon.add(:NSOLARIZER, proc { |item, pkmn, scene| ItemHandlers::UseOnPokemon.add(:NSOLARIZER, proc { |item, pkmn, scene|
if !pkmn.isSpecies?(:NECROZMA) || pkmn.form == 2 if !pkmn.isSpecies?(:NECROZMA) || pkmn.form == 2
scene.pbDisplay(_INTL("It had no effect.")) scene.pbDisplay(_INTL("It had no effect."))

View File

@@ -56,3 +56,11 @@ SINGLE_POKEMON_MODE_BODY_SWITCH=792
SINGLE_POKEMON_MODE_RANDOM_SWITCH=793 SINGLE_POKEMON_MODE_RANDOM_SWITCH=793
FISHING_AUTOHOOK_SWITCH = 916 FISHING_AUTOHOOK_SWITCH = 916
ODDKEYSTONE_NB_VARIABLE=252 ODDKEYSTONE_NB_VARIABLE=252
RANDOMIZED_WILD_POKEMON_SWITCH=953
FUSED_WILD_POKEMON_SWITCH=35
FORCE_FUSE_NEXT_POKEMON_SWITCH=37
FORCE_ALL_WILD_FUSIONS_SWITCH=828
USED_AN_INCENSE_SWITCH=798
WILD_FUSION_RATE_VAR=210

View File

@@ -208,7 +208,9 @@ def getEvolution(species, halfToEvolve=nil)
end end
def getFusionSpecies(body, head) def getFusionSpecies(body, head)
id = body * Settings::NB_POKEMON + head body_num = dexNum(body)
head_num = dexNum(head)
id = body_num * Settings::NB_POKEMON + head_num
return GameData::Species.get(id).species return GameData::Species.get(id).species
end end

Binary file not shown.