From 9b7e0f07ab0e99e41ba7657ab4db2bc4e5f6ba64 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Wed, 17 Apr 2013 22:19:39 -0700 Subject: [PATCH] Namespace StatNames/StatIDs --- js/battledata.js | 6 +++--- js/teambuilder.js | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/js/battledata.js b/js/battledata.js index a73e97969..59ace7e65 100644 --- a/js/battledata.js +++ b/js/battledata.js @@ -266,7 +266,7 @@ var BattleNatures = { minus: 'atk' } }; -var StatIDs = { +var BattleStatIDs = { HP: 'hp', hp: 'hp', Atk: 'atk', @@ -285,7 +285,7 @@ var StatIDs = { Spd: 'spe', spe: 'spe' }; -var POStatNames = { // PO style +var BattlePOStatNames = { // PO style hp: 'HP', atk: 'Atk', def: 'Def', @@ -293,7 +293,7 @@ var POStatNames = { // PO style spd: 'SDef', spe: 'Spd' }; -var StatNames = { // proper style +var BattleStatNames = { // proper style hp: 'HP', atk: 'Atk', def: 'Def', diff --git a/js/teambuilder.js b/js/teambuilder.js index f949efae7..d8d8510ea 100644 --- a/js/teambuilder.js +++ b/js/teambuilder.js @@ -194,7 +194,7 @@ function Teambuilder(id, elem) text += '
'; @@ -918,9 +918,9 @@ function Teambuilder(id, elem) guessedMinus = guessedEVs.minusStat; delete guessedEVs.minusStat; text += '
'; + text += ' (+'+BattleStatNames[guessedPlus]+', -'+BattleStatNames[guessedMinus]+')'; text += '
('+role+' | bulk: phys '+Math.round(selfR.moveCount.physicalBulk/1000)+' + spec '+Math.round(selfR.moveCount.specialBulk/1000)+' = '+Math.round(selfR.moveCount.bulk/1000)+')

'; } @@ -1014,7 +1014,7 @@ function Teambuilder(id, elem) text += ''; } @@ -1039,7 +1039,7 @@ function Teambuilder(id, elem) selfR.minus = ''; } nature = BattleNatures[set.nature||'Serious']; - for (var i in StatNames) + for (var i in BattleStatNames) { var val = ''+(set.evs[i]||''); if (nature.plus === i) @@ -1122,7 +1122,7 @@ function Teambuilder(id, elem) $('#'+selfR.id+'-nature').val(set.nature||'Serious'); text = ' EV'; - for (var j in StatNames) + for (var j in BattleStatNames) { var ev = ''+(set.evs[j] || '')+''; if (BattleNatures[set.nature] && BattleNatures[set.nature].plus === j) @@ -1138,7 +1138,7 @@ function Teambuilder(id, elem) if (width>75) width = 75; var color = Math.floor(stats[j]*180/714); if (color>360) color = 360; - text += ' '+ev+''; + text += ' '+ev+''; } $('#'+selfR.id+'-setstats').html(text); }; @@ -1608,7 +1608,7 @@ function Teambuilder(id, elem) var evLine = $.trim(evLines[j]); var spaceIndex = evLine.indexOf(' '); if (spaceIndex === -1) continue; - var statid = StatIDs[evLine.substr(spaceIndex+1)]; + var statid = BattleStatIDs[evLine.substr(spaceIndex+1)]; var statval = parseInt(evLine.substr(0, spaceIndex)); if (!statid) continue; curSet.evs[statid] = statval; @@ -1622,7 +1622,7 @@ function Teambuilder(id, elem) var ivLine = ivLines[j]; var spaceIndex = ivLine.indexOf(' '); if (spaceIndex === -1) continue; - var statid = StatIDs[ivLine.substr(spaceIndex+1)]; + var statid = BattleStatIDs[ivLine.substr(spaceIndex+1)]; var statval = parseInt(ivLine.substr(0, spaceIndex)); if (!statid) continue; curSet.ivs[statid] = statval; @@ -1711,7 +1711,7 @@ function Teambuilder(id, elem) { text += ' / '; } - text += ''+curSet.evs[j]+' '+POStatNames[j]; + text += ''+curSet.evs[j]+' '+BattlePOStatNames[j]; } if (!first) { @@ -1732,7 +1732,7 @@ function Teambuilder(id, elem) if (move.substr(0,13) === 'Hidden Power ' && move.substr(0,14) !== 'Hidden Power [') { hpType = move.substr(13); - for (var stat in StatNames) + for (var stat in BattleStatNames) { if (curSet.ivs[stat] !== exports.BattleTypeChart[hpType].HPivs[stat]) { @@ -1748,7 +1748,7 @@ function Teambuilder(id, elem) } if (defaultIvs && !hpType) { - for (var stat in StatNames) + for (var stat in BattleStatNames) { if (curSet.ivs[stat] !== 31 && typeof curSet.ivs[stat] !== undefined) { @@ -1771,7 +1771,7 @@ function Teambuilder(id, elem) { text += ' / '; } - text += ''+curSet.ivs[stat]+' '+POStatNames[stat]; + text += ''+curSet.ivs[stat]+' '+BattlePOStatNames[stat]; } } }