mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-06-02 22:08:36 -05:00
Add December's OMotM: Stat Switch
This commit is contained in:
parent
a843e88c34
commit
c3ae259687
|
|
@ -351,20 +351,12 @@ exports.Formats = [
|
|||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
name: "350 Cup",
|
||||
name: "Stat Switch",
|
||||
section: "OM of the Month",
|
||||
column: 2,
|
||||
|
||||
mod: '350cup',
|
||||
ruleset: ['Ubers', 'Evasion Moves Clause'],
|
||||
banlist: ['Abra', 'Cranidos', 'Darumaka', 'Gastly', 'Pawniard', 'Smeargle', 'Spritzee', 'DeepSeaScale', 'DeepSeaTooth', 'Light Ball', 'Thick Club'],
|
||||
validateSet: function (set) {
|
||||
var template = Tools.getTemplate(set.species);
|
||||
var item = this.getItem(set.item);
|
||||
if (item.name === 'Eviolite' && Object.values(template.baseStats).sum() <= 350) {
|
||||
return ['Eviolite is banned on Pokémon with 350 or lower BST.'];
|
||||
}
|
||||
}
|
||||
mod: 'statswitch',
|
||||
ruleset: ['OU'],
|
||||
banlist: ['Azumarill']
|
||||
},
|
||||
{
|
||||
name: "[Seasonal] Strikes Back",
|
||||
|
|
@ -702,6 +694,22 @@ exports.Formats = [
|
|||
'Omanyte'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "350 Cup",
|
||||
section: "Other Metagames",
|
||||
|
||||
mod: '350cup',
|
||||
searchShow: false,
|
||||
ruleset: ['Ubers', 'Evasion Moves Clause'],
|
||||
banlist: ['Abra', 'Cranidos', 'Darumaka', 'Gastly', 'Pawniard', 'Smeargle', 'Spritzee', 'DeepSeaScale', 'DeepSeaTooth', 'Light Ball', 'Thick Club'],
|
||||
validateSet: function (set) {
|
||||
var template = Tools.getTemplate(set.species);
|
||||
var item = this.getItem(set.item);
|
||||
if (item.name === 'Eviolite' && Object.values(template.baseStats).sum() <= 350) {
|
||||
return ['Eviolite is banned on Pokémon with 350 or lower BST.'];
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Averagemons",
|
||||
section: "Other Metagames",
|
||||
|
|
|
|||
53
mods/statswitch/scripts.js
Normal file
53
mods/statswitch/scripts.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
exports.BattleScripts = {
|
||||
init: function () {
|
||||
var battleFormeIDs = {'Mega':1, 'Mega-X':1, 'Mega-Y':1};
|
||||
// due to a happy coincidence, no other Pokémon having HP as its min xor max stat changes forme in-battle
|
||||
var battleAltFormes = [];
|
||||
for (var i in this.data.Pokedex) {
|
||||
var dexEntry = this.data.Pokedex[i];
|
||||
if (dexEntry.forme in battleFormeIDs) {
|
||||
// should be processed after their base forme is
|
||||
battleAltFormes.push(i);
|
||||
continue;
|
||||
}
|
||||
var maxValue = dexEntry.baseStats[Object.max(dexEntry.baseStats)];
|
||||
var minValue = dexEntry.baseStats[Object.min(dexEntry.baseStats)];
|
||||
|
||||
if (maxValue === minValue) continue;
|
||||
|
||||
var modStats = {};
|
||||
for (var statID in dexEntry.baseStats) {
|
||||
if (dexEntry.baseStats[statID] === maxValue) {
|
||||
modStats[statID] = minValue;
|
||||
} else if (dexEntry.baseStats[statID] === minValue) {
|
||||
modStats[statID] = maxValue;
|
||||
} else {
|
||||
modStats[statID] = dexEntry.baseStats[statID];
|
||||
}
|
||||
}
|
||||
this.modData('Pokedex', i).baseStats = modStats;
|
||||
}
|
||||
// megas inherit the swapped HP from the base forme and ignore it for their own swap
|
||||
for (var i = 0, len = battleAltFormes.length; i < len; i++) {
|
||||
var dexEntry = this.data.Pokedex[battleAltFormes[i]];
|
||||
var swappableStats = Object.reject(dexEntry.baseStats, 'hp');
|
||||
|
||||
var maxValue = swappableStats[Object.max(swappableStats)];
|
||||
var minValue = swappableStats[Object.min(swappableStats)];
|
||||
|
||||
if (maxValue === minValue) continue;
|
||||
|
||||
var modStats = {'hp': this.data.Pokedex[toId(dexEntry.baseSpecies)].baseStats['hp']};
|
||||
for (var statID in swappableStats) {
|
||||
if (swappableStats[statID] === maxValue) {
|
||||
modStats[statID] = minValue;
|
||||
} else if (swappableStats[statID] === minValue) {
|
||||
modStats[statID] = maxValue;
|
||||
} else {
|
||||
modStats[statID] = swappableStats[statID];
|
||||
}
|
||||
}
|
||||
this.modData('Pokedex', battleAltFormes[i]).baseStats = modStats;
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user