mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
randomizer - wild Pokémon
This commit is contained in:
@@ -4,13 +4,6 @@ module OptionTypes
|
||||
end
|
||||
|
||||
class RandomizerOptionsScene < PokemonOption_Scene
|
||||
RANDOM_WILD = 778
|
||||
RANDOM_TRAINERS = 987
|
||||
RANDOM_STARTERS = 954
|
||||
RANDOM_ITEMS = 958
|
||||
RANDOM_TMS = 959
|
||||
|
||||
|
||||
def initialize
|
||||
super
|
||||
@openTrainerOptions = false
|
||||
@@ -29,45 +22,45 @@ class RandomizerOptionsScene < PokemonOption_Scene
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = [
|
||||
EnumOption.new(_INTL("Starters"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[RANDOM_STARTERS] ? 0 : 1 },
|
||||
proc { $game_switches[SWITCH_RANDOM_STARTERS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[RANDOM_STARTERS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_STARTERS] = value == 0
|
||||
}
|
||||
),
|
||||
|
||||
EnumOption.new(_INTL("Trainers"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[RANDOM_TRAINERS] ? 0 : 1 },
|
||||
proc { $game_switches[SWITCH_RANDOM_TRAINERS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
if !$game_switches[RANDOM_TRAINERS] && value == 0
|
||||
if !$game_switches[SWITCH_RANDOM_TRAINERS] && value == 0
|
||||
@openTrainerOptions = true
|
||||
openTrainerOptionsMenu()
|
||||
end
|
||||
$game_switches[RANDOM_TRAINERS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_TRAINERS] = value == 0
|
||||
}
|
||||
),
|
||||
|
||||
EnumOption.new(_INTL("Wild Pokémon"), [_INTL("On"), _INTL("Off")],
|
||||
proc {
|
||||
$game_switches[RANDOM_WILD] ? 0 : 1
|
||||
$game_switches[SWITCH_RANDOM_WILD] ? 0 : 1
|
||||
},
|
||||
proc { |value|
|
||||
if !$game_switches[RANDOM_WILD] && value == 0
|
||||
if !$game_switches[SWITCH_RANDOM_WILD] && value == 0
|
||||
@openWildOptions = true
|
||||
openWildPokemonOptionsMenu()
|
||||
end
|
||||
$game_switches[RANDOM_WILD] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_WILD] = value == 0
|
||||
}
|
||||
),
|
||||
EnumOption.new(_INTL("Items"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[RANDOM_ITEMS] ? 0 : 1 },
|
||||
proc { $game_switches[SWITCH_RANDOM_ITEMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[RANDOM_ITEMS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_ITEMS] = value == 0
|
||||
}
|
||||
),
|
||||
EnumOption.new(_INTL("TMs"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[RANDOM_TMS] ? 0 : 1 },
|
||||
proc { $game_switches[SWITCH_RANDOM_TMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[RANDOM_TMS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_TMS] = value == 0
|
||||
}
|
||||
),
|
||||
]
|
||||
@@ -226,6 +219,12 @@ class RandomizerWildPokemonOptionsScene < PokemonOption_Scene
|
||||
$game_switches[REGULAR_TO_FUSIONS] = value == 0
|
||||
}
|
||||
),
|
||||
EnumOption.new(_INTL("Custom sprites only"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] = value == 0
|
||||
}
|
||||
)
|
||||
]
|
||||
return options
|
||||
end
|
||||
|
||||
@@ -17,11 +17,10 @@ end
|
||||
# randomizer shuffle
|
||||
# ##############
|
||||
def Kernel.pbShuffleDex(range=50,type=0)
|
||||
$game_switches[855] = true # Randomized at least once
|
||||
$game_switches[SWITCH_RANDOMIZED_AT_LEAST_ONCE] = true
|
||||
|
||||
#type 0: BST
|
||||
#type 1: full random
|
||||
#type: 2 by route (not implemented)
|
||||
range = 1 if range == 0
|
||||
# create hash
|
||||
psuedoHash = Hash.new
|
||||
@@ -55,15 +54,18 @@ def Kernel.pbShuffleDex(range=50,type=0)
|
||||
#BST in the same 100 range
|
||||
|
||||
|
||||
for i in 1..NB_POKEMON-1#pas de arceus
|
||||
baseStats=$pkmn_dex[i][5]
|
||||
for i in 1..NB_POKEMON-1
|
||||
baseStats=getBaseStatsFormattedForRandomizer(i)
|
||||
baseStat_target = 0
|
||||
for k in 0...baseStats.length
|
||||
baseStat_target+=baseStats[k]
|
||||
end
|
||||
baseStat_target = (baseStat_target/range).floor
|
||||
for j in 1...pokeArrayRand.length
|
||||
baseStats=$pkmn_dex[pokeArrayRand[j]][5]
|
||||
if $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] && !customSpriteExists(pokeArrayRand[j])
|
||||
next
|
||||
end
|
||||
baseStats=getBaseStatsFormattedForRandomizer(pokeArrayRand[j])
|
||||
baseStat_temp = 0
|
||||
for l in 0...baseStats.length
|
||||
baseStat_temp+=baseStats[l]
|
||||
@@ -81,7 +83,6 @@ def Kernel.pbShuffleDex(range=50,type=0)
|
||||
n = (i.to_f/NB_POKEMON)*100
|
||||
Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^",sprintf('%.2f', n),NB_POKEMON))
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -111,6 +112,19 @@ def Kernel.raisePartyHappiness(increment)
|
||||
|
||||
end
|
||||
|
||||
#Randomizer code is shit. Too lazy to redo it.
|
||||
# Here is a cheap workaround lol
|
||||
def getBaseStatsFormattedForRandomizer(dex_num)
|
||||
statsArray=[]
|
||||
stats = GameData::Species.get(dex_num).base_stats
|
||||
statsArray << stats[:HP]
|
||||
statsArray << stats[:ATTACK]
|
||||
statsArray << stats[:DEFENSE]
|
||||
statsArray << stats[:SPECIAL_ATTACK]
|
||||
statsArray << stats[:SPECIAL_DEFENSE]
|
||||
statsArray << stats[:SPEED]
|
||||
return statsArray
|
||||
end
|
||||
|
||||
def Kernel.pbShuffleDexTrainers()
|
||||
# create hash
|
||||
@@ -141,14 +155,14 @@ def Kernel.pbShuffleDexTrainers()
|
||||
#Kernel.pbMessage(_INTL("\\ts[]Shuffling...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue))
|
||||
end
|
||||
|
||||
baseStats=$pkmn_dex[i][I]
|
||||
baseStats=calcBaseStats(i)
|
||||
baseStat_target = 0
|
||||
for k in 0...baseStats.length
|
||||
baseStat_target+=baseStats[k]
|
||||
end
|
||||
baseStat_target = (baseStat_target/50).floor
|
||||
for j in 1...pokeArrayRand.length
|
||||
baseStats=$pkmn_dex[pokeArrayRand[j]][5]
|
||||
baseStats=calcBaseStats([pokeArrayRand[j]])
|
||||
baseStat_temp = 0
|
||||
for l in 0...baseStats.length
|
||||
baseStat_temp+=baseStats[l]
|
||||
@@ -166,4 +180,10 @@ def Kernel.pbShuffleDexTrainers()
|
||||
#add hashes to global data0
|
||||
#$PokemonGlobal.psuedoHash = psuedoHash
|
||||
$PokemonGlobal.pseudoBSTHashTrainers = psuedoBSTHash
|
||||
end
|
||||
|
||||
def getRandomizedTo(species)
|
||||
return species if !$PokemonGlobal.psuedoBSTHash
|
||||
return $PokemonGlobal.psuedoBSTHash[dexNum(species)]
|
||||
# code here
|
||||
end
|
||||
Reference in New Issue
Block a user