Finished random battle scripts

This commit is contained in:
Deukhoofd 2016-05-07 16:42:07 +02:00
parent 15399ec68a
commit fe547a9c8f
3 changed files with 269 additions and 33 deletions

File diff suppressed because one or more lines are too long

View File

@ -12048,6 +12048,14 @@
"pokeBattleValue": 1001,
"tier": [
"Uber"
],
"randomMoves": [
"Swords Dance",
"Substitute",
"Sucker Punch",
"Iron Head",
"Brick Break",
"Knock Off"
]
}
},
@ -14490,6 +14498,14 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Swords Dance",
"Spikes",
"Sucker Punch",
"Seed Bomb",
"Drain Punch",
"Substitute"
]
}
},
@ -19560,6 +19576,14 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Dragon Dance",
"Crabhammer",
"Superpower",
"Swords Dance",
"Knock Off",
"Aqua Jet"
]
}
},
@ -23110,6 +23134,14 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Stealth Rock",
"Rapid Spin",
"Ice Shard",
"Earthquake",
"Knock Off",
"Stone Edge"
]
}
},
@ -25945,6 +25977,17 @@
"pokeBattleValue": 120,
"tier": [
"NU"
],
"randomMoves": [
"Flare Blitz",
"Hydro Pump",
"Thunderbolt",
"Psychic",
"Foul Play",
"Leaf Blade",
"Ice Beam",
"Moonblast",
"Wish"
]
},
"mega-water": {
@ -25966,7 +26009,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
},
"mega-electric": {
@ -25988,7 +26031,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
},
"mega-fire": {
@ -26010,7 +26053,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
},
"mega-psychic": {
@ -26032,7 +26075,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
},
"mega-dark": {
@ -26054,7 +26097,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
},
"mega-grass": {
@ -26076,7 +26119,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
},
"mega-ice": {
@ -26098,7 +26141,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
},
"mega-fairy": {
@ -26120,7 +26163,7 @@
"weight": 65,
"pokeBattleValue": 190,
"tier": [
"OU"
"NU"
]
}
},
@ -28733,6 +28776,15 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Aqua Jet",
"Waterfall",
"Crunch",
"Ice Punch",
"Dragon Dance",
"Swords Dance",
"Earthquake"
]
}
},
@ -29995,6 +30047,17 @@
"pokeBattleValue": 1001,
"tier": [
"Uber"
],
"randomMoves": [
"Drakon Voice",
"Ancient Roar",
"Bug Buzz",
"Roost",
"Boomburst",
"Uproar",
"Sandstorm",
"Fire Blast",
"Defog"
]
},
"armor": {
@ -30019,6 +30082,16 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Earthquake",
"Outrage",
"U-turn",
"Roost",
"Stone Edge",
"Fire Punch",
"Fire Blast",
"Defog"
]
}
},
@ -32858,6 +32931,15 @@
"pokeBattleValue": 120,
"tier": [
"NU"
],
"randomMoves": [
"Crunch",
"Fire Fang",
"Ice Fang",
"Thunder Fang",
"Nasty Plot",
"Baton Pass",
"Hyper Fang"
]
}
},
@ -35188,6 +35270,17 @@
"pokeBattleValue": 135,
"tier": [
"UU"
],
"randomMoves": [
"Psychic",
"Thunderbolt",
"Shadow Ball",
"Hidden Power Fire",
"Hidden Power Fighting",
"Substitute",
"Calm Mind",
"Trick",
"Psyshock"
]
}
},
@ -46141,6 +46234,14 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Sticky Web",
"Swords Dance",
"Leaf Blade",
"X-Scissor",
"Knock Off",
"Baton Pass"
]
}
},
@ -49426,6 +49527,17 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Recover",
"Lava Plume",
"Toxic",
"Hidden Power Grass",
"Stealth Rock",
"Fire Blast",
"Earth Power",
"Shell Smash",
"AncientPower"
]
}
},
@ -51549,6 +51661,15 @@
"pokeBattleValue": 130,
"tier": [
"UU"
],
"randomMoves": [
"Bonemerang",
"Earthquake",
"Knock Off",
"Double-Edge",
"Stone Edge",
"Stealth Rock",
"Substitute"
]
}
},
@ -52368,6 +52489,16 @@
"unreleased": true,
"tier": [
"OU"
],
"randomMoves": [
"Reflect",
"Light Screen",
"Aromatherapy",
"Leech Seed",
"Toxic",
"Giga Drain",
"Synthesis",
"Dragon Tail"
]
}
},
@ -54258,6 +54389,15 @@
"unreleased": true,
"tier": [
"OU"
],
"randomMoves": [
"Recover",
"Scald",
"Toxic",
"Ice Beam",
"Dragon Tail",
"Rest",
"Sleep Talk"
]
}
},
@ -54414,6 +54554,15 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Milk Drink",
"Stealth Rock",
"Body Slam",
"Heal Bell",
"Curse",
"Earthquake",
"Toxic"
]
}
},
@ -66769,6 +66918,15 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Calm Mind",
"Recover",
"Psychic",
"Focus Blast",
"Shadow Ball",
"Trick Room",
"Psyshock"
]
}
},
@ -72159,6 +72317,15 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Leaf Storm",
"Swords Dance",
"Leaf Blade",
"Sucker Punch",
"Defog",
"Low Kick",
"Knock Off"
]
}
},
@ -76695,6 +76862,14 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"New Moon",
"Sucker Punch",
"Phantom Force",
"Dream Eater",
"Hypnosis",
"Curse"
]
}
},
@ -78099,6 +78274,15 @@
"pokeBattleValue": 135,
"tier": [
"UU"
],
"randomMoves": [
"Discharge",
"Earth Power",
"Scald",
"Toxic",
"Rest",
"Sleep Talk",
"Stealth Rock"
]
}
},
@ -83823,6 +84007,13 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Eruption",
"Fire Blast",
"Hidden Power Grass",
"Extrasensory",
"Focus Blast"
]
}
},
@ -84027,6 +84218,15 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Crunch",
"Stone Edge",
"Pursuit",
"Earthquake",
"Fire Blast",
"Ice Beam",
"Stealth Rock"
]
}
},
@ -90474,6 +90674,13 @@
"pokeBattleValue": 190,
"tier": [
"OU"
],
"randomMoves": [
"Volt Switch",
"Hidden Power Grass",
"Overheat",
"Wild Charge",
"Thunderbolt"
]
}
},
@ -90623,6 +90830,16 @@
"pokeBattleValue": 190,
"tier": [
"Uber"
],
"randomMoves": [
"Bolt Strike",
"Outrage",
"Dragon Claw",
"Draco Meteor",
"Volt Switch",
"Hone Claws",
"Substitute",
"Roost"
]
}
},
@ -90888,6 +91105,16 @@
"pokeBattleValue": 135,
"tier": [
"UU"
],
"randomMoves": [
"Sucker Punch",
"Dark Pulse",
"Focus Blast",
"Flamethrower",
"U-turn",
"Nasty Plot",
"Knock Off",
"Trick"
]
}
},

View File

@ -45,7 +45,7 @@ createTeam = (format, requs, next) ->
return
getPokemonArr = ->
if pokemonArr.length < 6
generatePokemon list, generation, (pkmn) ->
generatePokemon list, generation, requs, (pkmn) ->
pokemonArr.push(pkmn)
getPokemonArr()
getPokemonArr()
@ -72,7 +72,7 @@ getValidFormes = (generation, tier, next) ->
next(filteredlist)
generatePokemon = (list, generation, next) ->
generatePokemon = (list, generation, requs, next) ->
tryGenerate = ->
#Generate a random pokemon
@ -88,6 +88,11 @@ generatePokemon = (list, generation, next) ->
tryGenerate()
return
#Special code for mega eevee, we need the data for the default
if pokemon.Name is "Eevee" and /mega-/.test(pokemon.Forme)
Obj.forme = "mega"
pokemon = gen.GenerationJSON[generation].FormeData[pokemon.Name]["mega"]
Obj = {}
Obj.species = pokemon.Name
#Generate moves through different function
@ -113,9 +118,11 @@ generatePokemon = (list, generation, next) ->
if itemdata.itemForme[0] is pokemon.Name and itemdata.itemForme[1] is pokemon.Forme
Obj.item = item
break
Obj.forme = "default"
pokemon = gen.GenerationJSON[generation].FormeData[pokemon.Name]["default"]
if !pokemon.isItemBased
Obj.forme = "default"
pokemon = gen.GenerationJSON[generation].FormeData[pokemon.Name]["default"] if !pokemon.isItemBased
else
Obj.forme = pokemon.Forme
else
Obj.forme = pokemon.Forme
@ -147,37 +154,39 @@ generatePokemon = (list, generation, next) ->
integer = integer + 1
Obj.ivs = determineIVs(hiddenPower)
err = require('./conditions').validatePokemon(requs, Obj, gen.GenerationJSON[generation], "")
if err > 0
console.log(err)
tryGenerate()
return
next(Obj)
tryGenerate()
generateMoves = (possibleMoves) ->
movesArr = []
while movesArr.length < 4
if movesArr.length is 0
generateMove = ->
if movesArr.length < 4
moveIndex = Math.floor(Math.random() * (possibleMoves.length))
movesArr.push(possibleMoves[moveIndex])
else
generateMove = ->
moveIndex = Math.floor(Math.random() * (possibleMoves.length))
movename = possibleMoves[moveIndex]
#We reject the move if it's not defined
if typeof movename == "undefined"
movename = possibleMoves[moveIndex]
#We reject the move if it's not defined
if typeof movename == "undefined"
generateMove()
return
#We reject the move if we aleady have it
for movething in movesArr
if movething is movename
generateMove()
return
#We reject the move if we aleady have it
#We reject the move if we already have Hidden Power
if /Hidden Power/.test(movename)
for movething in movesArr
if movething is movename
if /Hidden Power/.test(movething)
generateMove()
return
#We reject the move if we already have Hidden Power
if /Hidden Power/.test(movename)
for movething in movesArr
if /Hidden Power/.test(movething)
generateMove()
return
movesArr.push(movename)
movesArr.push(movename)
generateMove()
movesArr.splice(4)
generateMove()
movesArr.splice(4) #Hey man, just in case. Fucking async languages.
return movesArr
determineIVs = (type) ->