mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 21:54:58 +00:00
battle tower stuff
This commit is contained in:
@@ -25,16 +25,20 @@ def pbGetBTTrainers(challengeID)
|
||||
return []
|
||||
end
|
||||
|
||||
def pbGetBTPokemon(challenge_id)
|
||||
customsOnly = !$game_switches[SWITCH_BATTLE_FACTORY_INCLUDE_ALL]
|
||||
if customsOnly
|
||||
return getCustomSpeciesList()
|
||||
end
|
||||
def listAllPokemon
|
||||
list=[]
|
||||
for i in 0..PBSpecies.maxValue
|
||||
list << i
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
def pbGetBTPokemon(challenge_id)
|
||||
customsOnly = !$game_switches[SWITCH_BATTLE_FACTORY_INCLUDE_ALL]
|
||||
if customsOnly
|
||||
return getCustomSpeciesList()
|
||||
end
|
||||
return listAllPokemon
|
||||
|
||||
|
||||
|
||||
@@ -106,12 +110,12 @@ def pbBattleChallengeGraphic(event)
|
||||
bttrainers = pbGetBTTrainers(pbBattleChallenge.currentChallenge)
|
||||
filename = GameData::TrainerType.charset_filename_brief((bttrainers[nextTrainer][0] rescue nil))
|
||||
begin
|
||||
filename = "NPC 01" if nil_or_empty?(filename)
|
||||
filename = "NPCpbAddForeignPokemon 01" if nil_or_empty?(filename)
|
||||
bitmap = AnimatedBitmap.new("Graphics/Characters/" + filename)
|
||||
bitmap.dispose
|
||||
event.character_name = filename
|
||||
rescue
|
||||
event.character_name = "NPC 01"
|
||||
event.character_name = "BWClerk"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -61,20 +61,22 @@ def pbGenerateBattleTrainer(idxTrainer, rules)
|
||||
if pokemonnumbers.length <= rules.ruleset.suggestedNumber
|
||||
for n in pokemonnumbers
|
||||
rndpoke = btpokemon[n]
|
||||
pkmn = rndpoke.createPokemon(level, indvalues, opponent)
|
||||
pkmn = rndpoke.createPokemon(rndpoke,level, indvalues, opponent)
|
||||
opponent.party.push(pkmn)
|
||||
end
|
||||
return opponent
|
||||
end
|
||||
# There are more possible Pokémon than there are spaces available in the
|
||||
# trainer's party; randomly choose Pokémon
|
||||
#
|
||||
minBst = pbGet(VAR_BATTLE_TOWER_MIN_BST)
|
||||
maxBst = pbGet(VAR_BATTLE_TOWER_MAX_BST)
|
||||
loop do
|
||||
opponent.party.clear
|
||||
while opponent.party.length < rules.ruleset.suggestedNumber
|
||||
rnd = pokemonnumbers[rand(pokemonnumbers.length)]
|
||||
rndpoke = btpokemon[rnd]
|
||||
pkmn = rndpoke.createPokemon(level, indvalues, opponent)
|
||||
opponent.party.push(pkmn)
|
||||
rndpoke = getRandomPokemonSpecies(btpokemon,minBst,maxBst)
|
||||
|
||||
opponent.party.push(createPokemon(rndpoke,level, indvalues, nil))
|
||||
end
|
||||
break if rules.ruleset.isValid?(opponent.party)
|
||||
end
|
||||
@@ -169,4 +171,18 @@ def createPokemon(species, level, iv, trainer)
|
||||
GameData::Stat.each_main { |s| pkmn.iv[s.id] = iv }
|
||||
pkmn.calc_stats
|
||||
return pkmn
|
||||
end
|
||||
end
|
||||
|
||||
#list is a list of dex numbers of possible choices
|
||||
def getRandomPokemonSpecies(list=[],minBST=0,maxBST=1000)
|
||||
if list == []
|
||||
list = listAllPokemon
|
||||
end
|
||||
bst=-1
|
||||
while (bst < minBST || bst > maxBST)
|
||||
chosenPokemon = list.sample
|
||||
bst = calcBaseStatsSum(chosenPokemon)
|
||||
end
|
||||
return chosenPokemon
|
||||
end
|
||||
|
||||
|
||||
@@ -9,9 +9,14 @@ class StandardRestriction
|
||||
return true if [:TRUANT, :SLOWSTART].include?(a)
|
||||
end
|
||||
# Certain named species are not banned
|
||||
return true if [:DRAGONITE, :SALAMENCE, :TYRANITAR].include?(pkmn.species)
|
||||
return true if pkmn.isFusionOf(:DRAGONITE)
|
||||
return true if pkmn.isFusionOf(:SALAMENCE)
|
||||
return true if pkmn.isFusionOf(:TYRANITAR)
|
||||
|
||||
# Certain named species are banned
|
||||
return false if [:WYNAUT, :WOBBUFFET].include?(pkmn.species)
|
||||
return false if pkmn.isFusionOf(:WYNAUT)
|
||||
return false if pkmn.isFusionOf(:WOBBUFFET)
|
||||
|
||||
# Species with total base stat 600 or more are banned
|
||||
bst = 0
|
||||
pkmn.baseStats.each_value { |s| bst += s }
|
||||
|
||||
Reference in New Issue
Block a user