Advertisement
Guest User

Mix and Mega

a guest
Oct 16th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.         name: "Mix and Mega",
  3.         desc: ["&bullet; <a href=\"https://www.smogon.com/forums/threads/3540979/\">Mix and Mega</a>"],
  4.         section: 'Other Metagames',
  5.  
  6.         mod: 'mixandmega',
  7.         ruleset: ['Ubers', 'Baton Pass Clause'],
  8.         banlist: ['Gengarite', 'Shadow Tag', 'Dynamic Punch', 'Zap Cannon'],
  9.  
  10.         onValidateTeam: function (team, format) {
  11.             var itemTable = {};
  12.             for (var i = 0; i < team.length; i++) {
  13.                 var item = this.getItem(team[i].item);
  14.                 if (!item) continue;
  15.                 if (itemTable[item] && item.megaStone) return ["You are limited to one of each Mega Stone.", "(You have more than one " + this.getItem(item).name + ")"];
  16.                 if (itemTable[item] && (item.id === 'redorb' || item.id === 'blueorb')) return ["You are limited to one of each Primal Orb.", "(You have more than one " + this.getItem(item).name + ")"];
  17.                 itemTable[item] = true;
  18.             }
  19.         },
  20.         onValidateSet: function (set) {
  21.             var template = this.getTemplate(set.species || set.name);
  22.             var item = this.getItem(set.item);
  23.             if (!item.megaEvolves && item.id !== 'blueorb' && item.id !== 'redorb') return;
  24.             if (template.baseSpecies === item.megaEvolves || (item.id === 'redorb' && template.baseSpecies === 'Groudon') || (item.id === 'blueorb' && template.baseSpecies === 'Kyogre')) return;
  25.             if (template.evos.length) return ["" + template.species + " no puede portar " + item.name + " ya que no está completamente evolucionado."];
  26.             if (template.tier === 'Uber') return ["" + template.species + " no puede portar " + item.name + " ya que es Uber."];
  27.             if (template.species === 'Shuckle' && ['abomasite', 'aggronite', 'audinite', 'cameruptite', 'charizarditex', 'charizarditey', 'galladite', 'gyaradosite', 'heracronite', 'houndoominite', 'latiasite', 'mewtwonitey', 'sablenite', 'salamencite', 'scizorite', 'sharpedonite', 'slowbronite', 'steelixite', 'tyranitarite', 'venusaurite'].indexOf(item.id) >= 0) {
  28.                 return ["" + template.species + " no puede portar " + item.name + "."];
  29.             }
  30.             var bannedMons = {'Cresselia':1, 'Dragonite':1, 'Kyurem-Black':1, 'Lucario':1, 'Slaking':1, 'Smeargle':1, 'Regigigas':1};
  31.             if (template.species in bannedMons) {
  32.                 return ["" + template.species + " is not allowed to hold a Mega Stone."];
  33.             }
  34.             if (item.id === 'beedrillite' || item.id === 'kangaskhanite') {
  35.                 return ["" + item.name + " can only allowed be held by " + item.megaEvolves + "."];
  36.             }
  37.             switch (item.id) {
  38.             case 'blazikenite':
  39.                 if (set.ability !== 'Speed Boost') return ["" + template.species + " is not allowed to hold " + item.name + "."];
  40.                 break;
  41.             case 'mawilite': case 'medichamite':
  42.                 var powerAbilities = {'Huge Power':1, 'Pure Power':1};
  43.                 if (powerAbilities.hasOwnProperty(set.ability)) break;
  44.                 if (!template.otherFormes) return ["" + template.species + " is not allowed to hold " + item.name + "."];
  45.                 var allowedPower = false;
  46.                 for (var i = 0; i < template.otherFormes.length; i++) {
  47.                     var altTemplate = this.getTemplate(template.otherFormes[i]);
  48.                     if ((altTemplate.isMega || altTemplate.isPrimal) && powerAbilities.hasOwnProperty(altTemplate.abilities['0'])) {
  49.                         allowedPower = true;
  50.                         break;
  51.                     }
  52.                 }
  53.                 if (!allowedPower) return ["" + template.species + " is not allowed to hold " + item.name + "."];
  54.                 break;
  55.             case 'slowbronite':
  56.                 if (template.species === 'Regirock' || template.species === 'Steelix') return ["" + template.species + " is not allowed to hold " + item.name + "."];
  57.                 break;
  58.             case 'mewtwonitey':
  59.                 if (template.baseStats.def <= 20) return ["" + template.species + " does not have enough Defense to hold " + item.name + "."];
  60.                 break;
  61.             case 'diancite':
  62.                 if (template.baseStats.def <= 40 || template.baseStats.spd <= 40) return ["" + template.species + " no tiene suficiente Defensa o Defensa Especial para portar " + item.name + "."];
  63.                 break;
  64.             case 'ampharosite': case 'garchompite': case 'heracronite':
  65.                 if (template.baseStats.spe <= 10) return ["" + template.species + " does not have enough Speed to hold " + item.name + "."];
  66.                 break;
  67.             case 'cameruptite':
  68.                 if (template.baseStats.spe <= 20) return ["" + template.species + " does not have enough Speed to hold " + item.name + "."];
  69.                 break;
  70.             case 'abomasite': case 'sablenite':
  71.                 if (template.baseStats.spe <= 30) return ["" + template.species + " does not have enough Speed to hold " + item.name + "."];
  72.                 break;
  73.             }
  74.         },
  75.         onBegin: function () {
  76.             var allPokemon = this.p1.pokemon.concat(this.p2.pokemon);
  77.             for (var i = 0, len = allPokemon.length; i < len; i++) {
  78.                 var pokemon = allPokemon[i];
  79.                 pokemon.originalSpecies = pokemon.baseTemplate.species;
  80.             }
  81.         },
  82.         onSwitchInPriority: -6,
  83.         onSwitchIn: function (pokemon) {
  84.             var item = pokemon.getItem();
  85.             if (pokemon.isActive && !pokemon.template.isMega && !pokemon.template.isPrimal && (item.id === 'redorb' || item.id === 'blueorb') && pokemon.baseTemplate.tier !== 'Uber' && !pokemon.template.evos.length) {
  86.                 // Primal Reversion
  87.                 var bannedMons = {'Cresselia':1, 'Dragonite':1, 'Kyurem-Black':1, 'Lucario':1, 'Regigigas':1, 'Slaking':1, 'Smeargle':1};
  88.                 if (!(pokemon.baseTemplate.baseSpecies in bannedMons)) {
  89.                     var template = this.getMixedTemplate(pokemon.originalSpecies, item.id === 'redorb' ? 'Groudon-Primal' : 'Kyogre-Primal');
  90.                     pokemon.formeChange(template);
  91.                     pokemon.baseTemplate = template;
  92.  
  93.                     // Do we have a proper sprite for it?
  94.                     if (pokemon.originalSpecies === (item.id === 'redorb' ? 'Groudon' : 'Kyogre')) {
  95.                         pokemon.details = template.species + (pokemon.level === 100 ? '' : ', L' + pokemon.level) + (pokemon.gender === '' ? '' : ', ' + pokemon.gender) + (pokemon.set.shiny ? ', shiny' : '');
  96.                         this.add('detailschange', pokemon, pokemon.details);
  97.                     } else {
  98.                         var oTemplate = this.getTemplate(pokemon.originalSpecies);
  99.                         this.add('-formechange', pokemon, oTemplate.species, template.requiredItem);
  100.                         this.add('-start', pokemon, this.getTemplate(template.originalMega).requiredItem, '[silent]');
  101.                         if (oTemplate.types.length !== pokemon.template.types.length || oTemplate.types[1] !== pokemon.template.types[1]) {
  102.                             this.add('-start', pokemon, 'typechange', pokemon.template.types.join('/'), '[silent]');
  103.                         }
  104.                     }
  105.                     this.add('message', pokemon.name + "'s " + pokemon.getItem().name + " se activó!");
  106.                     this.add('message', pokemon.name + " volvió a su Forma Primigenia!");
  107.                     pokemon.setAbility(template.abilities['0']);
  108.                     pokemon.baseAbility = pokemon.ability;
  109.                     pokemon.canMegaEvo = false;
  110.                 }
  111.             } else {
  112.                 var oMegaTemplate = this.getTemplate(pokemon.template.originalMega);
  113.                 if (oMegaTemplate.exists && pokemon.originalSpecies !== oMegaTemplate.baseSpecies) {
  114.                     // Place volatiles on the Pokémon to show its mega-evolved condition and details
  115.                     this.add('-start', pokemon, oMegaTemplate.requiredItem || oMegaTemplate.requiredMove, '[silent]');
  116.                     var oTemplate = this.getTemplate(pokemon.originalSpecies);
  117.                     if (oTemplate.types.length !== pokemon.template.types.length || oTemplate.types[1] !== pokemon.template.types[1]) {
  118.                         this.add('-start', pokemon, 'typechange', pokemon.template.types.join('/'), '[silent]');
  119.                     }
  120.                 }
  121.             }
  122.         },
  123.         onSwitchOut: function (pokemon) {
  124.             var oMegaTemplate = this.getTemplate(pokemon.template.originalMega);
  125.             if (oMegaTemplate.exists && pokemon.originalSpecies !== oMegaTemplate.baseSpecies) {
  126.                 this.add('-end', pokemon, oMegaTemplate.requiredItem || oMegaTemplate.requiredMove, '[silent]');
  127.             }
  128.         }
  129.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement