Guest User

PS! Linked statuses.js

a guest
Jul 13th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* mods/linked/statuses.js */
  2.  
  3. 'use strict';
  4.  
  5. exports.BattleStatuses = {
  6.     slp: {
  7.         inherit: true,
  8.         onBeforeMove: function (pokemon, target, move) {
  9.             if (this.effectData.timerDecreased !== this.turn) {
  10.                 this.effectData.timerDecreased = this.turn;
  11.                 if (pokemon.getAbility().isHalfSleep) {
  12.                     pokemon.statusData.time--;
  13.                 }
  14.                 pokemon.statusData.time--;
  15.                 if (pokemon.statusData.time <= 0) {
  16.                     pokemon.cureStatus();
  17.                     return;
  18.                 }
  19.                 this.add('cant', pokemon, 'slp');
  20.             }
  21.             if (move.sleepUsable) {
  22.                 return;
  23.             }
  24.             return false;
  25.         },
  26.     },
  27.     frz: {
  28.         inherit: true,
  29.         onBeforeMove: function (pokemon, target, move) {
  30.             if (move.flags['defrost']) return;
  31.             if (this.effectData.durationRolled !== this.turn && this.random(5) === 0) {
  32.                 pokemon.cureStatus();
  33.                 return;
  34.             }
  35.             if (this.effectData.durationRolled !== this.turn) {
  36.                 // Display the `frozen` message only once per turn.
  37.                 this.effectData.durationRolled = this.turn;
  38.                 this.add('cant', pokemon, 'frz');
  39.             }
  40.             return false;
  41.         },
  42.     },
  43.     confusion: {
  44.         inherit: true,
  45.         onBeforeMove: function (pokemon) {
  46.             if (this.effectData.timerDecreased !== this.turn) {
  47.                 this.effectData.timerDecreased = this.turn;
  48.                 pokemon.volatiles.confusion.time--;
  49.                 if (!pokemon.volatiles.confusion.time) {
  50.                     pokemon.removeVolatile('confusion');
  51.                     return;
  52.                 }
  53.             }
  54.             this.add('-activate', pokemon, 'confusion');
  55.             if (this.random(2) === 0) {
  56.                 return;
  57.             }
  58.             this.directDamage(this.getDamage(pokemon, pokemon, 40));
  59.             return false;
  60.         },
  61.     },
  62.     flinch: {
  63.         inherit: true,
  64.         onBeforeMove: function (pokemon) {
  65.             if (this.effectData.movePrevented) return false;
  66.             if (!this.runEvent('Flinch', pokemon)) {
  67.                 return;
  68.             }
  69.             if (!this.effectData.movePrevented) {
  70.                 // no need to display the flinch message twice
  71.                 this.effectData.movePrevented = true;
  72.                 this.add('cant', pokemon, 'flinch');
  73.             }
  74.             return false;
  75.         },
  76.     },
  77.     mustrecharge: {
  78.         inherit: true,
  79.         onBeforeMove: function (pokemon) {
  80.             if (!this.effectData.movePrevented) {
  81.                 // no need to display the recharge message twice
  82.                 this.effectData.movePrevented = true;
  83.                 this.add('cant', pokemon, 'recharge');
  84.             }
  85.             if (!pokemon.moveThisTurn) pokemon.removeVolatile('mustrecharge');
  86.             return false;
  87.         },
  88.     },
  89.  
  90.     /**
  91.      * Gems and Auras
  92.      * Make sure that they only boost a single move
  93.      *
  94.      */
  95.  
  96.     gem: {
  97.         inherit: true,
  98.         onBeforeMove: function (pokemon) {
  99.             if (pokemon.moveThisTurn) pokemon.removeVolatile('gem');
  100.         },
  101.     },
  102.     aura: {
  103.         inherit: true,
  104.         onBeforeMove: function (pokemon) {
  105.             if (pokemon.moveThisTurn) pokemon.removeVolatile('aura');
  106.         },
  107.     },
  108. };
Add Comment
Please, Sign In to add comment