pokemon-showdown/mods/gen3/scripts.js
Guangcong Luo 1a75beb806 Damage category refactor for gen 3
Damage categories are now read using .getCategory, which gen 3 overrides.

move.category can still be read directly to check if something's a status
move, but it should never be used for reading damage categories.

This also fixes a crash in gen 3 and makes it playable again.
2013-03-08 08:36:14 -08:00

30 lines
898 B
JavaScript

exports.BattleScripts = {
gen: 3,
init: function() {
for (var i in this.data.Pokedex) {
var template = this.getTemplate(i);
if (template.gen > 3) template.isNonstandard = true;
delete template.abilities['DW'];
}
for (var i in this.data.Movedex) {
var move = this.getMove(i);
if (move.gen > 3) move.isNonstandard = true;
}
for (var i in this.data.Abilities) {
var ability = this.getAbility(i);
if (ability.gen > 3) ability.isNonstandard = true;
}
for (var i in this.data.Items) {
var item = this.getItem(i);
if (item.gen > 3) item.isNonstandard = true;
}
},
getCategory: function(move) {
move = this.getMove(move);
// overwrite categories
var specialTypes = {Fire:1, Water:1, Grass:1, Ice:1, Electric:1, Dark:1, Psychic:1, Dragon:1};
if (move.category === 'Status') return 'Status';
return specialTypes[move.type]?'Special':'Physical';
}
};