Advertisement
Guest User

Ghoul King's Pet Mod Gen VI 1.0

a guest
Mar 16th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*config.formats.js*/
  2.  
  3. {
  4.         name: "Ghoul King's Pet Mod",
  5.         desc: ["A Pet Mod aimed at improving balance."],
  6.         section: "Other Metagames",
  7.         mod: "ghoulking",
  8.         ruleset: ['Pokemon', 'Standard', 'Baton Pass Clause', 'Team Preview'],
  9.         banlist: ['Arceus', 'Blaziken', 'Darkrai', 'Deoxys', 'Deoxys-Attack', 'Deoxys-Defense', 'Deoxys-Speed', 'Giratina-Origin', 'Groudon',
  10.             'Ho-Oh', 'Kyogre', 'Kyurem-Black', 'Kyurem-White', 'Lugia', 'Mewtwo', 'Palkia', 'Rayquaza', 'Reshiram',
  11.             'Xerneas', 'Yveltal', 'Zekrom', 'Kangaskhanite', 'Salamencite', 'Soul Dew',
  12.         ],
  13.         onEffectiveness: function (typeMod, target, type, move) {
  14.         if (move && move.effectType === 'Move' && (type === 'Dragon' || type === 'Fairy') && target.side.foe.active[0].hasType('Normal') && move.type === 'Normal') return 1;
  15.         },
  16.         onModifyMove: function (move) {
  17.             let critMult;
  18.             move.critRatio = this.clampIntRange(move.critRatio, 0, 4);
  19.             critMult = [0, 0, 4, 2, 1];
  20.         },
  21. },
  22.  
  23. /*/* mods/ghoulking/moves.js */
  24.  
  25. 'use strict';
  26.  
  27. exports.BattleMovedex = {
  28. fakeout: {
  29.     inherit: true,
  30.     secondary: {
  31.             chance: 100,
  32.             volatileStatus: 'faked',
  33.         },
  34. },
  35. blizzard: {
  36.         inherit: true,
  37.         onModifyMove: function (move) {
  38.             if (this.isWeather(['hail', 'iceage'])) move.accuracy = true;
  39.         },
  40. },
  41. weatherball: {
  42.         inherit: true,
  43.         onModifyMove: function (move) {
  44.             switch (this.effectiveWeather()) {
  45.             case 'sunnyday':
  46.             case 'desolateland':
  47.                 move.type = 'Fire';
  48.                 break;
  49.             case 'raindance':
  50.             case 'primordialsea':
  51.                 move.type = 'Water';
  52.                 break;
  53.             case 'sandstorm':
  54.                 move.type = 'Rock';
  55.                 break;
  56.             case 'hail':
  57.             case 'iceage':
  58.                 move.type = 'Ice';
  59.                 break;
  60.             }
  61.         },
  62. },
  63. synthesis: {
  64.         inherit: true,
  65.         onHit: function (pokemon) {
  66.             if (this.isWeather(['sunnyday', 'desolateland'])) {
  67.                 this.heal(this.modify(pokemon.maxhp, 0.667));
  68.             } else if (this.isWeather(['raindance', 'primordialsea', 'sandstorm', 'hail', 'iceage'])) {
  69.                 this.heal(this.modify(pokemon.maxhp, 0.25));
  70.             } else {
  71.                 this.heal(this.modify(pokemon.maxhp, 0.5));
  72.             }
  73.         },
  74. },
  75. moonlight: {
  76.         inherit: true,
  77.         onHit: function (pokemon) {
  78.             if (this.isWeather(['sunnyday', 'desolateland'])) {
  79.                 this.heal(this.modify(pokemon.maxhp, 0.667));
  80.             } else if (this.isWeather(['raindance', 'primordialsea', 'sandstorm', 'hail', 'iceage'])) {
  81.                 this.heal(this.modify(pokemon.maxhp, 0.25));
  82.             } else {
  83.                 this.heal(this.modify(pokemon.maxhp, 0.5));
  84.             }
  85.         },
  86. },
  87. morningsun: {
  88.         inherit: true,
  89.         onHit: function (pokemon) {
  90.             if (this.isWeather(['sunnyday', 'desolateland'])) {
  91.                 this.heal(this.modify(pokemon.maxhp, 0.667));
  92.             } else if (this.isWeather(['raindance', 'primordialsea', 'sandstorm', 'hail', 'iceage'])) {
  93.                 this.heal(this.modify(pokemon.maxhp, 0.25));
  94.             } else {
  95.                 this.heal(this.modify(pokemon.maxhp, 0.5));
  96.             }
  97.         },
  98. },
  99. skillswap: {
  100.         inherit: true,
  101.         onTryHit: function (target, source) {
  102.             let bannedAbilities = {illusion:1, multitype:1, stancechange:1, wonderguard:1, fluidity:1, forecast:1};
  103.             if (bannedAbilities[target.ability] || bannedAbilities[source.ability]) {
  104.                 return false;
  105.             }
  106.         },
  107. },
  108. entrainment: {
  109.         inherit: true,
  110.         onTryHit: function (target, source) {
  111.             if (target === source) return false;
  112.             let bannedTargetAbilities = {multitype:1, stancechange:1, truant:1, fluidity: 1, forecast:1};
  113.             let bannedSourceAbilities = {flowergift:1, forecast:1, illusion:1, imposter:1, multitype:1, stancechange:1, trace:1, zenmode:1, fluidity: 1};
  114.             if (bannedTargetAbilities[target.ability] || bannedSourceAbilities[source.ability] || target.ability === source.ability) {
  115.                 return false;
  116.             }
  117.         },
  118. },
  119. gastroacid: {
  120.         inherit: true,
  121.         onTryHit: function (pokemon) {
  122.             let bannedAbilities = {multitype:1, stancechange:1, fluidity: 1, forecast:1};
  123.             if (bannedAbilities[pokemon.ability]) {
  124.                 return false;
  125.             }
  126.         },
  127. },
  128. worryseed: {
  129.         inherit: true,
  130.         onTryHit: function (pokemon) {
  131.             let bannedAbilities = {insomnia:1, multitype:1, stancechange:1, truant:1, fluidity: 1, forecast:1};
  132.             if (bannedAbilities[pokemon.ability]) {
  133.                 return false;
  134.             }
  135.         },
  136. },
  137. roleplay: {
  138.         inherit: true,
  139.         onTryHit: function (target, source) {
  140.             let bannedAbilities = {flowergift:1, forecast:1, illusion:1, imposter:1, multitype:1, trace:1, wonderguard:1, zenmode:1, fluidity: 1};
  141.             if (bannedAbilities[target.ability] || source.ability === 'multitype' || target.ability === source.ability) {
  142.                 return false;
  143.             }
  144.         },
  145. },
  146. simplebeam: {
  147.         inherit: true,
  148.         onTryHit: function (pokemon) {
  149.             let bannedAbilities = {multitype:1, simple:1, stancechange:1, truant:1, fluidity:1, forecast:1};
  150.             if (bannedAbilities[pokemon.ability]) {
  151.                 return false;
  152.             }
  153.         },
  154. },
  155. willowisp: {
  156.         inherit: true,
  157.         accuracy: 100
  158.     },
  159. toxic: {
  160.         inherit: true,
  161.         accuracy: 100
  162. },
  163. poisongas: {
  164.         inerit: true,
  165.         accuracy: 100,
  166.         pp: 40,
  167.         status: 'psn',
  168.         target: 'allAdjacentFoes'
  169. },
  170. leechseed: {
  171.         inherit: true,
  172.         accuracy: 100
  173.     },
  174. magmastorm: {
  175.         inherit: true,
  176.         accuracy: 100,
  177.         basePower: 80
  178.     },
  179. hyperfang: {
  180.         inherit: true,
  181.         accuracy: 100,
  182.         basePower: 100,
  183.         secondary: {
  184.             chance: 100,
  185.             volatileStatus: 'flinch',
  186.         },
  187.     },
  188. skydrop: {
  189.         inherit: true,
  190.         basePower: 75
  191.     },
  192. dragontail: {
  193.         inherit: true,
  194.         accuracy: true
  195.     },
  196. circlethrow: {
  197.         inherit: true,
  198.         accuracy: true
  199.     },
  200. outrage: {
  201.         inherit: true,
  202.         target: "Normal",
  203.         basePower: 150,
  204.         pp: 5,
  205.         self: {
  206.             boosts: {
  207.                 spe: -1,
  208.                 def: -1,
  209.                 spd: -1
  210.             }
  211.         },
  212.     },
  213. petaldance: {
  214.         inherit: true,
  215.         target: "Normal",
  216.         basePower: 150,
  217.         pp: 5,
  218.         self: {
  219.             boosts: {
  220.                 spe: -1,
  221.                 def: -1,
  222.                 spd: -1
  223.             }
  224.         },
  225.     },
  226. thrash: {
  227.         inherit: true,
  228.         target: "Normal",
  229.         basePower: 150,
  230.         pp: 5,
  231.         self: {
  232.             boosts: {
  233.                 spe: -1,
  234.                 def: -1,
  235.                 spd: -1
  236.             }
  237.         },
  238.     },
  239. rage: {
  240.         inherit: true,
  241.         Type: "Dark",
  242.         basePower: 80,
  243.         pp: 20,
  244.         self: {
  245.             boosts: {
  246.                 atk: 1,
  247.                 def: -1,
  248.                 spd: -1
  249.             }
  250.         },
  251.     },
  252. megapunch: {
  253.         inherit: true,
  254.         priority: 1,
  255.         accuracy: 100,
  256.         self: {
  257.             boosts: {
  258.                 def: -1,
  259.                 spd: -1
  260.             }
  261.         },
  262.     },
  263. megakick: {
  264.         inherit: true,
  265.         priority: 1,
  266.         accuracy: 100,
  267.         self: {
  268.             volatileStatus: 'mustrecharge'
  269.         },
  270.     },
  271. crushgrip: {
  272.         inherit: true,
  273.         basePowerCallback: function (pokemon, target) {
  274.             return Math.floor(Math.floor((150 * (100 * Math.floor(target.hp * 4096 / target.maxhp)) + 2048 - 1) / 4096) / 100) || 1;
  275.         },
  276.     },
  277. crushclaw: {
  278.         inherit: true,
  279.         accuracy: 100,
  280.         secondary: {
  281.             chance: 100,
  282.             boosts: {
  283.                 def: -1
  284.             }
  285.         },
  286.     },
  287. stealthrock: {
  288.         inherit: true,
  289.         effect: {
  290.             // this is a side condition
  291.             onStart: function (side) {
  292.                 this.add('-sidestart', side, 'move: Stealth Rock');
  293.             },
  294.             onSwitchIn: function (pokemon) {
  295.                 if (pokemon.hasType('Rock') || pokemon.hasAbility('battlearmor')) {
  296.                     this.add('-sideend', pokemon.side, 'move: Stealth Rock', '[of] ' + pokemon);
  297.                     pokemon.side.removeSideCondition('stealthrock');
  298.                 }
  299.                 else var typeMod = this.clampIntRange(pokemon.runEffectiveness('Rock'), -6, 6);
  300.                 this.damage(pokemon.maxhp * Math.pow(2, typeMod) / 12);
  301.             }
  302.         },
  303.     },
  304. spikes: {
  305.         inherit: true,
  306.         effect: {
  307.             // this is a side condition
  308.             onStart: function (side) {
  309.                 this.add('-sidestart', side, 'Spikes');
  310.                 this.effectData.layers = 1;
  311.             },
  312.             onRestart: function (side) {
  313.                 if (this.effectData.layers >= 3) return false;
  314.                 this.add('-sidestart', side, 'Spikes');
  315.                 this.effectData.layers++;
  316.             },
  317.             onSwitchIn: function (pokemon) {
  318.                 if (!pokemon.isGrounded()) return;
  319.                 if (pokemon.hasAbility('battlearmor')) {
  320.                     this.add('-sideend', pokemon.side, 'move: Spikes', '[of] ' + pokemon);
  321.                     pokemon.side.removeSideCondition('spikes');
  322.                 }
  323.                 if (!pokemon.hasAbility('battlearmor')) {
  324.                 let damageAmounts = [0, 3, 4, 6]; // 1/8, 1/6, 1/4
  325.                 this.damage(damageAmounts[this.effectData.layers] * pokemon.maxhp / 24);
  326.                 }
  327.             }
  328.         },
  329. },
  330. toxicspikes: {
  331.         inherit: true,
  332.         effect: {
  333.             // this is a side condition
  334.             onStart: function (side) {
  335.                 this.add('-sidestart', side, 'move: Toxic Spikes');
  336.                 this.effectData.layers = 1;
  337.             },
  338.             onRestart: function (side) {
  339.                 if (this.effectData.layers >= 2) return false;
  340.                 this.add('-sidestart', side, 'move: Toxic Spikes');
  341.                 this.effectData.layers++;
  342.             },
  343.             onSwitchIn: function (pokemon) {
  344.                 if (!pokemon.isGrounded()) return;
  345.                 if (!pokemon.runImmunity('Poison')) return;
  346.                 if (pokemon.hasType('Poison') || pokemon.hasAbility('battlearmor')) {
  347.                     this.add('-sideend', pokemon.side, 'move: Toxic Spikes', '[of] ' + pokemon);
  348.                     pokemon.side.removeSideCondition('toxicspikes');
  349.                 } else if (this.effectData.layers >= 2) {
  350.                     pokemon.trySetStatus('tox', pokemon.side.foe.active[0]);
  351.                 } else {
  352.                     pokemon.trySetStatus('psn', pokemon.side.foe.active[0]);
  353.                 }
  354.             },
  355.         },
  356. },
  357. stickyweb: {
  358.         inherit: true,
  359.         effect: {
  360.             onStart: function (side) {
  361.                 this.add('-sidestart', side, 'move: Sticky Web');
  362.             },
  363.             onSwitchIn: function (pokemon) {
  364.                 if (!pokemon.isGrounded()) return;
  365.                 if (pokemon.hasAbility('battlearmor')) {
  366.                     this.add('-sideend', pokemon.side, 'move: stickyweb', '[of] ' + pokemon);
  367.                     pokemon.side.removeSideCondition('stickyweb');
  368.                 }
  369.                 else this.boost({spe: -1}, pokemon, pokemon.side.foe.active[0], this.getMove('stickyweb'));
  370.                 this.add('-activate', pokemon, 'move: Sticky Web');
  371.             },
  372.         },
  373. },
  374. assist: {
  375.         inherit: true,
  376.         onHit: function (target) {
  377.             let moves = [];
  378.             for (let i in exports.BattleMovedex) {
  379.                 let move = exports.BattleMovedex[i];
  380.                 if (i !== move.id) continue;
  381.                 if (move.isNonstandard) continue;
  382.                 let noMetronome = {
  383.                     afteryou:1, assist:1, belch:1, bestow:1, celebrate:1, chatter:1, copycat:1, counter:1, covet:1, craftyshield:1, destinybond:1, detect:1, diamondstorm:1, dragonascent:1, endure:1, feint:1, focuspunch:1, followme:1, happyhour:1, helpinghand:1, holdhands:1, hyperspacefury:1, hyperspacehole:1, kingsshield:1, lightofruin:1, matblock:1, mefirst:1, metronome:1, mimic:1, mirrorcoat:1, mirrormove:1, naturepower:1, originpulse:1, precipiceblades:1, protect:1, quash:1, quickguard:1, ragepowder:1, relicsong:1, secretsword:1, sketch:1, sleeptalk:1, snarl:1, snatch:1, snore:1, spikyshield:1, steameruption:1, struggle:1, switcheroo:1, technoblast:1, thief:1, thousandarrows:1, thousandwaves:1, transform:1, trick:1, vcreate:1, wideguard:1, ancientpower:1, silverwind:1, ominouswind:1,
  384.                 };
  385.                 if (!noMetronome[move.id]) {
  386.                     moves.push(move);
  387.                 }
  388.             }
  389.             let randomMove = '';
  390.             if (moves.length) {
  391.                 moves.sort(function (a, b) {return a.num - b.num;});
  392.                 randomMove = moves[this.random(moves.length)].id;
  393.             }
  394.             if (!randomMove) {
  395.                 return false;
  396.             }
  397.             this.useMove(randomMove, target);
  398.         },
  399. },
  400. copycat: {
  401.         inherit: true,
  402.         onHit: function (pokemon) {
  403.             let noCopycat = {assist:1, bestow:1, chatter:1, circlethrow:1, copycat:1, counter:1, covet:1, destinybond:1, detect:1, dragontail:1, endure:1, feint:1, focuspunch:1, followme:1, helpinghand:1, mefirst:1, metronome:1, mimic:1, mirrorcoat:1, mirrormove:1, naturepower:1, protect:1, ragepowder:1, roar:1, sketch:1, sleeptalk:1, snatch:1, struggle:1, switcheroo:1, thief:1, transform:1, trick:1, whirlwind:1, ancientpower:1, silverwind:1, ominouswind:1,};
  404.             if (!this.lastMove || noCopycat[this.lastMove]) {
  405.                 return false;
  406.             }
  407.             this.useMove(this.lastMove, pokemon);
  408.         },
  409. },
  410. kingsshield: {
  411.         inherit: true,
  412.         effect: {
  413.             duration: 1,
  414.             onStart: function (target) {
  415.                 this.add('-singleturn', target, 'Protect');
  416.             },
  417.             onTryHitPriority: 3,
  418.             onTryHit: function (target, source, move) {
  419.                 if (!move.flags['protect'] || move.category === 'Status') return;
  420.                 this.add('-activate', target, 'Protect');
  421.                 let lockedmove = source.getVolatile('lockedmove');
  422.                 if (lockedmove) {
  423.                     // Outrage counter is reset
  424.                     if (source.volatiles['lockedmove'].duration === 2) {
  425.                         delete source.volatiles['lockedmove'];
  426.                     }
  427.                 }
  428.                 if (move.flags['contact'] && !source.hasAbility('Rock Head')) {
  429.                     this.boost({atk:-2}, source, target, this.getMove("King's Shield"));
  430.                 }
  431.                 return null;
  432.             },
  433.         },
  434. },
  435. spikyshield: {
  436.         inherit: true,
  437.         effect: {
  438.             duration: 1,
  439.             onStart: function (target) {
  440.                 this.add('-singleturn', target, 'move: Protect');
  441.             },
  442.             onTryHitPriority: 3,
  443.             onTryHit: function (target, source, move) {
  444.                 if (!move.flags['protect']) return;
  445.                 this.add('-activate', target, 'Protect');
  446.                 let lockedmove = source.getVolatile('lockedmove');
  447.                 if (lockedmove) {
  448.                     // Outrage counter is reset
  449.                     if (source.volatiles['lockedmove'].duration === 2) {
  450.                         delete source.volatiles['lockedmove'];
  451.                     }
  452.                 }
  453.                 if (move.flags['contact'] && !source.hasAbility('Rock Head')) {
  454.                     this.damage(source.maxhp / 8, source, target);
  455.                 }
  456.                 return null;
  457.             },
  458.         },
  459. },
  460. hyperbeam: {
  461.         inherit: true,
  462.         accuracy: 100,
  463.         forceSwitch: true
  464.         },
  465. gigaimpact: {
  466.         inherit: true,
  467.         accuracy: 100,
  468.         forceSwitch: true
  469.         },
  470. rockwrecker: {
  471.         inherit: true,
  472.         accuracy: 100,
  473.         forceSwitch: true
  474.         },
  475. roaroftime: {
  476.         inherit: true,
  477.         accuracy: 100,
  478.         forceSwitch: true
  479.         },
  480. hydrocannon: {
  481.         inherit: true,
  482.         accuracy: 100,
  483.         forceSwitch: true
  484.         },
  485. blastburn: {
  486.         inherit: true,
  487.         accuracy: 100,
  488.         forceSwitch: true
  489.         },
  490. frenzyplant: {
  491.         inherit: true,
  492.         accuracy: 100,
  493.         forceSwitch: true
  494.         },
  495. dreameater: {
  496.         inherit: true,
  497.         basePower: 120
  498.         },
  499. rockslide: {
  500.         inherit: true,
  501.         accuracy: 100,
  502.         basePower: 70,
  503.         secondary: {
  504.             chance: 100,
  505.             volatileStatus: 'flinch',
  506.         },
  507.         },
  508. airslash: {
  509.         inherit: true,
  510.         accuracy: 100,
  511.         secondary: {
  512.             chance: 100,
  513.             volatileStatus: 'flinch',
  514.         },
  515.         },
  516. wringout: {
  517.         inherit: true,
  518.         type: "Grass"
  519.         },
  520. psychoboost: {
  521.         inherit: true,
  522.         accuracy: 100
  523.         },
  524. leafstorm: {
  525.         inherit: true,
  526.         accuracy: 100
  527.         },
  528. overheat: {
  529.         inherit: true,
  530.         accuracy: 100
  531.         },
  532. dracometeor: {
  533.         inherit: true,
  534.         accuracy: 100
  535.         },
  536. spacialrend: {
  537.         inherit: true,
  538.         accuracy: 100
  539.         },
  540. firespin: {
  541.         inherit: true,
  542.         accuracy: 100
  543.         },
  544. wrap: {
  545.         inherit: true,
  546.         accuracy: 100
  547.         },
  548. clamp: {
  549.         inherit: true,
  550.         accuracy: 100
  551.         },
  552. bind: {
  553.         inherit: true,
  554.         accuracy: 100
  555.         },
  556. whirlpool: {
  557.         inherit: true,
  558.         accuracy: 100
  559.         },
  560. sandtomb: {
  561.         inherit: true,
  562.         accuracy: 100
  563.         },
  564. crabhammer: {
  565.         inherit: true,
  566.         accuracy: 100
  567.         },
  568. superfang: {
  569.         inherit: true,
  570.         accuracy: 100
  571.         },
  572. sacredfire: {
  573.         inherit: true,
  574.         accuracy: 100
  575.         },
  576. aeroblast: {
  577.         inherit: true,
  578.         accuracy: 100
  579.         },
  580. dynamicpunch: {
  581.         inherit: true,
  582.         basePower: 110
  583.         },
  584. meteormash: {
  585.         inherit: true,
  586.         accuracy: 100
  587.         },
  588. firefang: {
  589.         inherit: true,
  590.         accuracy: 100,
  591.         secondaries: [
  592.             {
  593.                 chance: 10,
  594.                 status: 'brn',
  595.             }, {
  596.                 chance: 100,
  597.                 volatileStatus: 'flinch',
  598.             },
  599.         ],
  600.     },
  601. thunderfang: {
  602.         inherit: true,
  603.         accuracy: 100,
  604.         secondaries: [
  605.             {
  606.                 chance: 10,
  607.                 status: 'par',
  608.             }, {
  609.                 chance: 100,
  610.                 volatileStatus: 'flinch',
  611.             },
  612.         ],
  613.     },
  614. icefang: {
  615.         inherit: true,
  616.         accuracy: 100,
  617.         secondaries: [
  618.             {
  619.                 chance: 10,
  620.                 status: 'frz',
  621.             }, {
  622.                 chance: 100,
  623.                 volatileStatus: 'flinch',
  624.             },
  625.         ],
  626.     },
  627. poisonfang: {
  628.         inherit: true,
  629.         secondaries: [
  630.             {
  631.                 chance: 50,
  632.                 status: 'tox',
  633.             }, {
  634.                 chance: 100,
  635.                 volatileStatus: 'flinch',
  636.             },
  637.         ],
  638. },
  639. zenheadbutt: {
  640.         inherit: true,
  641.         accuracy: 100,
  642.         secondary: {
  643.             chance: 100,
  644.             volatileStatus: 'flinch',
  645.         },
  646.     },
  647. astonish: {
  648.         inherit: true,
  649.         secondary: {
  650.             chance: 100,
  651.             volatileStatus: 'flinch',
  652.         },
  653. },
  654. bite: {
  655.         inherit: true,
  656.         secondary: {
  657.             chance: 100,
  658.             volatileStatus: 'flinch',
  659.         },
  660. },
  661. darkpulse: {
  662.         inherit: true,
  663.         secondary: {
  664.             chance: 100,
  665.             volatileStatus: 'flinch',
  666.         },
  667. },
  668. dragonrush: {
  669.         inherit: true,
  670.         secondary: {
  671.             chance: 100,
  672.             volatileStatus: 'flinch',
  673.         },
  674. },
  675. extrasensory: {
  676.         inherit: true,
  677.         secondary: {
  678.             chance: 100,
  679.             volatileStatus: 'flinch',
  680.         },
  681. },
  682. headbutt: {
  683.         inherit: true,
  684.         secondary: {
  685.             chance: 100,
  686.             volatileStatus: 'flinch',
  687.         },
  688. },
  689. heartstamp: {
  690.         inherit: true,
  691.         secondary: {
  692.             chance: 100,
  693.             volatileStatus: 'flinch',
  694.         },
  695. },
  696. ironhead: {
  697.         inherit: true,
  698.         secondary: {
  699.             chance: 100,
  700.             volatileStatus: 'flinch',
  701.         },
  702. },
  703. needlearm: {
  704.         inherit: true,
  705.         secondary: {
  706.             chance: 100,
  707.             volatileStatus: 'flinch',
  708.         },
  709. },
  710. snore: {
  711.         inherit: true,
  712.         secondary: {
  713.             chance: 100,
  714.             volatileStatus: 'flinch',
  715.         },
  716. },
  717. rollingkick: {
  718.         inherit: true,
  719.         secondary: {
  720.             chance: 100,
  721.             volatileStatus: 'flinch',
  722.         },
  723. },
  724. steamroller: {
  725.         inherit: true,
  726.         secondary: {
  727.             chance: 100,
  728.             volatileStatus: 'flinch',
  729.         },
  730. },
  731. stomp: {
  732.         inherit: true,
  733.         secondary: {
  734.             chance: 100,
  735.             volatileStatus: 'flinch',
  736.         },
  737. },
  738. twister: {
  739.         inherit: true,
  740.         secondary: {
  741.             chance: 100,
  742.             volatileStatus: 'flinch',
  743.         },
  744. },
  745. waterfall: {
  746.         inherit: true,
  747.         secondary: {
  748.             chance: 100,
  749.             volatileStatus: 'flinch',
  750.         },
  751. },
  752. drillrun: {
  753.         inherit: true,
  754.         accuracy: 100
  755.         },
  756. aircutter: {
  757.         inherit: true,
  758.         accuracy: 100
  759.         },
  760. snarl: {
  761.         inherit: true,
  762.         accuracy: 100
  763.         },
  764. cometpunch: {
  765.         inherit: true,
  766.         accuracy: 100,
  767.         basePower: 25
  768.         },
  769. hypervoice: {
  770.         inherit: true,
  771.         basePower: 100
  772.         },
  773. playrough: {
  774.         inherit: true,
  775.         accuracy: 100,
  776.         basePower: 85
  777.         },
  778. iciclecrash: {
  779.         inherit: true,
  780.         accuracy: 100,
  781.         basePower: 80,
  782.         secondary: {
  783.             chance: 100,
  784.             volatileStatus: 'flinch',
  785.         },
  786.         },
  787. spikecannon: {
  788.         inherit: true,
  789.         priority: 1
  790.         },
  791. paraboliccharge: {
  792.         inherit: true,
  793.         basepower: 65
  794.         },
  795. belch: {
  796.         inherit: true,
  797.         accuracy: 100,
  798.         basePower: 135
  799.         },
  800. selfdestruct: {
  801.         inherit: true,
  802.         basePower: 180,
  803.         type: "Fire"
  804.         },
  805. octazooka: {
  806.         inherit: true,
  807.         accuracy: 100,
  808.         priority: 1,
  809.         basePower: 80,
  810.         self: {
  811.             boosts: {
  812.             spa: -2
  813.             }
  814.         },
  815.     },
  816. quash: {
  817.         inherit: true,
  818.         priority: 1
  819.         },
  820. blazekick: {
  821.     inherit: true,
  822.     onEffectiveness: function (typeMod, type, move) {
  823.             return typeMod + this.getEffectiveness('Fighting', type);
  824.         },
  825.     },
  826. skullbash: {
  827.         inherit: true,
  828.         secondary: {
  829.         boosts: {
  830.             def: -2
  831.         }
  832.     },
  833. },
  834. razorwind: {
  835.         inherit: true,
  836.         basePower: 120,
  837.         accuracy: 100,
  838.         onHit: function (target) {
  839.             target.clearBoosts();
  840.             this.add('-clearboost', target);
  841.         },
  842.     },
  843. quickguard: {
  844.         inherit: true,
  845.         priority: 4
  846.         },
  847. craftyshield :{
  848.         inherit: true,
  849.         sideCondition: 'craftyshield',
  850.         onTryHitSide: function (side, source) {
  851.             return !!this.willAct();
  852.         },
  853.         effect: {
  854.             duration: 3,
  855.             onStart: function (target, source) {
  856.                 this.add('-singleturn', source, 'Crafty Shield');
  857.             },
  858.             onTryHitPriority: 3,
  859.             onTryHit: function (target, source, move) {
  860.                 if (move.breaksProtect) {
  861.                     target.side.removeSideCondition('craftyshield');
  862.                     return;
  863.                 }
  864.                 if (move && (move.target === 'self' || move.category !== 'Status')) return;
  865.                 this.add('-activate', target, 'Crafty Shield');
  866.                 return null;
  867.             }
  868.         },
  869.     },
  870. iondeluge: {
  871.         inherit: true,
  872.         pseudoWeather: 'iondeluge',
  873.         effect: {
  874.             duration: 4,
  875.             onStart: function (target) {
  876.                 this.add('-fieldactivate', 'move: Ion Deluge');
  877.             },
  878.             onModifyMovePriority: -2,
  879.             onModifyMove: function (move) {
  880.                 if (move.type === 'Normal') {
  881.                     move.type = 'Electric';
  882.                     this.debug(move.name + "'s type changed to Electric");
  883.                 }
  884.             }
  885.         },
  886.     },
  887. bonemerang: {
  888.         inherit: true,
  889.         accuracy: 100,
  890.         basePower: 45,
  891.         onEffectiveness: function (typeMod, type) {
  892.             if (type === 'Flying') return 1;
  893.     },
  894.     ignoreImmunity: {'Ground': true},
  895. },
  896. bonerush: {
  897.         inherit: true,
  898.         accuracy: 100,
  899.         ignoreImmunity: {'Ground': true},
  900.     },
  901. boneclub: {
  902.         inherit: true,
  903.         accuracy: 100,
  904.         volatileStatus: 'smackdown',
  905.         effect: {
  906.             onStart: function (pokemon) {
  907.                 var applies = false;
  908.                 if (pokemon.hasType('Flying') || pokemon.hasAbility('levitate')) applies = true;
  909.                 if (pokemon.hasItem('ironball') || pokemon.volatiles['ingrain'] || this.getPseudoWeather('gravity')) applies = false;
  910.                 if (pokemon.removeVolatile('fly') || pokemon.removeVolatile('bounce')) {
  911.                     applies = true;
  912.                     this.cancelMove(pokemon);
  913.                     pokemon.removeVolatile('twoturnmove');
  914.                 }
  915.                 if (pokemon.volatiles['magnetrise']) {
  916.                     applies = true;
  917.                     delete pokemon.volatiles['magnetrise'];
  918.                 }
  919.                 if (pokemon.volatiles['telekinesis']) {
  920.                     applies = true;
  921.                     delete pokemon.volatiles['telekinesis'];
  922.                 }
  923.                 if (!applies) return false;
  924.                 this.add('-start', pokemon, 'Smack Down');
  925.             },
  926.             onRestart: function (pokemon) {
  927.                 if (pokemon.removeVolatile('fly') || pokemon.removeVolatile('bounce')) {
  928.                     this.cancelMove(pokemon);
  929.                     this.add('-start', pokemon, 'Smack Down');
  930.                 }
  931.             },
  932.             onNegateImmunity: function (pokemon, type) {
  933.                 if (type === 'Ground') return false;
  934.             }
  935.         },
  936.         ignoreImmunity: {'Ground': true},
  937.         secondary: false,
  938.     },
  939. acidspray: {
  940.         inherit: true,
  941.         onEffectiveness: function (typeMod, type) {
  942.             if (type === 'Steel') return 1;
  943.         },
  944.         ignoreImmunity: {'Poison': true},
  945.     },
  946. acid: {
  947.         inherit: true,
  948.         basePower: 65,
  949.         secondary: {
  950.             chance: 20,
  951.             boosts: {
  952.                 spd: -1
  953.             }
  954.         },
  955.         onEffectiveness: function (typeMod, type) {
  956.             if (type === 'Steel') return 1;
  957.         },
  958.         ignoreImmunity: {'Poison': true},
  959.     },
  960. waterspout: {
  961.         inherit: true,
  962.         basePower: 140,
  963.         basePowerCallback: function (pokemon) {
  964.             return 140 * pokemon.hp / pokemon.maxhp;
  965.         },
  966.     },
  967. eruption: {
  968.         inherit: true,
  969.         basePower: 140,
  970.         basePowerCallback: function (pokemon) {
  971.             return 140 * pokemon.hp / pokemon.maxhp;
  972.         },
  973.     },
  974. chargebeam: {
  975.         inherit: true,
  976.         accuracy: 100,
  977.         basePower: 40,
  978.         self: {
  979.             chance: 100,
  980.             boost: {
  981.             spa: 1
  982.             }
  983.         },
  984.     },
  985. slash: {
  986.         inherit: true,
  987.         basePower: 65,
  988.         willCrit: true
  989.         },
  990. muddywater: {
  991.         inherit: true,
  992.         basePower: 80,
  993.         accuracy: 100,
  994.         secondary: {
  995.             chance: 100,
  996.             boosts: {
  997.                 spe: -1
  998.             }
  999.         },
  1000.     },
  1001. powdersnow: {
  1002.         inherit: true,
  1003.         secondary: {
  1004.             chance: 30,
  1005.             status: 'frz',
  1006.         },
  1007. },
  1008. skyuppercut: {
  1009.         inherit: true,
  1010.         basePower: 70,
  1011.         accuracy: 100,
  1012.         onEffectiveness: function (typeMod, type) {
  1013.             if (type === 'Flying') return 0;
  1014.         },
  1015. },
  1016. dizzypunch: {
  1017.         inherit: true,
  1018.         basePower: 80,
  1019.         secondary: {
  1020.             chance: 100,
  1021.             volatileStatus: 'confusion',
  1022.         },
  1023. },
  1024. nightdaze: {
  1025.         inherit: true,
  1026.         basePower: 80,
  1027.         accuracy: 100,
  1028.         selfSwitch: true,
  1029.         secondary: false,
  1030.         },
  1031. relicsong: {
  1032.         inherit: true,
  1033.         basePower: 60,
  1034.         volatileStatus: 'yawn',
  1035.         onHit: function (pokemon) {
  1036.             return undefined;
  1037.         },
  1038.         secondary: {
  1039.             chance: 100,
  1040.             onHit: function (target, source) {
  1041.             target.addVolatile('yawn');
  1042.             }
  1043.         },
  1044.     },
  1045. incinerate: {
  1046.         inherit: true,
  1047.         onBasePowerPriority: 4,
  1048.         onBasePower: function (basePower, pokemon, target) {
  1049.             let item = target.getItem();
  1050.             if ((item.isBerry || item.isGem)) {
  1051.                 return this.chainModify(2);
  1052.             }
  1053.         },
  1054. },
  1055. mysticalfire: {
  1056.         inherit: true,
  1057.         secondary: {
  1058.             chance: 100,
  1059.             boosts: {
  1060.                 spa: -1,
  1061.                 spd: -1
  1062.             }
  1063.         },
  1064.     },
  1065. drillpeck: {
  1066.         inherit: true,
  1067.         critRatio: 2
  1068.         },
  1069. rocksmash: {
  1070.         inherit: true,
  1071.         secondary: {
  1072.             chance: 100,
  1073.             boosts: {
  1074.                 def: -1
  1075.             }
  1076.         },
  1077.     },
  1078. poisontail: {
  1079.         inherit: true,
  1080.         basePower: 60,
  1081.         secondary: {
  1082.             chance: 30,
  1083.             status: 'psn'
  1084.             },
  1085.         },
  1086. payback: {
  1087.         inherit: true,
  1088.         basePower: 65,
  1089.         basePowerCallback: function (pokemon, target) {
  1090.             if (target.newlySwitched) {
  1091.                 this.debug('Payback NOT boosted on a switch');
  1092.                 return 65;
  1093.             }
  1094.             if (this.willMove(target)) {
  1095.                 this.debug('Payback NOT boosted');
  1096.                 return 65;
  1097.             }
  1098.             this.debug('Payback damage boost');
  1099.             return 130;
  1100.         },
  1101.     },
  1102. punishment: {
  1103.         inherit: true,
  1104.         basePower: 0,
  1105.         basePowerCallback: function (pokemon, target) {
  1106.             return 60 + 30 * target.positiveBoosts();
  1107.         },
  1108.     },
  1109. razorshell: {
  1110.         inherit: true,
  1111.         accuracy: 100,
  1112.         secondary: {
  1113.             chance: 100,
  1114.             boosts: {
  1115.                 def: -1
  1116.             }
  1117.         },
  1118.     },
  1119. diamondstorm: {
  1120.         inherit: true,
  1121.         accuracy: 100,
  1122.         secondary: {
  1123.         self: {
  1124.             chance: 100,
  1125.             boosts: {
  1126.             def: 1
  1127.             }
  1128.         }
  1129.     }
  1130. },
  1131. fellstinger: {
  1132.         inherit: true,
  1133.         basePower: 20,
  1134.         priority: 1
  1135.         },
  1136. landswrath: {
  1137.         inherit: true,
  1138.         onHit: function (target) {
  1139.             target.clearBoosts();
  1140.             this.add('-clearboost', target);
  1141.         },
  1142.     },
  1143. mistball: {
  1144.         inherit: true,
  1145.         secondary: {
  1146.             chance: 100,
  1147.             boosts: {
  1148.                 spa: -1
  1149.             }
  1150.         },
  1151.     },
  1152. lusterpurge: {
  1153.         inherit: true,
  1154.         secondary: {
  1155.             chance: 100,
  1156.             boosts: {
  1157.                 spd: -1
  1158.             }
  1159.         },
  1160.     },
  1161. skyattack: {
  1162.         inherit: true,
  1163.         accuracy: 100,
  1164.         onTry: function (attacker, defender, move) {
  1165.             if (attacker.removeVolatile(move.id)) {
  1166.                 return;
  1167.             }
  1168.             this.add('-prepare', attacker, move.name, defender);
  1169.             this.boost({spe:1, atk:1}, attacker, attacker, this.getMove('skyattack'));
  1170.             if (!this.runEvent('ChargeMove', attacker, defender, move)) {
  1171.                 this.add('-anim', attacker, move.name, defender);
  1172.                 attacker.removeVolatile(move.id);
  1173.                 return;
  1174.             }
  1175.             attacker.addVolatile('twoturnmove', defender);
  1176.             return null;
  1177.         },
  1178.         secondary: {
  1179.             chance: 30,
  1180.             status: 'brn',
  1181.         },
  1182. },
  1183. wideguard: {
  1184.         inherit: true,
  1185.         effect: {
  1186.             duration: 1,
  1187.             onStart: function (target, source) {
  1188.                 this.add('-singleturn', source, 'Wide Guard');
  1189.             },
  1190.             onTryHitPriority: 4,
  1191.             onTryHit: function (target, source, effect) {
  1192.                 // Wide Guard blocks spread moves
  1193.                 if (effect && (effect.target !== 'allAdjacent' && effect.target !== 'allAdjacentFoes')) {
  1194.                     return;
  1195.                 }
  1196.                 this.add('-activate', target, 'Wide Guard');
  1197.                 var lockedmove = source.getVolatile('lockedmove');
  1198.                 if (lockedmove) {
  1199.                     // Outrage counter is reset
  1200.                     if (source.volatiles['lockedmove'].duration === 2) {
  1201.                         delete source.volatiles['lockedmove'];
  1202.                     }
  1203.                 }
  1204.                 return null;
  1205.             }
  1206.         },
  1207.     },
  1208. teleport: {
  1209.         inherit: true,
  1210.         onTryHit: true,
  1211.         effect: {
  1212.             duration: 1,
  1213.             onStart: function (target) {
  1214.                 this.add('-start', target, 'Teleport');
  1215.             },
  1216.             onAnyTryMove: function (target, source, move) {
  1217.             if (move && move.id === 'Pursuit') {
  1218.                 this.attrLastMove('[still]');
  1219.                 this.add('-activate', this.effectData.target, 'move: Teleport');
  1220.                 return false;
  1221.             }
  1222.         },
  1223.         },
  1224.         priority: 1,
  1225.         selfSwitch: true,
  1226.         },
  1227. present: {
  1228.         inherit: true,
  1229.         category: "Status",
  1230.         accuracy: 100,
  1231.         basePower: 0,
  1232.         priority: 3,
  1233.         volatileStatus: 'present',
  1234.         onModifyMove: function (move) {
  1235.             move.category === "Status"
  1236.         },
  1237.         effect: {
  1238.             duration: 1,
  1239.             onStart: function (target) {
  1240.                 this.add('-start', target, 'Present');
  1241.             },
  1242.             onTryMove: function (pokemon, target, move) {
  1243.                 if (move.category === 'Status') {
  1244.                     this.add('-activate', pokemon, 'Present');
  1245.                     this.damage(this.clampIntRange(Math.round(pokemon.maxhp / 2), 1));
  1246.                     return false;
  1247.                 }
  1248.             }
  1249.         },
  1250.     },
  1251. ominouswind: {
  1252.         inherit: true,
  1253.         priority: -3,
  1254.         flags: {protect:1},
  1255.         beforeTurnCallback: function (pokemon) {
  1256.             pokemon.addVolatile('ominouswind');
  1257.         },
  1258.         beforeMoveCallback: function (pokemon) {
  1259.             if (!pokemon.removeVolatile('ominouswind')) {
  1260.                 return false;
  1261.             }
  1262.             if (pokemon.lastAttackedBy && pokemon.lastAttackedBy.thisTurn && pokemon.lastAttackedBy.damage > 0 && this.getMove(pokemon.lastAttackedBy.move).category !== 'Status') {
  1263.                 this.add('cant', pokemon, 'Ominous Wind', 'Ominous Wind');
  1264.                 return true;
  1265.             }
  1266.         },
  1267.         effect: {
  1268.             duration: 1,
  1269.             onStart: function (pokemon) {
  1270.                 this.add('-singleturn', pokemon, 'move: Ominous Wind');
  1271.             }
  1272.         },
  1273.     secondary: {
  1274.             chance: 100,
  1275.             self: {
  1276.                 boosts: {
  1277.                     atk: 1,
  1278.                     def: 1,
  1279.                     spa: 1,
  1280.                     spd: 1,
  1281.                     spe: 1
  1282.                 }
  1283.             },
  1284.         },
  1285.     },
  1286. silverwind: {
  1287.         inherit: true,
  1288.         priority: -3,
  1289.         flags: {protect:1},
  1290.         beforeTurnCallback: function (pokemon) {
  1291.             pokemon.addVolatile('silverwind');
  1292.         },
  1293.         beforeMoveCallback: function (pokemon) {
  1294.             if (!pokemon.removeVolatile('silverwind')) {
  1295.                 return false;
  1296.             }
  1297.             if (pokemon.lastAttackedBy && pokemon.lastAttackedBy.thisTurn && pokemon.lastAttackedBy.damage > 0 && this.getMove(pokemon.lastAttackedBy.move).category !== 'Status') {
  1298.                 this.add('cant', pokemon, 'Silver Wind', 'Silver Wind');
  1299.                 return true;
  1300.             }
  1301.         },
  1302.         effect: {
  1303.             duration: 1,
  1304.             onStart: function (pokemon) {
  1305.                 this.add('-singleturn', pokemon, 'move: Silver Wind');
  1306.             }
  1307.         },
  1308.     secondary: {
  1309.             chance: 100,
  1310.             self: {
  1311.                 boosts: {
  1312.                     atk: 1,
  1313.                     def: 1,
  1314.                     spa: 1,
  1315.                     spd: 1,
  1316.                     spe: 1
  1317.                 }
  1318.             },
  1319.         },
  1320.     },
  1321. ancientpower: {
  1322.         inherit: true,
  1323.         priority: -3,
  1324.         flags: {protect:1},
  1325.         beforeTurnCallback: function (pokemon) {
  1326.             pokemon.addVolatile('ancientpower');
  1327.         },
  1328.         beforeMoveCallback: function (pokemon) {
  1329.             if (!pokemon.removeVolatile('ancientpower')) {
  1330.                 return false;
  1331.             }
  1332.             if (pokemon.lastAttackedBy && pokemon.lastAttackedBy.thisTurn && pokemon.lastAttackedBy.damage > 0 && this.getMove(pokemon.lastAttackedBy.move).category !== 'Status') {
  1333.                 this.add('cant', pokemon, 'Ancient Power', 'Ancient Power');
  1334.                 return true;
  1335.             }
  1336.         },
  1337.         effect: {
  1338.             duration: 1,
  1339.             onStart: function (pokemon) {
  1340.                 this.add('-singleturn', pokemon, 'move: Ancient Power');
  1341.             }
  1342.         },
  1343.     secondary: {
  1344.             chance: 100,
  1345.             self: {
  1346.                 boosts: {
  1347.                     atk: 1,
  1348.                     def: 1,
  1349.                     spa: 1,
  1350.                     spd: 1,
  1351.                     spe: 1
  1352.                 }
  1353.             },
  1354.         },
  1355.     },
  1356. endure: {
  1357.         inherit: true,
  1358.         onTryHit: function (pokemon) {
  1359.             return this.willAct() && this.runEvent('StallMove', pokemon);
  1360.         },
  1361.         onHit: function (pokemon) {
  1362.             pokemon.addVolatile('stall');
  1363.         },
  1364.         effect: {
  1365.             duration: 1,
  1366.             onStart: function (target) {
  1367.                 this.add('-singleturn', target, 'move: Endure');
  1368.             },
  1369.             onDamagePriority: -10,
  1370.             onDamage: function (damage, target, source, effect) {
  1371.                 if (effect && effect.effectType === 'Move' && damage >= target.hp) {
  1372.                     this.add('-activate', target, 'move: Endure');
  1373.                     return target.hp - 1;
  1374.                 }
  1375.             },
  1376.             onHit: function (target, source, move) {
  1377.                 if (target !== source && move.category !== 'Status') {
  1378.                 this.boost({spe:1});
  1379.                 }
  1380.             }
  1381.         },
  1382.     },
  1383. charge: {
  1384.         inherit: true,
  1385.         effect: {
  1386.             onBasePowerPriority: 3,
  1387.             onBasePower: function (basePower, attacker, defender, move) {
  1388.                 if (move.type === 'Electric') {
  1389.                     this.debug('charge boost');
  1390.                     return this.chainModify(2);
  1391.                 }
  1392.             }
  1393.         },
  1394.     },
  1395. aromaticmist: {
  1396.         inherit: true,
  1397.         target: "AllySide",
  1398.         },
  1399. uproar: {
  1400.         inherit: true,
  1401.         basePower: 80,
  1402.         sleepUsable: true,
  1403.         target: "Normal",
  1404.         self: {
  1405.             volatileStatus: 'uproar',
  1406.         },
  1407.         onTryHit: function (target) {
  1408.             for (let i = 0; i < target.side.active.length; i++) {
  1409.                 let allyActive = target.side.active[i];
  1410.                 if (allyActive && allyActive.status === 'slp') allyActive.cureStatus();
  1411.                 let foeActive = target.side.foe.active[i];
  1412.                 if (foeActive && foeActive.status === 'slp') foeActive.cureStatus();
  1413.             }
  1414.         },
  1415.         effect: {
  1416.             duration: 3,
  1417.             onStart: function (target) {
  1418.                 this.add('-start', target, 'Uproar');
  1419.             },
  1420.             onResidual: function (target) {
  1421.                 if (target.lastMove === 'struggle') {
  1422.                     // don't lock
  1423.                     delete target.volatiles['uproar'];
  1424.                 }
  1425.                 this.add('-start', target, 'Uproar', '[upkeep]');
  1426.             },
  1427.             onEnd: function (target) {
  1428.                 this.add('-end', target, 'Uproar');
  1429.             },
  1430.             onAnySetStatus: function (status, pokemon) {
  1431.                 if (status.id === 'slp') {
  1432.                     if (pokemon === this.effectData.target) {
  1433.                         this.add('-fail', pokemon, 'slp', '[from] Uproar', '[msg]');
  1434.                     } else {
  1435.                         this.add('-fail', pokemon, 'slp', '[from] Uproar');
  1436.                     }
  1437.                     return null;
  1438.                 }
  1439.             },
  1440.             onAnyTryHit: function (target, source, move) {
  1441.                 if (move && move.id === 'yawn') {
  1442.                     return false;
  1443.                 }
  1444.             },
  1445.         },
  1446.         onBasePower: function (basePower, pokemon) {
  1447.             if (pokemon.status && pokemon.status == 'slp') {
  1448.                 return this.chainModify(2);
  1449.             }
  1450.         },
  1451.     },
  1452. swallow: {
  1453.         inherit: true,
  1454.         onHit: function (pokemon) {
  1455.             var healAmount = [0.20, 0.40, 0.60];
  1456.             this.heal(this.modify(pokemon.maxhp, healAmount[(pokemon.volatiles['stockpile'].layers)]));
  1457.         },
  1458.     },
  1459. spitup: {
  1460.         inherit: true,
  1461.         basePower: 0,
  1462.         basePowerCallback: function (pokemon) {
  1463.             return pokemon.volatiles['stockpile'].layers * 50
  1464.         },
  1465.         onAfterMove: false,
  1466.     },
  1467. flyingpress: {
  1468.         inherit: true,
  1469.         accuracy: 100,
  1470.         onEffectiveness: function (typeMod, type) {
  1471.             if (type === 'Bug') return 1;
  1472.             if (type === 'Grass') return 1;
  1473.             if (type === 'Fighting') return 1;
  1474.         },
  1475.     },
  1476. horndrill: {
  1477.     inherit: true,
  1478.     accuracy: true,
  1479.     priority: -3,
  1480.     onTry: function (pokemon, target) {
  1481.                 if (target.status !== 'par') {
  1482.                     return false;
  1483.                 }
  1484.             },
  1485. },
  1486. fissure: {
  1487.     inherit: true,
  1488.     accuracy: true,
  1489.     priority: -3,
  1490.     onTry: function (pokemon, target) {
  1491.                 if (target.status !== 'par') {
  1492.                     return false;
  1493.                 }
  1494.             },
  1495. },
  1496. guillotine: {
  1497.     inherit: true,
  1498.     accuracy: true,
  1499.     priority: -3,
  1500.     onTry: function (pokemon, target) {
  1501.                 if (target.status !== 'slp') {
  1502.                     return false;
  1503.                 }
  1504.             },
  1505. },
  1506. sheercold: {
  1507.     inherit: true,
  1508.     accuracy: true,
  1509.     priority: -3,
  1510.     onTry: function (pokemon, target) {
  1511.                 if (target.status !== 'frz') {
  1512.                     return false;
  1513.                 }
  1514.             },
  1515. },
  1516. technoblast: {
  1517.         inherit: true,
  1518.         type: 'Steel',
  1519.         onModifyMove: function (move, pokemon) {
  1520.             move.type = this.runEvent('Drive', pokemon, null, 'technoblast', 'Steel');
  1521.         },
  1522. },
  1523. phantomforce: {
  1524.         inherit: true,
  1525.         onTry: function (attacker, defender, move) {
  1526.             if (attacker.removeVolatile(move.id)) {
  1527.                 return;
  1528.             }
  1529.             this.add('-prepare', attacker, move.name, defender);
  1530.             if (this.isWeather(['distortion']) || !this.runEvent('ChargeMove', attacker, defender, move)) {
  1531.                 this.add('-anim', attacker, move.name, defender);
  1532.                 return;
  1533.             }
  1534.             attacker.addVolatile('twoturnmove', defender);
  1535.             return null;
  1536.         },
  1537. },
  1538. shadowforce: {
  1539.         inherit: true,
  1540.         onTry: function (attacker, defender, move) {
  1541.             if (attacker.removeVolatile(move.id)) {
  1542.                 return;
  1543.             }
  1544.             this.add('-prepare', attacker, move.name, defender);
  1545.             if (this.isWeather(['distortion']) || !this.runEvent('ChargeMove', attacker, defender, move)) {
  1546.                 this.add('-anim', attacker, move.name, defender);
  1547.                 return;
  1548.             }
  1549.             attacker.addVolatile('twoturnmove', defender);
  1550.             return null;
  1551.         },
  1552. },
  1553. venomdrench: {
  1554.         inherit: true,
  1555.         flags: {},
  1556.         pseudoWeather: 'venomdrench',
  1557.         onHit: function (target) {
  1558.             return true;
  1559.         },
  1560.         effect: {
  1561.             duration: 5,
  1562.             onStart: function (target, source) {
  1563.                 this.add('-fieldstart', 'move: Venom Drench');
  1564.             },
  1565.             onResidualOrder: 5,
  1566.             onResidualSubOrder: 2,
  1567.             onResidual: function (battle) {
  1568.                 this.debug('onResidual battle');
  1569.                 let pokemon;
  1570.                 for (let s in battle.sides) {
  1571.                     for (let p in battle.sides[s].active) {
  1572.                         pokemon = battle.sides[s].active[p];
  1573.                         if (pokemon.status === 'psn' || pokemon.status === 'tox') {
  1574.                             this.boost({spe:-1}, pokemon, pokemon);
  1575.                             this.boost({atk:-1}, pokemon, pokemon);
  1576.                             this.boost({spa:-1}, pokemon, pokemon);
  1577.                         }
  1578.                     }
  1579.                 }
  1580.             }
  1581.         },
  1582.         onResidualOrder: 21,
  1583.             onEnd: function (battle) {
  1584.                 this.add('-fieldend', 'move: Venom Drench');
  1585.         },
  1586.         target: "all"
  1587. },
  1588. sleeptalk: {
  1589.         inherit: true,
  1590.         onHit: function (pokemon) {
  1591.             let moves = [];
  1592.             for (let i = 0; i < pokemon.moveset.length; i++) {
  1593.                 let move = pokemon.moveset[i].id;
  1594.                 let NoSleepTalk = {
  1595.                     assist:1, belch:1, bide:1, chatter:1, copycat:1, focuspunch:1, mefirst:1, metronome:1, mimic:1, mirrormove:1, naturepower:1, sketch:1, sleeptalk:1, uproar:1, silverwind:1, ominouswind:1, ancientpower:1, dragontail:1, circlethrow:1,
  1596.                 };
  1597.                 if (move && !(NoSleepTalk[move] || this.getMove(move).flags['charge'] || this.getMove(move).category === 'Status')) {
  1598.                     moves.push(move);
  1599.                 }
  1600.             }
  1601.             let randomMove = '';
  1602.             if (moves.length) randomMove = moves[this.random(moves.length)];
  1603.             if (!randomMove) {
  1604.                 return false;
  1605.             }
  1606.             this.useMove(randomMove, pokemon);
  1607.         },
  1608. },
  1609. curse: {
  1610.         inherit: true,
  1611.         onHit: function (target, source) {
  1612.             this.directDamage(source.maxhp / 3, source, source);
  1613.         },
  1614. },
  1615. freezeshock: {
  1616.         inherit: true,
  1617.         onTry: true,
  1618.         basePower: 100,
  1619.         accuracy: 100,
  1620.         onEffectiveness: function (typeMod, type) {
  1621.             if (type === 'Water') return 1;
  1622.         },
  1623. },
  1624. iceburn: {
  1625.         inherit: true,
  1626.         onTry: true,
  1627.         basePower: 100,
  1628.         accuracy: 100,
  1629.         onEffectiveness: function (typeMod, type) {
  1630.             if (type === 'Steel') return 1;
  1631.         },
  1632. },
  1633. detect: {
  1634.         inherit: true,
  1635.         volatileStatus: 'detect',
  1636.         effect: {
  1637.             duration: 1,
  1638.             onStart: function (target) {
  1639.                 this.add('-singleturn', target, 'Protect');
  1640.             },
  1641.             onTryHitPriority: 3,
  1642.             onTryHit: function (target, source, move) {
  1643.                 if (!move.flags['protect']) return;
  1644.                 this.add('-activate', target, 'Protect');
  1645.                 let lockedmove = source.getVolatile('lockedmove');
  1646.                 if (lockedmove) {
  1647.                     // Outrage counter is reset
  1648.                     if (source.volatiles['lockedmove'].duration === 2) {
  1649.                         delete source.volatiles['lockedmove'];
  1650.                     }
  1651.                 }
  1652.                 if (move.flags['protect']) {
  1653.                     this.boost({spe:-2}, source, target, this.getMove("Detect"));
  1654.                 }
  1655.                 return null;
  1656.             },
  1657.         },
  1658. },
  1659. mudsport: {
  1660.         inherit: true,
  1661.         onHitField: null,
  1662.         onHit: function (target) {
  1663.             if (target.hasType('Ground')) return false;
  1664.             if (!target.addType('Ground')) return false;
  1665.             this.add('-start', target, 'typeadd', 'Ground', '[from] move: Mud Sport');
  1666.         },
  1667.         target: 'self'
  1668. },
  1669. watersport: {
  1670.         inherit: true,
  1671.         onHitField: null,
  1672.         onHit: function (target) {
  1673.             if (target.hasType('Water')) return false;
  1674.             if (!target.addType('Water')) return false;
  1675.             this.add('-start', target, 'typeadd', 'Ground', '[from] move: Water Sport');
  1676.         },
  1677.         target: 'self'
  1678. },
  1679. defog: {
  1680.     inherit: true,
  1681.     flags: {reflectable: 1, mirror: 1, authentic: 1},
  1682. },
  1683. ingrain: {
  1684.         inherit: true,
  1685.         effect: {
  1686.             onStart: function (pokemon) {
  1687.                 this.add('-start', pokemon, 'move: Ingrain');
  1688.             },
  1689.             onResidualOrder: 7,
  1690.             onResidual: function (pokemon) {
  1691.                 this.heal(pokemon.maxhp / 16);
  1692.             },
  1693.             onSwitchOut: function (pokemon) {
  1694.                 if (!pokemon.hasType('Ghost') && !pokemon.hasAbility('runaway') && !pokemon.hasItem('shedshell')) {
  1695.                 this.damage(pokemon.maxhp / 8);
  1696.                 }
  1697.             },
  1698.             onNegateImmunity: function (pokemon, type) {
  1699.                 if (type === 'Ground') return false;
  1700.             },
  1701.             onDragOut: function (pokemon) {
  1702.                 this.add('-activate', pokemon, 'move: Ingrain');
  1703.                 return null;
  1704.             },
  1705.         },
  1706. },
  1707. solarbeam: {
  1708.         inherit: true,
  1709.         onBasePowerPriority: 4,
  1710.         onBasePower: function (basePower, pokemon, target) {
  1711.             if (this.isWeather(['raindance', 'primordialsea', 'sandstorm', 'hail', 'iceage'])) {
  1712.                 this.debug('weakened by weather');
  1713.                 return this.chainModify(0.5);
  1714.             }
  1715.         },
  1716. },
  1717. poisonjab: {
  1718.         inherit: true,
  1719.         basePowerCallback: function (move, pokemon) {
  1720.             if (pokemon.template.species === 'Beedrill' || pokemon.template.species === 'Beedrill-Mega') {
  1721.                 return 100;
  1722.             }
  1723.             else {
  1724.                 return 80;
  1725.             }
  1726.         },
  1727.         onModifyMovePriority: 5,
  1728.         onModifyMove: function (move, pokemon) {
  1729.             if (pokemon.template.species === 'Beedrill' || pokemon.template.species === 'Beedrill-Mega') {
  1730.                 if (!move.ignoreImmunity) move.ignoreImmunity = {};
  1731.                 if (move.ignoreImmunity !== true) {
  1732.                 move.ignoreImmunity['Poison'] = true;
  1733.             }
  1734.             }
  1735.         },
  1736.         onEffectiveness: function (typeMod, type) {
  1737.             if (type === 'Steel') return 1;
  1738.         },
  1739. },
  1740. attract: {
  1741.         inherit: true,
  1742.         effect: {
  1743.             noCopy: true, // doesn't get copied by Baton Pass
  1744.             onStart: function (pokemon, source, effect) {
  1745.                 if (!(pokemon.gender === 'M' && source.gender === 'F') && !(pokemon.gender === 'F' && source.gender === 'M')) {
  1746.                     this.debug('incompatible gender');
  1747.                     return false;
  1748.                 }
  1749.                 if (!this.runEvent('Attract', pokemon, source)) {
  1750.                     this.debug('Attract event failed');
  1751.                     return false;
  1752.                 }
  1753.  
  1754.                 if (effect.id === 'cutecharm') {
  1755.                     this.add('-start', pokemon, 'Attract', '[from] ability: Cute Charm', '[of] ' + source);
  1756.                 } else if (effect.id === 'destinyknot') {
  1757.                     this.add('-start', pokemon, 'Attract', '[from] item: Destiny Knot', '[of] ' + source);
  1758.                 } else {
  1759.                     this.add('-start', pokemon, 'Attract');
  1760.                 }
  1761.             },
  1762.             onUpdate: function (pokemon) {
  1763.                 if (this.effectData.source && !this.effectData.source.isActive && pokemon.volatiles['attract']) {
  1764.                     this.debug('Removing Attract volatile on ' + pokemon);
  1765.                     pokemon.removeVolatile('attract');
  1766.                 }
  1767.             },
  1768.             onBasePowerPriority: 2,
  1769.             onBasePower: function (basePower, attacker, defender, move) {
  1770.                 return this.chainModify(0.5);
  1771.             },
  1772.             onEnd: function (pokemon) {
  1773.                 this.add('-end', pokemon, 'Attract', '[silent]');
  1774.             },
  1775.         },
  1776. },
  1777. grassyterrain: {
  1778.         inherit: true,
  1779.         effect: {
  1780.             duration: 5,
  1781.             onBasePower: function (basePower, attacker, defender, move) {
  1782.                 var weakenedMoves = {'earthquake':1, 'bulldoze':1, 'magnitude':1};
  1783.                 if (move.id in weakenedMoves) {
  1784.                     this.debug('move weakened by grassy terrain');
  1785.                     return this.chainModify(0.5);
  1786.                 }
  1787.                 if (attacker.hasType('Grass') && attacker.isGrounded()) {
  1788.                     this.debug('grassy terrain boost');
  1789.                     return this.chainModify(1.3);
  1790.                 }
  1791.             },
  1792.             onStart: function (target, source) {
  1793.                 this.add('-fieldstart', 'move: Grassy Terrain');
  1794.             },
  1795.             onResidualOrder: 5,
  1796.             onResidualSubOrder: 2,
  1797.             onResidual: function (battle) {
  1798.                 this.debug('onResidual battle');
  1799.                 var pokemon;
  1800.                 for (var s in battle.sides) {
  1801.                     for (var p in battle.sides[s].active) {
  1802.                         pokemon = battle.sides[s].active[p];
  1803.                         if (pokemon.isGrounded() && !pokemon.isSemiInvulnerable()) {
  1804.                             this.debug('Pokemon is grounded, healing through Grassy Terrain.');
  1805.                             this.heal(pokemon.maxhp / 8, pokemon, pokemon);
  1806.                         }
  1807.                     }
  1808.                 }
  1809.             },
  1810.             onEnd: function () {
  1811.                 this.add('-fieldend', 'move: Grassy Terrain');
  1812.             }
  1813.         },
  1814.     },
  1815. mistyterrain: {
  1816.         inherit: true,
  1817.         effect: {
  1818.             duration: 5,
  1819.             onSetStatus: function (status, target, source, effect) {
  1820.                 if (!target.isGrounded() || target.isSemiInvulnerable()) return;
  1821.                 this.debug('misty terrain preventing status');
  1822.                 return false;
  1823.             },
  1824.             onBasePower: function (basePower, attacker, defender, move) {
  1825.                 if (attacker.hasType('Dragon') && attacker.isGrounded() && !defender.isSemiInvulnerable()) {
  1826.                     this.debug('misty terrain weaken');
  1827.                     return this.chainModify(0.5);
  1828.                 }
  1829.                 if (attacker.hasType('Fairy') && attacker.isGrounded()) {
  1830.                     this.debug('misty terrain boost');
  1831.                     return this.chainModify(1.3);
  1832.                 }
  1833.             },
  1834.             onStart: function (side) {
  1835.                 this.add('-fieldstart', 'Misty Terrain');
  1836.             },
  1837.             onResidualOrder: 21,
  1838.             onResidualSubOrder: 2,
  1839.             onEnd: function (side) {
  1840.                 this.add('-fieldend', 'Misty Terrain');
  1841.             }
  1842.         },
  1843.     },
  1844. electricterrain: {
  1845.         inherit: true,
  1846.         effect: {
  1847.             duration: 5,
  1848.             onSetStatus: function (status, target, source, effect) {
  1849.                 if (status.id === 'slp' && target.isGrounded() && !target.isSemiInvulnerable()) {
  1850.                     this.debug('interrupting sleep from Electric Terrain');
  1851.                     return false;
  1852.                 }
  1853.             },
  1854.             onTryHit: function (target, source, move) {
  1855.                 if (!target.isGrounded() || target.isSemiInvulnerable()) return;
  1856.                 if (move && move.id === 'yawn') {
  1857.                     return false;
  1858.                 }
  1859.             },
  1860.             onBasePower: function (basePower, attacker, defender, move) {
  1861.                 if (attacker.hasType('Electric') && attacker.isGrounded() && !attacker.isSemiInvulnerable()) {
  1862.                     this.debug('electric terrain boost');
  1863.                     return this.chainModify(1.3);
  1864.                 }
  1865.             },
  1866.             onUpdate: function (pokemon) {
  1867.             if (pokemon.status === 'slp' && pokemon.isGrounded() && !pokemon.isSemiInvulnerable()) {
  1868.                 pokemon.cureStatus();
  1869.             }
  1870.         },
  1871.             onStart: function () {
  1872.                 this.add('-fieldstart', 'move: Electric Terrain');
  1873.             },
  1874.             onResidualOrder: 21,
  1875.             onResidualSubOrder: 2,
  1876.             onEnd: function () {
  1877.                 this.add('-fieldend', 'move: Electric Terrain');
  1878.             }
  1879.         },
  1880.     },
  1881. };
  1882.  
  1883. /*mods/ghoulking/statuses.js*/
  1884.  
  1885. 'use strict';
  1886.  
  1887. exports.BattleStatuses = {
  1888. par: {
  1889.         effectType: 'Status',
  1890.         onStart: function (target) {
  1891.             this.add('-status', target, 'par');
  1892.         },
  1893.         onModifySpe: function (spe, pokemon) {
  1894.             if (!pokemon.hasAbility('quickfeet')) {
  1895.                 return this.chainModify(0.25);
  1896.             }
  1897.         },
  1898.         onResidualOrder: 9,
  1899.         onResidual: function (pokemon) {
  1900.             this.boost({evasion:-1});
  1901.         },
  1902.     },
  1903. psn: {
  1904.         effectType: 'Status',
  1905.         onStart: function (target) {
  1906.             this.add('-status', target, 'psn');
  1907.         },
  1908.         onResidualOrder: 9,
  1909.         onResidual: function (pokemon) {
  1910.             this.damage(pokemon.maxhp / 6);
  1911.         }
  1912.     },
  1913. slp: {
  1914.         effectType: 'Status',
  1915.         onStart: function (target) {
  1916.             this.add('-status', target, 'slp');
  1917.             // 1-3 turns
  1918.             this.effectData.startTime = this.random(2, 5);
  1919.             this.effectData.time = this.effectData.startTime;
  1920.         },
  1921.         onBeforeMovePriority: 10,
  1922.         onBeforeMove: function (pokemon, target, move) {
  1923.             if (pokemon.hasAbility('earlybird')) {
  1924.                 pokemon.statusData.time--;
  1925.             }
  1926.             pokemon.statusData.time--;
  1927.             if (pokemon.statusData.time <= 0) {
  1928.                 pokemon.cureStatus();
  1929.                 return;
  1930.             }
  1931.             this.add('cant', pokemon, 'slp');
  1932.             if (move.sleepUsable || move.category === 'Status' || move.category === 'Special' && pokemon.template.speciesid === 'darmanitanzen') {
  1933.                 return;
  1934.             }
  1935.             return false;
  1936.         },
  1937.     },
  1938. frz: {
  1939.         effectType: 'Status',
  1940.         onStart: function (target) {
  1941.             this.add('-status', target, 'frz');
  1942.             if (target.template.species === 'Shaymin-Sky' && target.baseTemplate.baseSpecies === 'Shaymin') {
  1943.                 let template = this.getTemplate('Shaymin');
  1944.                 target.formeChange(template);
  1945.                 target.baseTemplate = template;
  1946.                 target.setAbility(template.abilities['0']);
  1947.                 target.baseAbility = target.ability;
  1948.                 target.details = template.species + (target.level === 100 ? '' : ', L' + target.level) + (target.gender === '' ? '' : ', ' + target.gender) + (target.set.shiny ? ', shiny' : '');
  1949.                 this.add('detailschange', target, target.details);
  1950.                 this.add('-formechange', target, 'Shaymin', '[msg]');
  1951.             }
  1952.         },
  1953.         onResidualOrder: 9,
  1954.         onResidual: function (pokemon) {
  1955.             this.boost({spe:-1});
  1956.             this.boost({atk:-1});
  1957.             this.boost({def:-1});
  1958.             this.boost({spa:-1});
  1959.             this.boost({spd:-1});
  1960.         },
  1961.         onModifyMove: function (move, pokemon) {
  1962.             if (move.flags['defrost']) {
  1963.                 this.add('-curestatus', pokemon, 'frz', '[from] move: ' + move);
  1964.                 pokemon.setStatus('');
  1965.             }
  1966.         },
  1967.         onHit: function (target, source, move) {
  1968.             if (move.thawsTarget || move.type === 'Fire' && move.category !== 'Status') {
  1969.                 target.cureStatus();
  1970.             }
  1971.         },
  1972.     },
  1973. flinch: {
  1974.         duration: 1,
  1975.         onBasePower: function (basePower, user, target, move) {
  1976.             return this.chainModify([0.75]);
  1977.         },
  1978.     },
  1979. trapped: {
  1980.         onSwitchOut: function (pokemon) {
  1981.             if (!pokemon.hasAbility('runaway') && !pokemon.hasItem('shedshell')) {
  1982.             this.damage(pokemon.maxhp / 8);
  1983.             }
  1984.     },
  1985. },
  1986. partiallytrapped: {
  1987.         duration: 5,
  1988.         durationCallback: function (target, source) {
  1989.             if (source.hasItem('gripclaw')) return 8;
  1990.             return this.random(5, 7);
  1991.         },
  1992.         onStart: function (pokemon, source) {
  1993.             this.add('-activate', pokemon, 'move: ' + this.effectData.sourceEffect, '[of] ' + source);
  1994.         },
  1995.         onResidualOrder: 11,
  1996.         onResidual: function (pokemon) {
  1997.             if (this.effectData.source && (!this.effectData.source.isActive || this.effectData.source.hp <= 0)) {
  1998.                 delete pokemon.volatiles['partiallytrapped'];
  1999.                 return;
  2000.             }
  2001.             if (this.effectData.source.hasItem('bindingband')) {
  2002.                 this.damage(pokemon.maxhp / 6);
  2003.             } else {
  2004.                 this.damage(pokemon.maxhp / 8);
  2005.             }
  2006.         },
  2007.         onEnd: function (pokemon) {
  2008.             this.add('-end', pokemon, this.effectData.sourceEffect, '[partiallytrapped]');
  2009.         },
  2010.         onSwitchOut: function (pokemon) {
  2011.             if (!pokemon.hasType('Ghost') && !pokemon.hasAbility('runaway') && !pokemon.hasItem('shedshell')){
  2012.             this.damage(pokemon.maxhp / 8);
  2013.             }
  2014.         },
  2015.     },
  2016. confusion: {
  2017.         // this is a volatile status
  2018.         onStart: function (target, source, sourceEffect) {
  2019.             let result = this.runEvent('TryConfusion', target, source, sourceEffect);
  2020.             if (!result) return result;
  2021.             if (sourceEffect && sourceEffect.id === 'lockedmove') {
  2022.                 this.add('-start', target, 'confusion', '[fatigue]');
  2023.             } else {
  2024.                 this.add('-start', target, 'confusion');
  2025.             }
  2026.             this.effectData.time = this.random(2, 6);
  2027.         },
  2028.         onEnd: function (target) {
  2029.             this.add('-end', target, 'confusion');
  2030.         },
  2031.         onBeforeMove: function (pokemon) {
  2032.             pokemon.volatiles.confusion.time--;
  2033.             if (!pokemon.volatiles.confusion.time) {
  2034.                 pokemon.removeVolatile('confusion');
  2035.                 return;
  2036.             }
  2037.             this.damage(this.getDamage(pokemon, pokemon, 50), pokemon, pokemon, {
  2038.                 id: 'confused',
  2039.                 effectType: 'Move',
  2040.                 type: '???',
  2041.             });
  2042.         },
  2043.     },
  2044. faked: {
  2045.         duration: 1,
  2046.         onBeforeMovePriority: 8,
  2047.         onBeforeMove: function (pokemon) {
  2048.             if (!this.runEvent('Faked', pokemon) || pokemon.hasAbility('Inner Focus')) {
  2049.                 return;
  2050.             }
  2051.             this.add('cant', pokemon, 'faked out');
  2052.             return false;
  2053.     },
  2054. },
  2055. iceage: {
  2056.         effectType: 'Weather',
  2057.         duration: 0,
  2058.         onEffectiveness: function (typeMod, target, type, move) {
  2059.             if (move && move.effectType === 'Move' && type === 'Ice' && typeMod > 0) {
  2060.                 this.add('-activate', '', 'iceage');
  2061.                 return 0;
  2062.             }
  2063.         },
  2064.         onStart: function (battle, source, effect) {
  2065.             this.add('-weather', 'IceAge', '[from] ability: ' + effect, '[of] ' + source);
  2066.         },
  2067.         onResidualOrder: 1,
  2068.         onResidual: function () {
  2069.             this.add('-weather', 'IceAge', '[upkeep]');
  2070.             this.eachEvent('Weather');
  2071.         },
  2072.         onWeather: function (target) {
  2073.             this.damage(target.maxhp / 16);
  2074.         },
  2075.         onEnd: function (battle, effect) {
  2076.             this.add('-weather', 'none');
  2077.         },
  2078.     },
  2079. distortion: {
  2080.         effectType: 'Weather',
  2081.         duration: 5,
  2082.         onStart: function (battle, source, effect) {
  2083.             this.add('-weather', 'Distortion', '[from] ability: ' + effect, '[of] ' + source);
  2084.         },
  2085.         onBoost: function (boost, pokemon) {
  2086.             if (!pokemon.hasType('Ghost')) {
  2087.             for (let i in boost) {
  2088.                 boost[i] *= -1;
  2089.             }
  2090.         }
  2091.     },
  2092.     onEnd: function (battle, effect) {
  2093.             this.add('-weather', 'none');
  2094.         },
  2095. },
  2096. meloetta: {
  2097.         // Meloetta: Fluidity
  2098.         onStart: function (pokemon) {
  2099.             if (pokemon.ability === 'serenegrace') {
  2100.                 pokemon.ability = 'fluidity';
  2101.                 pokemon.baseAbility = 'fluidity';
  2102.             }
  2103.         },
  2104.     },
  2105. moltres: {
  2106.         // Moltres: Well of Power
  2107.         onStart: function (pokemon) {
  2108.             if (pokemon.ability === 'galewings') {
  2109.                 pokemon.ability = 'wellofpower';
  2110.                 pokemon.baseAbility = 'wellofpower';
  2111.             }
  2112.         },
  2113.     },
  2114. articuno: {
  2115.         // Articuno: Ice Age
  2116.         onStart: function (pokemon) {
  2117.             if (pokemon.ability === 'snowwarning') {
  2118.                 pokemon.ability = 'iceage';
  2119.                 pokemon.baseAbility = 'iceage';
  2120.             }
  2121.         },
  2122.     },
  2123. giratina: {
  2124.         // Giratina: Distortion
  2125.         onStart: function (pokemon) {
  2126.             if (pokemon.ability === 'shadowtag') {
  2127.                 pokemon.ability = 'distortion';
  2128.                 pokemon.baseAbility = 'distortion';
  2129.             }
  2130.         },
  2131.     },
  2132. gengar: {
  2133.         // Gengar: Distortion
  2134.         onStart: function (pokemon) {
  2135.             if (pokemon.ability === 'shadowtag') {
  2136.                 pokemon.ability = 'distortion';
  2137.                 pokemon.baseAbility = 'distortion';
  2138.             }
  2139.         },
  2140.     },
  2141. mismagius: {
  2142.         // Mismagius: Distortion
  2143.         onStart: function (pokemon) {
  2144.             if (pokemon.ability === 'shadowtag') {
  2145.                 pokemon.ability = 'distortion';
  2146.                 pokemon.baseAbility = 'distortion';
  2147.             }
  2148.         },
  2149.     },
  2150. dusknoir: {
  2151.         // Dusknoir: Distortion
  2152.         onStart: function (pokemon) {
  2153.             if (pokemon.ability === 'shadowtag') {
  2154.                 pokemon.ability = 'distortion';
  2155.                 pokemon.baseAbility = 'distortion';
  2156.             }
  2157.         },
  2158.     },
  2159. spiritomb: {
  2160.         // Spiritomb: Distortion
  2161.         onStart: function (pokemon) {
  2162.             if (pokemon.ability === 'shadowtag') {
  2163.                 pokemon.ability = 'distortion';
  2164.                 pokemon.baseAbility = 'distortion';
  2165.             }
  2166.         },
  2167.     },
  2168. };
  2169.  
  2170. /* mods/ghoulking/scripts.js */
  2171.  
  2172. 'use strict';
  2173.  
  2174. exports.BattleScripts = {
  2175.     init: function () {
  2176. this.modData('Pokedex', 'zapdos').abilities['1'] = 'Drizzle';
  2177. this.modData('Pokedex', 'articuno').abilities['1'] = 'Snow Warning';
  2178. this.modData('Pokedex', 'moltres').abilities['1'] = 'Gale Wings';
  2179. this.modData('Pokedex', 'abomasnowmega').abilities['0'] = 'Ice Age';
  2180. this.modData('Pokedex', 'alakazammega').abilities['0'] = 'Transcendent';
  2181. this.modData('Pokedex', 'gallademega').abilities['0'] = 'Moxie';
  2182. this.modData('Pokedex', 'sceptilemega').abilities['0'] = 'Multiscale';
  2183. this.modData('Pokedex', 'steelixmega').abilities['0'] = 'Arena Trap';
  2184. this.modData('Pokedex', 'beedrillmega').abilities['0'] = 'Hustle';
  2185. this.modData('Pokedex', 'durant').abilities['1'] = 'Adaptability';
  2186. this.modData('Pokedex', 'giratina').abilities['1'] = 'Shadow Tag';
  2187. this.modData('Pokedex', 'gengar').abilities['1'] = 'Shadow Tag';
  2188. this.modData('Pokedex', 'mismagius').abilities['1'] = 'Shadow Tag';
  2189. this.modData('Pokedex', 'dusknoir').abilities['1'] = 'Shadow Tag';
  2190. this.modData('Pokedex', 'spiritomb').abilities['1'] = 'Shadow Tag';
  2191.         },
  2192. pokemon: {
  2193.      deductPP: function (move, amount, source) {
  2194.        move = this.battle.getMove(move);
  2195.        let ppData = this.getMoveData(move);
  2196.        if (!ppData) return false;
  2197.        ppData.used = true;
  2198.        if (!ppData.pp) return false;
  2199.    
  2200.        ppData.pp -= amount || 1;
  2201.        console.log(toId(this.ability));
  2202.        if (toId(this.ability) === 'hustle') {
  2203.          ppData.pp -= 1;
  2204.        }
  2205.        if (ppData.pp <= 0) {
  2206.          ppData.pp = 0;
  2207.        }
  2208.        if (ppData.virtual) {
  2209.          let foeActive = this.side.foe.active;
  2210.          for (let i = 0; i < foeActive.length; i++) {
  2211.            if (foeActive[i].isStale >= 2) {
  2212.              if (move.selfSwitch) this.isStalePPTurns++;
  2213.              return true;
  2214.            }
  2215.          }
  2216.        }
  2217.        this.isStalePPTurns = 0;
  2218.        return true;
  2219.      }
  2220. },
  2221.     };
  2222.  
  2223. /* mods/ghoulking/pokedex.js */
  2224.  
  2225. 'use strict';
  2226.  
  2227. exports.BattlePokedex = {
  2228.     alakazammega: {
  2229.         inherit: true,
  2230.         baseStats: {hp: 55, atk: 50, def: 75, spa: 175, spd: 95, spe: 150},
  2231.         },
  2232.     beedrillmega: {
  2233.         inherit: true,
  2234.         baseStats: {hp: 65, atk: 150, def: 70, spa: 15, spd: 90, spe: 105},
  2235.     },
  2236.     castformsand: {
  2237.         num: 351,
  2238.         species: "Castform-Sand",
  2239.         baseSpecies: "Castform",
  2240.         forme: "Sand",
  2241.         formeLetter: "S",
  2242.         types: ["Rock"],
  2243.         baseStats: {hp: 70, atk: 70, def: 70, spa: 70, spd: 70, spe: 70},
  2244.         abilities: {0: "Forecast"},
  2245.         heightm: 0.3,
  2246.         weightkg: 0.8,
  2247.         color: "White",
  2248.         eggGroups: ["Fairy", "Amorphous"],
  2249.     },
  2250.     };
  2251.  
  2252. /* mods/ghoulking/typechart.js */
  2253.  
  2254. exports.BattleTypeChart = {
  2255. "Bug": {
  2256.         damageTaken: {
  2257.             "Bug": 0,
  2258.             "Dark": 0,
  2259.             "Dragon": 0,
  2260.             "Electric": 0,
  2261.             "Fairy": 0,
  2262.             "Fighting": 2,
  2263.             "Fire": 1,
  2264.             "Flying": 1,
  2265.             "Ghost": 0,
  2266.             "Grass": 2,
  2267.             "Ground": 2,
  2268.             "Ice": 0,
  2269.             "Normal": 0,
  2270.             "Poison": 0,
  2271.             "Psychic": 0,
  2272.             "Rock": 1,
  2273.             "Steel": 0,
  2274.             "Water": 0
  2275.         },
  2276.         HPivs: {"atk":30, "def":30, "spd":30}
  2277.     },
  2278.     "Dark": {
  2279.         damageTaken: {
  2280.             "Bug": 1,
  2281.             "Dark": 2,
  2282.             "Dragon": 0,
  2283.             "Electric": 0,
  2284.             "Fairy": 1,
  2285.             "Fighting": 1,
  2286.             "Fire": 0,
  2287.             "Flying": 0,
  2288.             "Ghost": 2,
  2289.             "Grass": 0,
  2290.             "Ground": 0,
  2291.             "Ice": 0,
  2292.             "Normal": 0,
  2293.             "Poison": 0,
  2294.             "Psychic": 3,
  2295.             "Rock": 0,
  2296.             "Steel": 0,
  2297.             "Water": 0
  2298.         },
  2299.         HPivs: {}
  2300.     },
  2301.     "Dragon": {
  2302.         damageTaken: {
  2303.             "Bug": 0,
  2304.             "Dark": 0,
  2305.             "Dragon": 1,
  2306.             "Electric": 2,
  2307.             "Fairy": 1,
  2308.             "Fighting": 0,
  2309.             "Fire": 2,
  2310.             "Flying": 0,
  2311.             "Ghost": 0,
  2312.             "Grass": 2,
  2313.             "Ground": 0,
  2314.             "Ice": 1,
  2315.             "Normal": 0,
  2316.             "Poison": 0,
  2317.             "Psychic": 0,
  2318.             "Rock": 0,
  2319.             "Steel": 0,
  2320.             "Water": 2
  2321.         },
  2322.         HPivs: {"atk":30}
  2323.     },
  2324.     "Electric": {
  2325.         damageTaken: {
  2326.             par: 3,
  2327.             "Bug": 0,
  2328.             "Dark": 0,
  2329.             "Dragon": 0,
  2330.             "Electric": 2,
  2331.             "Fairy": 0,
  2332.             "Fighting": 0,
  2333.             "Fire": 0,
  2334.             "Flying": 2,
  2335.             "Ghost": 0,
  2336.             "Grass": 0,
  2337.             "Ground": 1,
  2338.             "Ice": 0,
  2339.             "Normal": 0,
  2340.             "Poison": 0,
  2341.             "Psychic": 0,
  2342.             "Rock": 0,
  2343.             "Steel": 2,
  2344.             "Water": 0
  2345.         },
  2346.         HPivs: {"spa":30}
  2347.     },
  2348.     "Fairy": {
  2349.         damageTaken: {
  2350.             "Bug": 2,
  2351.             "Dark": 2,
  2352.             "Dragon": 3,
  2353.             "Electric": 0,
  2354.             "Fairy": 0,
  2355.             "Fighting": 2,
  2356.             "Fire": 0,
  2357.             "Flying": 0,
  2358.             "Ghost": 1,
  2359.             "Grass": 0,
  2360.             "Ground": 0,
  2361.             "Ice": 0,
  2362.             "Normal": 0,
  2363.             "Poison": 1,
  2364.             "Psychic": 0,
  2365.             "Rock": 0,
  2366.             "Steel": 1,
  2367.             "Water": 0
  2368.         }
  2369.     },
  2370.     "Fighting": {
  2371.         damageTaken: {
  2372.             "Bug": 2,
  2373.             "Dark": 2,
  2374.             "Dragon": 0,
  2375.             "Electric": 0,
  2376.             "Fairy": 1,
  2377.             "Fighting": 0,
  2378.             "Fire": 0,
  2379.             "Flying": 1,
  2380.             "Ghost": 0,
  2381.             "Grass": 0,
  2382.             "Ground": 0,
  2383.             "Ice": 0,
  2384.             "Normal": 0,
  2385.             "Poison": 0,
  2386.             "Psychic": 1,
  2387.             "Rock": 2,
  2388.             "Steel": 0,
  2389.             "Water": 0
  2390.         },
  2391.         HPivs: {"def":30, "spa":30, "spd":30, "spe":30}
  2392.     },
  2393.     "Fire": {
  2394.         damageTaken: {
  2395.             brn: 3,
  2396.             "Bug": 2,
  2397.             "Dark": 0,
  2398.             "Dragon": 0,
  2399.             "Electric": 0,
  2400.             "Fairy": 2,
  2401.             "Fighting": 0,
  2402.             "Fire": 2,
  2403.             "Flying": 0,
  2404.             "Ghost": 0,
  2405.             "Grass": 2,
  2406.             "Ground": 1,
  2407.             "Ice": 2,
  2408.             "Normal": 0,
  2409.             "Poison": 0,
  2410.             "Psychic": 0,
  2411.             "Rock": 1,
  2412.             "Steel": 2,
  2413.             "Water": 1
  2414.         },
  2415.         HPivs: {"atk":30, "spa":30, "spe":30}
  2416.     },
  2417.     "Flying": {
  2418.         damageTaken: {
  2419.             "Bug": 2,
  2420.             "Dark": 0,
  2421.             "Dragon": 0,
  2422.             "Electric": 1,
  2423.             "Fairy": 0,
  2424.             "Fighting": 2,
  2425.             "Fire": 0,
  2426.             "Flying": 0,
  2427.             "Ghost": 0,
  2428.             "Grass": 2,
  2429.             "Ground": 3,
  2430.             "Ice": 1,
  2431.             "Normal": 0,
  2432.             "Poison": 0,
  2433.             "Psychic": 0,
  2434.             "Rock": 1,
  2435.             "Steel": 0,
  2436.             "Water": 0
  2437.         },
  2438.         HPivs: {"hp":30, "atk":30, "def":30, "spa":30, "spd":30}
  2439.     },
  2440.     "Ghost": {
  2441.         damageTaken: {
  2442.             trapped: 3,
  2443.             "Bug": 2,
  2444.             "Dark": 1,
  2445.             "Dragon": 1,
  2446.             "Electric": 0,
  2447.             "Fairy": 0,
  2448.             "Fighting": 3,
  2449.             "Fire": 0,
  2450.             "Flying": 0,
  2451.             "Ghost": 1,
  2452.             "Grass": 0,
  2453.             "Ground": 0,
  2454.             "Ice": 0,
  2455.             "Normal": 3,
  2456.             "Poison": 2,
  2457.             "Psychic": 0,
  2458.             "Rock": 0,
  2459.             "Steel": 0,
  2460.             "Water": 0
  2461.         },
  2462.         HPivs: {"def":30, "spd":30}
  2463.     },
  2464.     "Grass": {
  2465.         damageTaken: {
  2466.             powder: 3,
  2467.             "Bug": 1,
  2468.             "Dark": 0,
  2469.             "Dragon": 0,
  2470.             "Electric": 2,
  2471.             "Fairy": 0,
  2472.             "Fighting": 0,
  2473.             "Fire": 1,
  2474.             "Flying": 1,
  2475.             "Ghost": 0,
  2476.             "Grass": 2,
  2477.             "Ground": 2,
  2478.             "Ice": 1,
  2479.             "Normal": 0,
  2480.             "Poison": 1,
  2481.             "Psychic": 0,
  2482.             "Rock": 0,
  2483.             "Steel": 0,
  2484.             "Water": 2
  2485.         },
  2486.         HPivs: {"atk":30, "spa":30}
  2487.     },
  2488.     "Ground": {
  2489.         damageTaken: {
  2490.             sandstorm: 3,
  2491.             "Bug": 0,
  2492.             "Dark": 0,
  2493.             "Dragon": 0,
  2494.             "Electric": 3,
  2495.             "Fairy": 0,
  2496.             "Fighting": 0,
  2497.             "Fire": 0,
  2498.             "Flying": 0,
  2499.             "Ghost": 0,
  2500.             "Grass": 1,
  2501.             "Ground": 0,
  2502.             "Ice": 1,
  2503.             "Normal": 0,
  2504.             "Poison": 2,
  2505.             "Psychic": 0,
  2506.             "Rock": 2,
  2507.             "Steel": 0,
  2508.             "Water": 1
  2509.         },
  2510.         HPivs: {"spa":30, "spd":30}
  2511.     },
  2512.     "Ice": {
  2513.         damageTaken: {
  2514.             hail: 3,
  2515.             iceage: 3,
  2516.             frz: 3,
  2517.             "Bug": 0,
  2518.             "Dark": 0,
  2519.             "Dragon": 0,
  2520.             "Electric": 2,
  2521.             "Fairy": 0,
  2522.             "Fighting": 1,
  2523.             "Fire": 1,
  2524.             "Flying": 0,
  2525.             "Ghost": 2,
  2526.             "Grass": 0,
  2527.             "Ground": 0,
  2528.             "Ice": 2,
  2529.             "Normal": 0,
  2530.             "Poison": 0,
  2531.             "Psychic": 0,
  2532.             "Rock": 1,
  2533.             "Steel": 1,
  2534.             "Water": 0
  2535.         },
  2536.         HPivs: {"atk":30, "def":30}
  2537.     },
  2538.     "Normal": {
  2539.         damageTaken: {
  2540.             "Bug": 0,
  2541.             "Dark": 0,
  2542.             "Dragon": 2,
  2543.             "Electric": 0,
  2544.             "Fairy": 2,
  2545.             "Fighting": 1,
  2546.             "Fire": 0,
  2547.             "Flying": 0,
  2548.             "Ghost": 3,
  2549.             "Grass": 0,
  2550.             "Ground": 0,
  2551.             "Ice": 0,
  2552.             "Normal": 0,
  2553.             "Poison": 1,
  2554.             "Psychic": 1,
  2555.             "Rock": 0,
  2556.             "Steel": 0,
  2557.             "Water": 0
  2558.         }
  2559.     },
  2560.     "Poison": {
  2561.         damageTaken: {
  2562.             psn: 3,
  2563.             tox: 3,
  2564.             "Bug": 2,
  2565.             "Dark": 0,
  2566.             "Dragon": 0,
  2567.             "Electric": 0,
  2568.             "Fairy": 2,
  2569.             "Fighting": 2,
  2570.             "Fire": 0,
  2571.             "Flying": 0,
  2572.             "Ghost": 0,
  2573.             "Grass": 2,
  2574.             "Ground": 1,
  2575.             "Ice": 0,
  2576.             "Normal": 2,
  2577.             "Poison": 2,
  2578.             "Psychic": 1,
  2579.             "Rock": 0,
  2580.             "Steel": 0,
  2581.             "Water": 0
  2582.         },
  2583.         HPivs: {"def":30, "spa":30, "spd":30}
  2584.     },
  2585.     "Psychic": {
  2586.         damageTaken: {
  2587.             "Bug": 1,
  2588.             "Dark": 1,
  2589.             "Dragon": 2,
  2590.             "Electric": 0,
  2591.             "Fairy": 0,
  2592.             "Fighting": 2,
  2593.             "Fire": 0,
  2594.             "Flying": 0,
  2595.             "Ghost": 1,
  2596.             "Grass": 0,
  2597.             "Ground": 0,
  2598.             "Ice": 0,
  2599.             "Normal": 0,
  2600.             "Poison": 0,
  2601.             "Psychic": 2,
  2602.             "Rock": 0,
  2603.             "Steel": 0,
  2604.             "Water": 0
  2605.         },
  2606.         HPivs: {"atk":30, "spe":30}
  2607.     },
  2608.     "Rock": {
  2609.         damageTaken: {
  2610.             sandstorm: 3,
  2611.             "Bug": 0,
  2612.             "Dark": 0,
  2613.             "Dragon": 0,
  2614.             "Electric": 0,
  2615.             "Fairy": 0,
  2616.             "Fighting": 1,
  2617.             "Fire": 2,
  2618.             "Flying": 2,
  2619.             "Ghost": 0,
  2620.             "Grass": 1,
  2621.             "Ground": 1,
  2622.             "Ice": 0,
  2623.             "Normal": 2,
  2624.             "Poison": 2,
  2625.             "Psychic": 0,
  2626.             "Rock": 0,
  2627.             "Steel": 1,
  2628.             "Water": 1
  2629.         },
  2630.         HPivs: {"def":30, "spd":30, "spe":30}
  2631.     },
  2632.     "Steel": {
  2633.         damageTaken: {
  2634.             psn: 3,
  2635.             tox: 3,
  2636.             sandstorm: 3,
  2637.             "Bug": 2,
  2638.             "Dark": 0,
  2639.             "Dragon": 2,
  2640.             "Electric": 0,
  2641.             "Fairy": 2,
  2642.             "Fighting": 1,
  2643.             "Fire": 1,
  2644.             "Flying": 2,
  2645.             "Ghost": 0,
  2646.             "Grass": 2,
  2647.             "Ground": 1,
  2648.             "Ice": 2,
  2649.             "Normal": 2,
  2650.             "Poison": 3,
  2651.             "Psychic": 2,
  2652.             "Rock": 2,
  2653.             "Steel": 2,
  2654.             "Water": 0
  2655.         },
  2656.         HPivs: {"spd":30}
  2657.     },
  2658.     "Water": {
  2659.         damageTaken: {
  2660.             "Bug": 0,
  2661.             "Dark": 0,
  2662.             "Dragon": 1,
  2663.             "Electric": 1,
  2664.             "Fairy": 0,
  2665.             "Fighting": 0,
  2666.             "Fire": 2,
  2667.             "Flying": 0,
  2668.             "Ghost": 0,
  2669.             "Grass": 1,
  2670.             "Ground": 0,
  2671.             "Ice": 2,
  2672.             "Normal": 0,
  2673.             "Poison": 0,
  2674.             "Psychic": 0,
  2675.             "Rock": 0,
  2676.             "Steel": 2,
  2677.             "Water": 2
  2678.         },
  2679.         HPivs: {"atk":30, "def":30, "spa":30}
  2680.     }
  2681. };
  2682.  
  2683. /* mods/ghoulking/abilities.js */
  2684.  
  2685. 'use strict';
  2686.  
  2687. exports.BattleAbilities = {
  2688. "illuminate": {
  2689.             inherit: true,
  2690.         onStart: function (pokemon) {
  2691.             var foeactive = pokemon.side.foe.active;
  2692.             var activated = false;
  2693.             for (var i = 0; i < foeactive.length; i++) {
  2694.                 if (!foeactive[i] || !this.isAdjacent(foeactive[i], pokemon)) continue;
  2695.                 if (!activated) {
  2696.                     this.add('-ability', pokemon, 'Illuminate');
  2697.                     activated = true;
  2698.                 }
  2699.                 if (foeactive[i].volatiles['substitute']) {
  2700.                     this.add('-activate', foeactive[i], 'Substitute', 'ability: Illuminate', '[of] ' + pokemon);
  2701.                 } else {
  2702.                     this.boost({evasion: -1}, foeactive[i], pokemon);
  2703.                 }
  2704.             }
  2705.         },
  2706.     },
  2707. "steadfast": {
  2708.         inherit: true,
  2709.         onFlinch: function (pokemon) {
  2710.             this.boost({spe: 1, atk: 1});
  2711.         },
  2712. },
  2713. "angerpoint": {
  2714.     inherit: true,
  2715.     onHit: function (target, source, move) {
  2716.             if (move && move.id in {attract:1, disable:1, encore:1, healblock:1, taunt:1, torment:1}) {
  2717.             return this.boost({atk: 1, spe: 1});
  2718.             }
  2719.     },
  2720.     onAfterDamage: function (damage, target, source, move) {
  2721.         undefined;
  2722.     },
  2723. },
  2724. "reckless": {
  2725.         inherit: true,
  2726.         onBasePowerPriority: 8,
  2727.         onBasePower: function (basePower, attacker, defender, move) {
  2728.             return undefined
  2729.         },
  2730.         onModifyPriority: function (priority, pokemon, target, move) {
  2731.             if (move.recoil && this.activeMove !== 'struggle') {
  2732.             return priority + 1;
  2733.             }
  2734.         },
  2735.     },
  2736. "ironfist": {
  2737.         inherit: true,
  2738.         onBasePowerPriority: 8,
  2739.         onBasePower: function (basePower, attacker, defender, move) {
  2740.             return undefined
  2741.         },
  2742.         onModifyMove: function (move) {
  2743.             if (move.flags['punch'])
  2744.             move.willCrit= true;
  2745.         },
  2746.     },
  2747. "bigpecks": {
  2748.         inherit: true,
  2749.         onAnyModifyBoost: function (boosts, target) {
  2750.             let source = this.effectData.target;
  2751.             if (source === target) return;
  2752.             if (target === this.activePokemon && source === this.activeTarget) {
  2753.                 boosts['atk'] = 0;
  2754.             }
  2755.         },
  2756. },
  2757. "thickfat": {
  2758.         inherit: true,
  2759.         onImmunity: function (type, pokemon) {
  2760.             if (type === 'hail', 'iceage') return false;
  2761.         }
  2762.     },
  2763. "victorystar": {
  2764.         inherit: true,
  2765.         onAllyModifyMove: function (move) {
  2766.             if (typeof move.accuracy === 'number') {
  2767.                 move.accuracy *= 1.2;
  2768.             }
  2769.         },
  2770.     },
  2771. "hustle": {
  2772.         inherit: true,
  2773.         onModifyAtkPriority: 5,
  2774.         onModifyAtk: function (atk) {
  2775.             return this.chainModify(1.25);
  2776.         },
  2777.         onModifySpePriority: 5,
  2778.         onModifySpe: function (spe) {
  2779.             return this.chainModify(1.25);
  2780.         },
  2781.         onModifyMove: function (move) {
  2782.             return undefined;
  2783.         },
  2784.     },
  2785. "grasspelt": {
  2786.         inherit: true,
  2787.         onModifyDefPriority: 6,
  2788.         onModifyDef: function (def) {
  2789.             if (this.isTerrain('grassyterrain')) return this.chainModify(2);
  2790.         },
  2791.         onModifySpdPriority: 6,
  2792.         onModifySpd: function (spd) {
  2793.             if (this.isTerrain('grassyterrain')) return this.chainModify(2);
  2794.         },
  2795.         onBasePowerPriority: 7,
  2796.         onFoeBasePower: function (basePower, attacker, defender, move) {
  2797.             if (this.effectData.target !== defender) return;
  2798.             if (move.type === 'Fire') {
  2799.                 return this.chainModify(2);
  2800.             }
  2801.         },
  2802. },
  2803. "magmaarmor": {
  2804.         inherit: true,
  2805.         onUpdate: function (pokemon) {
  2806.             if (pokemon.status === 'frz') {
  2807.                 pokemon.cureStatus();
  2808.             }
  2809.         },
  2810.         onImmunity: function (type, pokemon) {
  2811.             if (type === 'frz' || type === 'Water') return false;
  2812.         }
  2813.     },
  2814. "immunity": {
  2815.         inherit: true,
  2816.         onUpdate: function (pokemon) {
  2817.             if (pokemon.status === 'psn' || pokemon.status === 'tox') {
  2818.                 pokemon.cureStatus();
  2819.             }
  2820.         },
  2821.         onImmunity: function (type) {
  2822.             if (type === 'psn' || type === 'Poison') return false;
  2823.         }
  2824.     },
  2825. "insomnia": {
  2826.         inherit: true,
  2827.         onUpdate: function (pokemon) {
  2828.             if (pokemon.status === 'slp') {
  2829.                 pokemon.cureStatus();
  2830.             }
  2831.         },
  2832.         onImmunity: function (type, pokemon) {
  2833.             if (type === 'slp' || type === 'Dark') return false;
  2834.         }
  2835.     },
  2836. "adaptability": {
  2837.             inherit: true,
  2838.             onModifyDamage: function (damage, source, target, move) {
  2839.             if (move.typeMod=1) {
  2840.                 this.debug('Adaptability boost');
  2841.                 return this.chainModify(1.5);
  2842.                 }
  2843.             },
  2844.         },
  2845. "toughclaws": {
  2846.         inherit: true,
  2847.         onSourceHit: function (target, source, move) {
  2848.         if (move && move.flags['contact']) target.addVolatile('trapped');
  2849.         },
  2850.         onBasePower: function (basePower, attacker, defender, move) {
  2851.             if (move.flags['contact']) {
  2852.                 return this.chainModify([1.2]);
  2853.             }
  2854.         },
  2855. },
  2856. "stickyhold": {
  2857.         inherit: true,
  2858.         onSourceHit: function (target, source, move) {
  2859.         if (move && move.flags['contact']) target.addVolatile('trapped');
  2860.         },
  2861. },
  2862. "aerilate": {
  2863.             inherit: true,
  2864.             effect: {
  2865.             duration: 1,
  2866.             onBasePowerPriority: 8,
  2867.             onBasePower: function (basePower, pokemon, target, move) {
  2868.                 return this.chainModify([1.2]);
  2869.             },
  2870.         },
  2871. },
  2872. "pixilate": {
  2873.     inherit: true,
  2874.     effect: {
  2875.             duration: 1,
  2876.             onBasePowerPriority: 8,
  2877.             onBasePower: function (basePower, pokemon, target, move) {
  2878.                 return this.chainModify([1.2]);
  2879.             },
  2880.         },
  2881. },
  2882. "refrigerate": {
  2883.     inherit: true,
  2884.     effect: {
  2885.             duration: 1,
  2886.             onBasePowerPriority: 8,
  2887.             onBasePower: function (basePower, pokemon, target, move) {
  2888.                 return this.chainModify([1.2]);
  2889.             },
  2890.         },
  2891. },
  2892. "shedskin": {
  2893.         inherit: true,
  2894.         onResidual: function (pokemon) {
  2895.             return undefined;
  2896.         },
  2897.         onUpdate: function (pokemon) {
  2898.             if (pokemon.hp && pokemon.status) {
  2899.             pokemon.cureStatus();
  2900.             this.boost({spe:-1});
  2901.             }
  2902.         },
  2903. },
  2904. "marvelscale": {
  2905.         inherit: true,
  2906.         onModifySpdPriority: 6,
  2907.         onModifySpD: function (spd, pokemon) {
  2908.             if (pokemon.status) {
  2909.                 return this.chainModify(1.5);
  2910.             }
  2911.         },
  2912. },
  2913. "damp": {
  2914.         inherit: true,
  2915.         onStart: function () {
  2916.             this.add('-clearallboost');
  2917.             for (let i = 0; i < this.sides.length; i++) {
  2918.                 for (let j = 0; j < this.sides[i].active.length; j++) {
  2919.                     if (this.sides[i].active[j] && this.sides[i].active[j].isActive) this.sides[i].active[j].clearBoosts();
  2920.                 }
  2921.             }
  2922.         },
  2923. },
  2924. "waterveil": {
  2925.         inherit: true,
  2926.         onModifyAtk: function (atk, pokemon) {
  2927.             if (this.isWeather(['raindance', 'primordialsea'])) {
  2928.                 return this.chainModify(1.5);
  2929.             }
  2930.         },
  2931.         onModifyDef: function (def, pokemon) {
  2932.             if (this.isWeather(['raindance', 'primordialsea'])) {
  2933.                 return this.chainModify(1.5);
  2934.             }
  2935.         },
  2936. },
  2937. "raindish": {
  2938.         inherit: true,
  2939.         onModifySecondaries: function (secondaries) {
  2940.             if (this.isWeather(['raindance', 'primordialsea']))
  2941.             this.debug('Rain Dish prevent secondary');
  2942.             return secondaries.filter(function (effect) {
  2943.                 return !!effect.self;
  2944.             });
  2945.         },
  2946. },
  2947. "icebody": {
  2948.         inherit: true,
  2949.         onModifySecondaries: function (secondaries) {
  2950.             if (this.isWeather(['hail', 'iceage']))
  2951.             this.debug('Ice Body prevent secondary');
  2952.             return secondaries.filter(function (effect) {
  2953.                 return !!effect.self;
  2954.             });
  2955.         },
  2956. },
  2957. "overcoat": {
  2958.         inherit: true,
  2959.         onImmunity: function (type, pokemon) {
  2960.             if (type === 'sandstorm' || type === 'hail' || type === 'iceage' || type === 'powder') return false;
  2961.         },
  2962. },
  2963. "defeatist": {
  2964.         inherit: true,
  2965.         onModifySpA: function (spa) {
  2966.             return undefined;
  2967.         },
  2968.         onModifyAtk: function (atk) {
  2969.             return undefined;
  2970.         },
  2971.         onModifySpePriority: 5,
  2972.         onModifySpe: function (spe, pokemon) {
  2973.             if (pokemon.hp <= pokemon.maxhp / 2) {
  2974.                 return this.chainModify(0.5);
  2975.             }
  2976.         },
  2977. },
  2978. "normalize": {
  2979.         inherit: true,
  2980.         onModifyMove: function (move) {
  2981.             return undefined
  2982.         },
  2983.         onBasePowerPriority: 8,
  2984.         onBasePower: function (basePower, attacker, defender, move) {
  2985.             if (move && move.category !== 'Status')
  2986.                 return 100;
  2987.         },
  2988. },
  2989. "limber": {
  2990.         inherit: true,
  2991.         onUpdate: function (pokemon) {
  2992.             if (pokemon.status === 'par') {
  2993.                 this.add('-activate', pokemon, 'ability: Limber');
  2994.                 pokemon.cureStatus();
  2995.             }
  2996.         },
  2997.         onImmunity: function (type, pokemon) {
  2998.             if (type === 'par') return false;
  2999.         },
  3000.         onBoost: function (boost, target, source, effect) {
  3001.             if (source && target === source) return;
  3002.             if (boost['spe'] && boost['spe'] < 0) {
  3003.                 boost['spe'] = 0;
  3004.                 if (!effect.secondaries) this.add("-fail", target, "unboost", "Speed", "[from] ability: Limber", "[of] " + target);
  3005.             }
  3006.         },
  3007. },
  3008. "vitalspirit": {
  3009.         inherit: true,
  3010.         onUpdate: function (pokemon) {
  3011.             if (pokemon.status === 'slp') {
  3012.                 this.add('-activate', pokemon, 'ability: Vital Spirit');
  3013.                 pokemon.cureStatus();
  3014.             }
  3015.         },
  3016.         onImmunity: function (type) {
  3017.             if (type === 'slp') return false;
  3018.         },
  3019.         onAfterEachBoost: function (boost, target, source) {
  3020.             if (!source || target.side === source.side) {
  3021.                 return;
  3022.             }
  3023.             let statsLowered = false;
  3024.             for (let i in boost) {
  3025.                 if (boost[i] < 0) {
  3026.                     statsLowered = true;
  3027.                 }
  3028.             }
  3029.             if (statsLowered) {
  3030.                 this.boost({spe: 2});
  3031.             }
  3032.         },
  3033. },
  3034. "arenatrap": {
  3035.         inherit: true,
  3036.         onFoeSwitchOut: function (pokemon) {
  3037.             if (!this.isAdjacent(pokemon, this.effectData.target) || pokemon.hasType ('Ghost') || pokemon.hasAbility('runaway') || pokemon.hasItem('shedshell')) return;
  3038.             if (pokemon.isGrounded())
  3039.                 this.damage(pokemon.maxhp / 8);
  3040.         },
  3041.         onFoeTrapPokemon: null,
  3042.         onFoeMaybeTrapPokemon: null,
  3043.     },
  3044. "magnetpull": {
  3045.         inherit: true,
  3046.         onFoeSwitchOut: function (pokemon) {
  3047.             if (pokemon.hasType('Steel') && !pokemon.hasAbility('runaway') && !pokemon.hasType('Ghost') && !pokemon.hasItem('shedshell') && this.isAdjacent(pokemon, this.effectData.target)) {
  3048.             this.damage(pokemon.maxhp / 8);
  3049.             }
  3050.         },
  3051.         onFoeTrapPokemon: null,
  3052.         onFoeMaybeTrapPokemon: null,
  3053.     },
  3054. "shadowtag": {
  3055.         inherit: true,
  3056.         onFoeSwitchOut: function (pokemon) {
  3057.             if (!pokemon.hasAbility('shadowtag') && !pokemon.hasAbility('runaway') && !pokemon.hasType('Ghost') && !pokemon.hasItem('shedshell') && this.isAdjacent(pokemon, this.effectData.target)) {
  3058.                 this.damage(pokemon.maxhp / 8);
  3059.             }
  3060.         },
  3061.         onFoeTrapPokemon: null,
  3062.         onFoeMaybeTrapPokemon: null,
  3063.     },
  3064. "runaway": {
  3065.         inherit: true,
  3066.         onTryHit: function (target, source, move) {
  3067.             if (move && move.id === 'pursuit') {
  3068.                 return null;
  3069.             }
  3070.         },
  3071. },
  3072. "cheekpouch": {
  3073.         inherit: true,
  3074.         onSwitchOut: function (pokemon) {
  3075.         if (pokemon.hp && !pokemon.item && this.getItem(pokemon.lastItem).isBerry) {
  3076.                     pokemon.setItem(pokemon.lastItem);
  3077.                     this.add('-item', pokemon, pokemon.getItem(), '[from] ability: Cheek Pouch');
  3078.                 }
  3079.             }
  3080. },
  3081. "quickfeet": {
  3082.         inherit: true,
  3083.         onModifySpe: function (spe, pokemon) {
  3084.             if (pokemon.status) {
  3085.                 return this.chainModify(2);
  3086.             }
  3087.         },
  3088. },
  3089. "heavymetal": {
  3090.         inherit: true,
  3091.         onModifyAtkPriority: 5,
  3092.         onModifyAtk: function (atk) {
  3093.             return this.chainModify(1.5);
  3094.         },
  3095.         onModifyDefPriority: 5,
  3096.         onModifyDef: function (def) {
  3097.             return this.chainModify(1.5);
  3098.         },
  3099.         onModifySpePriority: 5,
  3100.         onModifySpe: function (spe) {
  3101.             return this.chainModify(0.5);
  3102.         },
  3103. },
  3104. "lightmetal": {
  3105.         inherit: true,
  3106.         onModifyAtkPriority: 5,
  3107.         onModifyAtk: function (atk) {
  3108.             return this.chainModify(0.66);
  3109.         },
  3110.         onModifyDefPriority: 5,
  3111.         onModifyDef: function (def) {
  3112.             return this.chainModify(0.66);
  3113.         },
  3114.         onModifySpePriority: 5,
  3115.         onModifySpe: function (spe) {
  3116.             return this.chainModify(2);
  3117.         },
  3118. },
  3119. "wonderskin": {
  3120.         inherit: true,
  3121.         onTryHit: function (target, source, move) {
  3122.             if (target !== source && move.category === 'Status') {
  3123.                 if (!this.heal(target.maxhp / 4)) {
  3124.                     this.add('-immune', target, '[msg]', '[from] ability: Wonder Skin');
  3125.                 }
  3126.                 return null;
  3127.             }
  3128.         },
  3129. },
  3130. "roughskin": {
  3131.         inherit: true,
  3132.         onAfterDamage: function (damage, target, source, move) {
  3133.             if (source && source !== target && move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3134.                 let typeMod = this.clampIntRange(source.runEffectiveness('Dark'), -6, 6);
  3135.                 this.damage(source.maxhp * Math.pow(2, typeMod) /8, source, target, null, true);
  3136.             }
  3137.         },
  3138.     },
  3139. "ironbarbs": {
  3140.         inherit: true,
  3141.         onAfterDamage: function (damage, target, source, move) {
  3142.             if (source && source !== target && move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3143.                 let typeMod = this.clampIntRange(source.runEffectiveness('Steel'), -6, 6);
  3144.                 this.damage(source.maxhp * Math.pow(2, typeMod) /8, source, target, null, true);
  3145.             }
  3146.         },
  3147.     },
  3148. "static": {
  3149.         inherit: true,
  3150.         onAfterDamage: function (damage, target, source, move) {
  3151.             if (source && source !== target && !source.hasType('Ground') && move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3152.                 let typeMod = this.clampIntRange(source.runEffectiveness('Electric'), -6, 6);
  3153.                 this.damage(source.maxhp * Math.pow(2, typeMod) /8, source, target, null, true);
  3154.             }
  3155.         },
  3156.     },
  3157. "flamebody": {
  3158.         inherit: true,
  3159.         onAfterDamage: function (damage, target, source, move) {
  3160.             if (source && source !== target && move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3161.                 let typeMod = this.clampIntRange(source.runEffectiveness('Fire'), -6, 6);
  3162.                 this.damage(source.maxhp * Math.pow(2, typeMod) /8, source, target, null, true);
  3163.             }
  3164.         },
  3165.     },
  3166. "poisonpoint": {
  3167.         inherit: true,
  3168.     onAfterDamage: function (damage, target, source, move) {
  3169.             if (source && source !== target && !source.hasType('Steel' && !source.hasAbility('Rock Head')) && move && move.flags['contact']) {
  3170.                 let typeMod = this.clampIntRange(source.runEffectiveness('Poison'), -6, 6);
  3171.                 this.damage(source.maxhp * Math.pow(2, typeMod) /8, source, target, null, true);
  3172.             }
  3173.         },
  3174.     },
  3175. "pickpocket": {
  3176.         inherit: true,
  3177.         onAfterMoveSecondary: function (target, source, move) {
  3178.             if (source && source !== target && move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3179.                 if (target.item) {
  3180.                     return;
  3181.                 }
  3182.                 let yourItem = source.takeItem(target);
  3183.                 if (!yourItem) {
  3184.                     return;
  3185.                 }
  3186.                 if (!target.setItem(yourItem)) {
  3187.                     source.item = yourItem.id;
  3188.                     return;
  3189.                 }
  3190.                 this.add('-item', target, yourItem, '[from] ability: Pickpocket', '[of] ' + source);
  3191.             }
  3192.         },
  3193. },
  3194. "gooey": {
  3195.         inherit: true,
  3196.         onAfterDamage: function (damage, target, source, effect) {
  3197.             if (effect && effect.flags['contact'] && !source.hasAbility('Rock Head')) {
  3198.                 this.add('-ability', target, 'Gooey');
  3199.                 this.boost({spe: -1}, source, target);
  3200.             }
  3201.         },
  3202. },
  3203. "cutecharm": {
  3204.         inherit: true,
  3205.         onAfterDamage: function (damage, target, source, move) {
  3206.             if (move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3207.                     source.addVolatile('attract', target);
  3208.             }
  3209.         },
  3210. },
  3211. "effectspore": {
  3212.         inherit: true,
  3213.         onAfterDamage: function (damage, target, source, move) {
  3214.             if (move && move.flags['contact'] && !source.status && !source.hasAbility('Rock Head') && source.runImmunity('powder')) {
  3215.                 let r = this.random(100);
  3216.                 if (r < 11) {
  3217.                     source.setStatus('slp', target);
  3218.                 } else if (r < 21) {
  3219.                     source.setStatus('par', target);
  3220.                 } else if (r < 30) {
  3221.                     source.setStatus('psn', target);
  3222.                 }
  3223.             }
  3224.         },
  3225. },
  3226. "rockhead": {
  3227.         inherit: true,
  3228.         onDamage: function (damage, target, source, effect) {
  3229.             if (effect.id === 'recoil' && this.activeMove.id !== 'struggle' || effect && effect.id === 'aftermath') return null;
  3230.         },
  3231. },
  3232. "shellarmor": {
  3233.         inherit: true,
  3234.         onStart: function (pokemon) {
  3235.             pokemon.addVolatile('shellarmor');
  3236.         },
  3237.         onEnd: function (pokemon) {
  3238.             delete pokemon.volatiles['shellarmor'];
  3239.             this.add('-end', pokemon, 'Shell Armor', '[silent]');
  3240.         },
  3241.         effect: {
  3242.             duration: 1,
  3243.             onSourceModifyDamage: function (damage, source, target, move) {
  3244.                 return this.chainModify(0.5);
  3245.             }
  3246.         },
  3247. },
  3248. "truant": {
  3249.         inherit: true,
  3250.         onBeforeMove: function (pokemon) {
  3251.             return undefined
  3252.         },
  3253.         onResidualOrder: 20,
  3254.         onResidual: function (pokemon) {
  3255.                 if (pokemon.activeTurns) {
  3256.                 if (!pokemon.setStatus('slp')) return false;
  3257.                     pokemon.statusData.time = 2;
  3258.                     pokemon.statusData.startTime = 2;
  3259.                 }
  3260.         },
  3261. },
  3262. "slowstart": {
  3263.         inherit: true,
  3264.         onStart: null,
  3265.         onTryMove: function (pokemon, target) {
  3266.             if (pokemon.activeTurns < 2) {
  3267.                 this.add('-fail', pokemon);
  3268.                 this.add('-hint', "It's slow to get started.");
  3269.                 return null;
  3270.             }
  3271.         },
  3272. },
  3273. "stench": {
  3274.         inherit: true,
  3275.         onModifyMove: function (move) {
  3276.             if (move.category !== "Status") {
  3277.                 this.debug('Adding Stench flinch');
  3278.                 if (!move.secondaries) move.secondaries = [];
  3279.                 for (let i = 0; i < move.secondaries.length; i++) {
  3280.                     if (move.secondaries[i].volatileStatus === 'flinch') return;
  3281.                 }
  3282.                 move.secondaries.push({
  3283.                     chance: 100,
  3284.                     volatileStatus: 'flinch',
  3285.                 });
  3286.             }
  3287.         },
  3288. },
  3289. "toxicboost": {
  3290.         inherit: true,
  3291.         onModifySpe: function (spe, pokemon) {
  3292.             if (pokemon.status === 'psn' || pokemon.status === 'tox') {
  3293.                 return this.chainModify(1.5);
  3294.             }
  3295.         },
  3296. },
  3297. "leafguard": {
  3298.         inherit: true,
  3299.         onModifySpd: function (spd) {
  3300.             if (this.isWeather(['sunnyday', 'desolateland'])) {
  3301.                 return this.chainModify(1.5);
  3302.             }
  3303.         },
  3304.         onModifyDef: function (def) {
  3305.             if (this.isWeather(['sunnyday', 'desolateland'])) {
  3306.                 return this.chainModify(1.5);
  3307.             }
  3308.         },
  3309. },
  3310. "snowcloak": {
  3311.         inherit: true,
  3312.         onModifyAccuracy: function (accuracy) {
  3313.             return undefined;
  3314.         },
  3315.         onWeather: function (pokemon, effect) {
  3316.             if (this.isWeather(['hail', 'iceage'])) {
  3317.             pokemon.addVolatile('substitute');
  3318.             }
  3319.         },
  3320. },
  3321. "sandveil": {
  3322.         inherit: true,
  3323.         onModifyAccuracy: function (accuracy) {
  3324.             return undefined;
  3325.         },
  3326.         onWeather: function (pokemon) {
  3327.             if (this.isWeather(['sandstorm'])) {
  3328.             pokemon.addVolatile('substitute');
  3329.             }
  3330.         },
  3331. },
  3332. "justified": {
  3333.         inherit: true,
  3334.         onAfterDamage: undefined,
  3335.         onTryHit: function (target, source, move) {
  3336.             if (target !== source && move.type === 'Dark') {
  3337.                 move.accuracy = true;
  3338.                 if (!target.addVolatile('justified')) {
  3339.                     this.add('-immune', target, '[msg]', '[from] ability: Justified');
  3340.                 }
  3341.                 return null;
  3342.             }
  3343.         },
  3344.         onEnd: function (pokemon) {
  3345.             pokemon.removeVolatile('justified');
  3346.         },
  3347.         effect: {
  3348.             onStart: function (target) {
  3349.                 this.add('-start', target, 'ability: Justified');
  3350.             },
  3351.             onModifyAtkPriority: 5,
  3352.             onModifyAtk: function (atk, attacker, defender, move) {
  3353.                     this.debug('Justified boost');
  3354.                     return this.chainModify(1.5);
  3355.             }
  3356.         },
  3357. },
  3358. "healer": {
  3359.         inherit: true,
  3360.         onStart: function (pokemon, source) {
  3361.             let side = pokemon.side;
  3362.             for (let i = 0; i < side.pokemon.length; i++) {
  3363.                 side.pokemon[i].status = '';
  3364.             }
  3365.             this.add('-cureteam', source, '[from] ability: Healer');
  3366.         },
  3367. },
  3368. "flareboost": {
  3369.         inherit: true,
  3370.         onBasePowerPriority: 8,
  3371.         onBasePower: function (basePower, attacker, defender, move) {
  3372.             if (attacker.status === 'brn' && move.category === 'Special') {
  3373.                 return this.chainModify(1.5);
  3374.             }
  3375.         },
  3376.         onDamage: function (damage, target, source, effect) {
  3377.             if (effect.id === 'brn') {
  3378.                 this.heal(target.maxhp / 16);
  3379.                 return false;
  3380.             }
  3381.         },
  3382. },
  3383. "weakarmor": {
  3384.         inherit: true,
  3385.         onModifyDefPriority: 5,
  3386.         onModifyDef: function (def) {
  3387.             return this.chainModify(0.66);
  3388.         },
  3389.         onModifySpePriority: 5,
  3390.         onModifySpe: function (spe) {
  3391.             return this.chainModify(1.5);
  3392.         },
  3393. },
  3394. "heatproof": {
  3395.         inherit: true,
  3396.         onDamage: function (damage, target, source, effect) {
  3397.             if (effect && effect.id === 'brn') {
  3398.                 return false;
  3399.             }
  3400.         },
  3401.         onTryHit: function (target, source, move) {
  3402.             if (target !== source && move.type === 'Fire') {
  3403.                 if (!this.boost({def:1, spd:1})) {
  3404.                     this.add('-immune', target, '[msg]', '[from] ability: Storm Drain');
  3405.                 }
  3406.                 return null;
  3407.             }
  3408.         },
  3409. },
  3410. "zenmode": {
  3411.         inherit: true,
  3412.         onResidualOrder: 27,
  3413.         onResidual: function (pokemon) {
  3414.             if (pokemon.baseTemplate.species !== 'Darmanitan') {
  3415.                 return;
  3416.             }
  3417.             if (pokemon.status === 'slp' && pokemon.template.speciesid === 'darmanitan') {
  3418.                 pokemon.addVolatile('zenmode');
  3419.             } else if (pokemon.status !== 'slp' && pokemon.template.speciesid === 'darmanitanzen') {
  3420.                 pokemon.removeVolatile('zenmode');
  3421.             }
  3422.         },
  3423.         onEnd: function (pokemon) {
  3424.             if (!pokemon.volatiles['zenmode']) return;
  3425.             pokemon.transformed = false;
  3426.             delete pokemon.volatiles['zenmode'];
  3427.             if (pokemon.formeChange('Darmanitan')) {
  3428.                 this.add('-formechange', pokemon, 'Darmanitan', '[silent]');
  3429.             }
  3430.         },
  3431.         effect: {
  3432.             onStart: function (pokemon) {
  3433.                 if (pokemon.formeChange('Darmanitan-Zen')) {
  3434.                     this.add('-formechange', pokemon, 'Darmanitan-Zen', '[from] ability: Zen Mode');
  3435.                 } else {
  3436.                     return false;
  3437.                 }
  3438.             },
  3439.             onEnd: function (pokemon) {
  3440.                 if (pokemon.formeChange('Darmanitan')) {
  3441.                     this.add('-formechange', pokemon, 'Darmanitan', '[from] ability: Zen Mode');
  3442.                 } else {
  3443.                     return false;
  3444.                 }
  3445.             },
  3446.         },
  3447.     },
  3448. "trace": {
  3449.         inherit: true,
  3450.         onUpdate: function (pokemon) {
  3451.             let possibleTargets = [];
  3452.             for (let i = 0; i < pokemon.side.foe.active.length; i++) {
  3453.                 if (pokemon.side.foe.active[i] && !pokemon.side.foe.active[i].fainted) possibleTargets.push(pokemon.side.foe.active[i]);
  3454.             }
  3455.             while (possibleTargets.length) {
  3456.                 let rand = 0;
  3457.                 if (possibleTargets.length > 1) rand = this.random(possibleTargets.length);
  3458.                 let target = possibleTargets[rand];
  3459.                 let ability = this.getAbility(target.ability);
  3460.                 let bannedAbilities = {flowergift:1, forecast:1, illusion:1, imposter:1, multitype:1, stancechange:1, trace:1, zenmode:1, fluidity: 1};
  3461.                 if (bannedAbilities[target.ability]) {
  3462.                     possibleTargets.splice(rand, 1);
  3463.                     continue;
  3464.                 }
  3465.                 this.add('-ability', pokemon, ability, '[from] ability: Trace', '[of] ' + target);
  3466.                 pokemon.setAbility(ability);
  3467.                 return;
  3468.             }
  3469.         },
  3470. },
  3471. "forecast": {
  3472.         inherit: true,
  3473.         onSetWeather: function (pokemon) {
  3474.                 this.boost({spe: 1, spa: 1, spd: 1})
  3475.         },
  3476.         onUpdate: function (pokemon) {
  3477.             if (pokemon.baseTemplate.species !== 'Castform' || pokemon.transformed) return;
  3478.             let forme = null;
  3479.             switch (this.effectiveWeather()) {
  3480.             case 'sunnyday':
  3481.             case 'desolateland':
  3482.                 if (pokemon.template.speciesid !== 'castformsunny') forme = 'Castform-Sunny';
  3483.                 break;
  3484.             case 'raindance':
  3485.             case 'primordialsea':
  3486.                 if (pokemon.template.speciesid !== 'castformrainy') forme = 'Castform-Rainy';
  3487.                 break;
  3488.             case 'hail':
  3489.             case 'iceage':
  3490.                 if (pokemon.template.speciesid !== 'castformsnowy') forme = 'Castform-Snowy';
  3491.                 break;
  3492.             case 'sandstorm':
  3493.                 if (pokemon.template.speciesid !== 'castformsand') forme = 'Castform-Sand';
  3494.                 break;
  3495.             default:
  3496.                 if (pokemon.template.speciesid !== 'castform') forme = 'Castform';
  3497.                 break;
  3498.             }
  3499.             if (pokemon.isActive && forme) {
  3500.                 pokemon.formeChange(forme);
  3501.                 this.add('-formechange', pokemon, forme, '[msg]');
  3502.             }
  3503.         },
  3504. },
  3505. "airlock": {
  3506.         inherit: true,
  3507.         suppressWeather: false,
  3508.         onStart: function (source) {
  3509.             this.setWeather('');
  3510.         },
  3511.         onAnySetWeather: function (target, source, weather) {
  3512.             return false;
  3513.         },
  3514. },
  3515. "primordialsea": {
  3516.         inherit: true,
  3517.         onAnySetWeather: function (target, source, weather) {
  3518.             if (this.getWeather().id === 'primordialsea' && !(weather.id in {desolateland:1, primordialsea:1, deltastream:1, iceage: 1})) return false;
  3519.         },
  3520. },
  3521. "desolateland": {
  3522.         inherit: true,
  3523.         onAnySetWeather: function (target, source, weather) {
  3524.             if (this.getWeather().id === 'desolateland' && !(weather.id in {desolateland:1, primordialsea:1, deltastream:1, iceage: 1})) return false;
  3525.         },
  3526. },
  3527. "deltastream": {
  3528.         inherit: true,
  3529.         onAnySetWeather: function (target, source, weather) {
  3530.             if (this.getWeather().id === 'deltastream' && !(weather.id in {desolateland:1, primordialsea:1, deltastream:1, iceage: 1})) return false;
  3531.         },
  3532. },
  3533. "transcendent": {
  3534.         shortDesc: "Moves with increased priority fail in the Pokemon's presence.",
  3535.         id: "transcendent",
  3536.         isNonstandard: true,
  3537.         name: "Transcendent",
  3538.         onAnyTryMove: function (target, source, effect) {
  3539.             if (effect && (effect.priority >= 1)) {
  3540.                 this.attrLastMove('[still]');
  3541.                 this.add('-activate', this.effectData.target, 'ability: Transcendent');
  3542.                 return false;
  3543.             }
  3544.         },
  3545.         rating: 3.5,
  3546.         num: -5,
  3547.     },
  3548. "iceage": {
  3549.         shortDesc: "On switch-in, this Pokemon summons Ice Age.",
  3550.         isNonstandard: true,
  3551.         onStart: function (source) {
  3552.             this.setWeather('iceage');
  3553.         },
  3554.         onAnySetWeather: function (target, source, weather) {
  3555.             if (this.getWeather().id === 'iceage' && !(weather.id in {desolateland:1, primordialsea:1, deltastream:1, iceage: 1})) return false;
  3556.         },
  3557.         onEnd: function (pokemon) {
  3558.             if (this.weatherData.source !== pokemon) return;
  3559.             for (let i = 0; i < this.sides.length; i++) {
  3560.                 for (let j = 0; j < this.sides[i].active.length; j++) {
  3561.                     let target = this.sides[i].active[j];
  3562.                     if (target === pokemon) continue;
  3563.                     if (target && target.hp && target.hasAbility('iceage')) {
  3564.                         this.weatherData.source = target;
  3565.                         return;
  3566.                     }
  3567.                 }
  3568.             }
  3569.             this.clearWeather();
  3570.         },
  3571.         id: "iceage",
  3572.         name: "Ice Age",
  3573.         rating: 5,
  3574.         num: -6,
  3575.     },
  3576. "wellofpower": {
  3577.     shortDesc: "Pokemon uses two-turn moves in one turn.",
  3578.         isNonstandard: true,
  3579.         onChargeMove: function (pokemon, target, move) {
  3580.                 this.debug('well of power - remove charge turn for ' + move.id);
  3581.                 return false; // skip charge turn
  3582.         },
  3583.         id: "wellofpower",
  3584.         name: "Well of Power",
  3585.         rating: 5,
  3586.         num: -7,
  3587. },
  3588. "fluidity": {
  3589.     shortDesc: "Meloetta smoothly changes between formes.",
  3590.         isNonstandard: true,
  3591.         onBeforeMove: function (attacker, defender, move) {
  3592.             if (attacker.template.baseSpecies !== 'Meloetta') return;
  3593.             if (move.category === 'Status') return;
  3594.             let targetSpecies = (move.category === 'Special' ? 'Meloetta' : 'Meloetta-Pirouette');
  3595.             if (attacker.template.species !== targetSpecies && attacker.formeChange(targetSpecies)) {
  3596.                 this.add('-formechange', attacker, targetSpecies, '[from] ability: Fluidity');
  3597.             }
  3598.         },
  3599.         id: "fluidity",
  3600.         name: "Fluidity",
  3601.         rating: 5,
  3602.         num: -8,
  3603. },
  3604. "distortion": {
  3605.     shortDesc: "The user brings the battle into the Distortion World.",
  3606.         isNonstandard: true,
  3607.         onStart: function (source) {
  3608.             this.setWeather('distortion');
  3609.         },
  3610.         onUpdate: function (pokemon) {
  3611.             if (!pokemon.isActive || pokemon.baseTemplate.speciesid !== 'giratina') return;
  3612.             if (this.isWeather(['distortion'])) {
  3613.                 if (pokemon.template.speciesid !== 'giratinaorigin') {
  3614.                     pokemon.formeChange('Giratina-Origin');
  3615.                     this.add('-formechange', pokemon, 'Giratina-Origin', '[msg]');
  3616.                 }
  3617.             } else {
  3618.                 if (pokemon.template.speciesid === 'giratinaorigin') {
  3619.                     pokemon.formeChange('Giratina');
  3620.                     this.add('-formechange', pokemon, 'Giratina', '[msg]');
  3621.                 }
  3622.             }
  3623.         },
  3624.         id: "distortion",
  3625.         name: "Distortion",
  3626.         rating: 5,
  3627.         num: -9,
  3628. },
  3629. };
  3630.  
  3631. /* mods/ghoulking/items.js */
  3632.  
  3633. 'use strict';
  3634.  
  3635. exports.BattleItems = {
  3636. "expertbelt": {
  3637.         inherit: true,
  3638.         onModifyDamage: function (damage, source, target, move) {
  3639.             if (move && move.typeMod > 0) {
  3640.                 return this.chainModify([1.5]);
  3641.             }
  3642.         },
  3643.     },
  3644. "shellbell": {
  3645.         inherit: true,
  3646.         onAfterMoveSecondarySelfPriority: -1,
  3647.         onAfterMoveSecondarySelf: function (pokemon, target, move) {
  3648.             if (move.category !== 'Status') {
  3649.                 this.heal(pokemon.lastDamage / 3, pokemon);
  3650.             }
  3651.     },
  3652. },
  3653. "bigroot": {
  3654.         inherit: true,
  3655.         onTryHealPriority: 1,
  3656.         onTryHeal: function (damage, target, source, effect) {
  3657.             var heals = {drain: 1, leechseed: 1, ingrain: 1, aquaring: 1};
  3658.             if (heals[effect.id]) {
  3659.                 return Math.ceil((damage * 2) - 0.5); // Big Root rounds half down
  3660.             }
  3661.         },
  3662.     },
  3663. "widelens": {
  3664.         inherit: true,
  3665.         onSourceModifyAccuracy: function (accuracy) {
  3666.             if (typeof accuracy === 'number') {
  3667.                 return accuracy * 1.2;
  3668.             }
  3669.         },
  3670.     },
  3671. "zoomlens": {
  3672.         inherit: true,
  3673.         onSourceModifyAccuracy: function (accuracy, target) {
  3674.             if (typeof accuracy === 'number' && !this.willMove(target)) {
  3675.                 this.debug('Zoom Lens boosting accuracy');
  3676.                 return accuracy * 1.5;
  3677.             }
  3678.         },
  3679.     },
  3680. "quickclaw": {
  3681.         inherit: true,
  3682.         onModifyPriority: function (priority, pokemon) {
  3683.             if (pokemon.activeTurns < 2) {
  3684.                 this.add('-activate', pokemon, 'item: Quick Claw');
  3685.                 return priority + 0.1;
  3686.             }
  3687.         },
  3688. },
  3689. "enigmaberry": {
  3690.         inherit: true,
  3691.         onEat: function (pokemon) {
  3692.             this.heal(pokemon.maxhp / 4 * 3);
  3693.         },
  3694. },
  3695. "kingsrock": {
  3696.         inherit: true,
  3697.         onModifyMovePriority: -1,
  3698.         onModifyMove: function (move) {
  3699.             if (move.category !== "Status") {
  3700.                 if (!move.secondaries) move.secondaries = [];
  3701.                 for (let i = 0; i < move.secondaries.length; i++) {
  3702.                     if (move.secondaries[i].volatileStatus === 'flinch') return;
  3703.                 }
  3704.                 move.secondaries.push({
  3705.                     chance: 100,
  3706.                     volatileStatus: 'flinch',
  3707.                 });
  3708.             }
  3709.         },
  3710. },
  3711. "razorfang": {
  3712.         inherit: true,
  3713.         onModifyMovePriority: -1,
  3714.         onModifyMove: function (move) {
  3715.             if (move.category !== "Status") {
  3716.                 if (!move.secondaries) move.secondaries = [];
  3717.                 for (let i = 0; i < move.secondaries.length; i++) {
  3718.                     if (move.secondaries[i].volatileStatus === 'flinch') return;
  3719.                 }
  3720.                 move.secondaries.push({
  3721.                     chance: 100,
  3722.                     volatileStatus: 'flinch',
  3723.                 });
  3724.             }
  3725.         },
  3726. },
  3727. "rockyhelmet": {
  3728.         inherit: true,
  3729.         onAfterDamage: function (damage, target, source, move) {
  3730.             if (source && source !== target && move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3731.                 this.damage(source.maxhp / 6, source, target, null, true);
  3732.             }
  3733.         },
  3734. },
  3735. "stickybarb": {
  3736.         inherit: true,
  3737.         onHit: function (target, source, move) {
  3738.             if (source && source !== target && !source.item && move && move.flags['contact'] && !source.hasAbility('Rock Head')) {
  3739.                 let barb = target.takeItem();
  3740.                 source.setItem(barb);
  3741.                 // no message for Sticky Barb changing hands
  3742.             }
  3743.         },
  3744. }
  3745. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement