Also for adding the stats may I suggest to keep track of the data using js. The reason for that is that it will become a lot easyier to rebuild the stats in the future and possible generate guides or wikia data for it. Here's a small example:
Code:ignoreCaps = (string1, string2) => string1.toUpperCase() === string2.toUpperCase() ? string2 : ""; data = { fighters: { categories: ["Starting", "Early", "Average", "Semi-Pseudo", "Pseudo-legendary", "Legendary", "Mythical"], stats: ["hp", "atk", "def", "spd", "satk", "sdef"], content: {} } }; addFighter = (name, category, hp, atk, def, spd, satk, sdef) => { data.fighters.content[name] = {}; data.fighters.content[name].name = name; data.fighters.content[name].category = (() => { var e; for (e in data.fighters.categories) { e = ignoreCaps(category, data.fighters.categories[e]); if (e != "") return ignoreCaps(category, e); } if (e === "") return "Unknown"; })(); data.fighters.content[name].stat = {}; data.fighters.content[name].stat.hp = hp data.fighters.content[name].stat.atk = atk data.fighters.content[name].stat.def = def data.fighters.content[name].stat.spd = spd data.fighters.content[name].stat.satk = satk data.fighters.content[name].stat.sdef = sdef };
When the "addFighter" function is compleetly setup the data can be added with one simple line. Currently that's:
Code:addFighter("Kid Goku", "Starting", 45, 49, 49, 45, 65, 65);
With all the data stored in a object you can convert it pretty much to anything. Here's a conversion function that alerts part of the pokémon essentials data:
Code:printFighter = (name) => { var esName = "Name=" + data.fighters.content[name].name; //InternalName=BULBASAUR //Type1=GRASS //Type2=POISON var esStats = "BaseStats="; for (var i in data.fighters.stats) { var stat = data.fighters.stats[i]; esStats += data.fighters.content[name].stat[stat]; if (i != data.fighters.stats.length - 1) esStats += ","; } alert(esName + "\n" + "InternalName=BULBASAUR" + "\n" + "Type1=GRASS" + "\n" + "Type2=POISON" + "\n" + esStats); };
When the "printFighter" function is compleetly setup the data can be printed with one simple line. Currently that's:
Code:printFighter("Kid Goku");
Right now it alert the following content:
[S-HIGHLIGHT]Name=Kid Goku
InternalName=BULBASAUR
Type1=GRASS
Type2=POISON
BaseStats=45,49,49,45,65,65[/S-HIGHLIGHT]
Actually I already have all the fighter entries, all that is missing are the stats, using js only for that may be too much... I'll decide what to do!
Last edited: