Skip to content

Commit

Permalink
Add more Retro OMs
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisXV committed Mar 20, 2021
1 parent ff56f7e commit 3f5ef2e
Show file tree
Hide file tree
Showing 4 changed files with 281 additions and 0 deletions.
93 changes: 93 additions & 0 deletions config/formats.ts
Expand Up @@ -1981,6 +1981,99 @@ export const Formats: FormatList = [
'Arena Trap', 'Contrary', 'Huge Power', 'Illusion', 'Innards Out', 'Magnet Pull', 'Moody', 'Parental Bond', 'Protean', 'Psychic Surge', 'Pure Power', 'Shadow Tag', 'Stakeout', 'Water Bubble', 'Wonder Guard',
],
},
{
name: "[Gen 7] Mix and Mega",
desc: `Mega Stones and Primal Orbs can be used on almost any Pokémon with no Mega Evolution limit.`,
threads: [
`&bullet; <a href="">USM Mix and Mega</a>`,
],

mod: 'mixandmega7',
ruleset: ['Standard', 'Mega Rayquaza Clause'],
banlist: ['Shadow Tag', 'Gengarite', 'Baton Pass', 'Electrify'],
restricted: [
'Arceus', 'Deoxys', 'Dialga', 'Dragonite', 'Giratina', 'Groudon', 'Ho-Oh', 'Kyogre', 'Kyurem', 'Landorus-Therian', 'Lugia',
'Lunala', 'Marshadow', 'Mewtwo', 'Naganadel', 'Necrozma', 'Palkia', 'Pheromosa', 'Rayquaza', 'Regigigas', 'Reshiram', 'Shuckle',
'Slaking', 'Solgaleo', 'Xerneas', 'Yveltal', 'Zekrom',
'Beedrillite', 'Blazikenite', 'Kangaskhanite', 'Mawilite', 'Medichamite', 'Pidgeotite', 'Ultranecrozium Z',
],
unbanlist: ['Deoxys-Defense', 'Kyurem-Base', 'Necrozma-Base'],
onValidateTeam(team) {
const itemTable = new Set<ID>();
for (const set of team) {
const item = this.dex.getItem(set.item);
if (!item.exists) continue;
if (itemTable.has(item.id) && (item.megaStone || item.onPrimal)) {
return [
`You are limited to one of each Mega Stone and Primal Orb.`,
`(You have more than one ${item.name}.)`,
];
}
itemTable.add(item.id);
}
},
onValidateSet(set) {
const species = this.dex.getSpecies(set.species);
const item = this.dex.getItem(set.item);
if (!item.megaEvolves && !item.onPrimal && item.id !== 'ultranecroziumz') return;
if (species.baseSpecies === item.megaEvolves || (item.onPrimal && item.itemUser?.includes(species.baseSpecies)) ||
(species.name.startsWith('Necrozma-') && item.id === 'ultranecroziumz')) {
return;
}
if (this.ruleTable.isRestricted(`item:${item.id}`) || this.ruleTable.isRestrictedSpecies(species) ||
set.ability === 'Power Construct') {
return [`${set.species} is not allowed to hold ${item.name}.`];
}
},
onBegin() {
for (const pokemon of this.getAllPokemon()) {
pokemon.m.originalSpecies = pokemon.baseSpecies.name;
}
},
onSwitchIn(pokemon) {
// @ts-ignore
const oMegaSpecies = this.dex.getSpecies(pokemon.species.originalMega);
if (oMegaSpecies.exists && pokemon.m.originalSpecies !== oMegaSpecies.baseSpecies) {
this.add('-start', pokemon, oMegaSpecies.requiredItem || oMegaSpecies.requiredMove, '[silent]');
const oSpecies = this.dex.getSpecies(pokemon.m.originalSpecies);
if (oSpecies.types.length !== pokemon.species.types.length || oSpecies.types[1] !== pokemon.species.types[1]) {
this.add('-start', pokemon, 'typechange', pokemon.species.types.join('/'), '[silent]');
}
}
},
onSwitchOut(pokemon) {
// @ts-ignore
const oMegaSpecies = this.dex.getSpecies(pokemon.species.originalMega);
if (oMegaSpecies.exists && pokemon.m.originalSpecies !== oMegaSpecies.baseSpecies) {
this.add('-start', pokemon, oMegaSpecies.requiredItem || oMegaSpecies.requiredMove, '[silent]');
}
},
},
{
name: "[Gen 7] STABmons",
desc: `Pok&eacute;mon can use any move of their typing, in addition to the moves they can normally learn.`,
threads: [
`&bullet; <a href="https://www.smogon.com/forums/posts/8697545/">USM STABmons</a>`,
],

mod: 'gen7',
ruleset: ['[Gen 7] OU', 'STABmons Move Legality'],
banlist: ['Aerodactyl', 'Aerodactyl-Mega', 'Araquanid', 'Blacephalon', 'Kartana', 'Komala', 'Kyurem-Black', 'Porygon-Z', 'Silvally', 'Tapu Koko', 'Tapu Lele', 'Thundurus', 'Thundurus-Therian', 'King\'s Rock', 'Razor Fang'],
restricted: ['Acupressure', 'Belly Drum', 'Chatter', 'Extreme Speed', 'Geomancy', 'Lovely Kiss', 'Shell Smash', 'Shift Gear', 'Spore', 'Thousand Arrows'],
},
{
name: "[Gen 6] Almost Any Ability",
desc: `Pok&eacute;mon have access to almost any ability.`,
threads: [
`&bullet; <a href="https://www.smogon.com/forums/posts/8772336/">ORAS Almost Any Ability</a>`,
],

mod: 'gen6',
ruleset: ['[Gen 6] OU', '2 Ability Clause', 'AAA Restricted Abilities', '!Obtainable Abilities'],
banlist: ['Archeops', 'Bisharp', 'Chatot', 'Dragonite', 'Keldeo', 'Kyurem-Black', 'Mamoswine', 'Regigigas', 'Shedinja', 'Slaking', 'Smeargle', 'Snorlax', 'Suicune', 'Terrakion', 'Weavile', 'Dynamic Punch', 'Zap Cannon'],
unbanlist: ['Aegislash', 'Blaziken', 'Deoxys-Defense', 'Deoxys-Speed', 'Genesect', 'Greninja', 'Landorus'],
restricted: ['Arena Trap', 'Contrary', 'Fur Coat', 'Huge Power', 'Illusion', 'Imposter', 'Parental Bond', 'Protean', 'Pure Power', 'Simple', 'Speed Boost', 'Wonder Guard'],
},
{
name: "[Gen 6] Pure Hackmons",
desc: `Anything that can be hacked in-game and is usable in local battles is allowed.`,
Expand Down
52 changes: 52 additions & 0 deletions data/mods/mixandmega7/items.ts
@@ -0,0 +1,52 @@
export const Items: {[k: string]: ModdedItemData} = {
blueorb: {
inherit: true,
onSwitchIn(pokemon) {
if (pokemon.isActive && !pokemon.species.isPrimal) {
this.queue.insertChoice({pokemon, choice: 'runPrimal'});
}
},
onPrimal(pokemon) {
// @ts-ignore
const species: Species = this.getMixedSpecies(pokemon.m.originalSpecies, 'Kyogre-Primal');
if (pokemon.m.originalSpecies === 'Kyogre') {
pokemon.formeChange(species, this.effect, true);
} else {
pokemon.formeChange(species, this.effect, true);
pokemon.baseSpecies = species;
this.add('-start', pokemon, 'Blue Orb', '[silent]');
}
},
onTakeItem: false,
},
redorb: {
inherit: true,
onSwitchIn(pokemon) {
if (pokemon.isActive && !pokemon.species.isPrimal) {
this.queue.insertChoice({pokemon, choice: 'runPrimal'});
}
},
onPrimal(pokemon) {
// @ts-ignore
const species: Species = this.getMixedSpecies(pokemon.m.originalSpecies, 'Groudon-Primal');
if (pokemon.m.originalSpecies === 'Groudon') {
pokemon.formeChange(species, this.effect, true);
} else {
pokemon.formeChange(species, this.effect, true);
pokemon.baseSpecies = species;
this.add('-start', pokemon, 'Red Orb', '[silent]');
const apparentSpecies = pokemon.illusion ? pokemon.illusion.species.name : pokemon.m.originalSpecies;
const oSpecies = this.dex.getSpecies(apparentSpecies);
if (pokemon.illusion) {
const types = oSpecies.types;
if (types.length > 1 || types[types.length - 1] !== 'Fire') {
this.add('-start', pokemon, 'typechange', (types[0] !== 'Fire' ? types[0] + '/' : '') + 'Fire', '[silent]');
}
} else if (oSpecies.types.length !== pokemon.species.types.length || oSpecies.types[1] !== pokemon.species.types[1]) {
this.add('-start', pokemon, 'typechange', pokemon.species.types.join('/'), '[silent]');
}
}
},
onTakeItem: false,
},
};
119 changes: 119 additions & 0 deletions data/mods/mixandmega7/scripts.ts
@@ -0,0 +1,119 @@
export const Scripts: ModdedBattleScriptsData = {
inherit: 'gen7',
init() {
for (const id in this.data.Items) {
if (!this.data.Items[id].megaStone) continue;
this.modData('Items', id).onTakeItem = false;
}
},
canMegaEvo(pokemon) {
if (pokemon.species.isMega || pokemon.species.isPrimal) return null;

const item = pokemon.getItem();
if (item.megaStone) {
if (item.megaStone === pokemon.name) return null;
return item.megaStone;
} else if (pokemon.baseMoves.includes('dragonascent' as ID)) {
return 'Rayquaza-Mega';
} else {
return null;
}
},
runMegaEvo(pokemon) {
if (pokemon.species.isMega || pokemon.species.isPrimal) return false;

const isUltraBurst = !pokemon.canMegaEvo;
// @ts-ignore
const species: Species = this.getMixedSpecies(pokemon.m.originalSpecies, pokemon.canMegaEvo || pokemon.canUltraBurst);
const side = pokemon.side;

// Pokémon affected by Sky Drop cannot Mega Evolve. Enforce it here for now.
for (const foeActive of side.foe.active) {
if (foeActive.volatiles['skydrop'] && foeActive.volatiles['skydrop'].source === pokemon) {
return false;
}
}

// Do we have a proper sprite for it?
// @ts-ignore assert non-null pokemon.canMegaEvo
if (isUltraBurst || this.dex.getSpecies(pokemon.canMegaEvo).baseSpecies === pokemon.m.originalSpecies) {
pokemon.formeChange(species, pokemon.getItem(), true);
} else {
const oSpecies = this.dex.getSpecies(pokemon.m.originalSpecies);
// @ts-ignore
const oMegaSpecies = this.dex.getSpecies(species.originalMega);
pokemon.formeChange(species, pokemon.getItem(), true);
this.add('-start', pokemon, oMegaSpecies.requiredItem || oMegaSpecies.requiredMove, '[silent]');
if (oSpecies.types.length !== pokemon.species.types.length || oSpecies.types[1] !== pokemon.species.types[1]) {
this.add('-start', pokemon, 'typechange', pokemon.species.types.join('/'), '[silent]');
}
}

pokemon.canMegaEvo = null;
if (isUltraBurst) pokemon.canUltraBurst = null;
return true;
},
getMixedSpecies(originalSpecies, megaSpecies) {
const oSpecies = this.dex.getSpecies(originalSpecies);
const mSpecies = this.dex.getSpecies(megaSpecies);
if (oSpecies.baseSpecies === mSpecies.baseSpecies) return mSpecies;
// @ts-ignore
const deltas = this.getMegaDeltas(mSpecies);
// @ts-ignore
const species = this.doGetMixedSpecies(oSpecies, deltas);
return species;
},
getMegaDeltas(megaSpecies) {
const baseSpecies = this.dex.getSpecies(megaSpecies.baseSpecies);
const deltas: {
ability: string,
baseStats: SparseStatsTable,
weighthg: number,
originalMega: string,
requiredItem: string | undefined,
type?: string,
isMega?: boolean,
isPrimal?: boolean,
} = {
ability: megaSpecies.abilities['0'],
baseStats: {},
weighthg: megaSpecies.weighthg - baseSpecies.weighthg,
originalMega: megaSpecies.name,
requiredItem: megaSpecies.requiredItem,
};
let stat: StatName;
for (stat in megaSpecies.baseStats) {
deltas.baseStats[stat] = megaSpecies.baseStats[stat] - baseSpecies.baseStats[stat];
}
if (megaSpecies.types.length > baseSpecies.types.length) {
deltas.type = megaSpecies.types[1];
} else if (megaSpecies.types.length < baseSpecies.types.length) {
deltas.type = baseSpecies.types[0];
} else if (megaSpecies.types[1] !== baseSpecies.types[1]) {
deltas.type = megaSpecies.types[1];
}
if (megaSpecies.isMega) deltas.isMega = true;
if (megaSpecies.isPrimal) deltas.isPrimal = true;
return deltas;
},
doGetMixedSpecies(speciesOrSpeciesName, deltas) {
if (!deltas) throw new TypeError("Must specify deltas!");
const species = this.dex.deepClone(this.dex.getSpecies(speciesOrSpeciesName));
species.abilities = {'0': deltas.ability};
if (species.types[0] === deltas.type) {
species.types = [deltas.type];
} else if (deltas.type) {
species.types = [species.types[0], deltas.type];
}
const baseStats = species.baseStats;
for (const statName in baseStats) {
baseStats[statName] = this.clampIntRange(baseStats[statName] + deltas.baseStats[statName], 1, 255);
}
species.weighthg = Math.max(1, species.weighthg + deltas.weighthg);
species.originalMega = deltas.originalMega;
species.requiredItem = deltas.requiredItem;
if (deltas.isMega) species.isMega = true;
if (deltas.isPrimal) species.isPrimal = true;
return species;
},
};
17 changes: 17 additions & 0 deletions data/rulesets.ts
Expand Up @@ -1260,4 +1260,21 @@ export const Formats: {[k: string]: FormatData} = {
this.makeRequest('teampreview');
},
},
aaarestrictedabilities: {
effectType: 'ValidatorRule',
name: 'AAA Restricted Abilities',
desc: "Allows validation for AAA formats to use restricted abilities instead of banned ones.",
onValidateSet(set) {
const ability = this.dex.getAbility(set.ability);
if (this.ruleTable.isRestricted(`ability:${ability.id}`)) {
const species = this.dex.getSpecies(set.species);
if (!Object.values(species.abilities).includes(ability.name)) {
return [
`The Ability "${ability.name}" is restricted.`,
`(Only Pok\u00e9mon that get ${ability.name} naturally can use it.)`,
];
}
}
},
},
};

0 comments on commit 3f5ef2e

Please sign in to comment.