Advertisement
Guest User

Untitled

a guest
Apr 10th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.65 KB | None | 0 0
  1. //mods/lockdown/moves.js
  2. 'use strict';
  3.  
  4. exports.BattleMovedex = {
  5. watersport: {
  6. inherit: true,
  7. effect: {
  8. duration: 5,
  9. durationCallback: function () {
  10. if (this.turn > 2) return 999;
  11. return 5;
  12. },
  13. onStart: function (side, source) {
  14. this.add('-fieldstart', 'move: Water Sport', '[of] ' + source);
  15. },
  16. onBasePowerPriority: 1,
  17. onBasePower: function (basePower, attacker, defender, move) {
  18. if (move.type === 'Fire') {
  19. this.debug('water sport weaken');
  20. return this.chainModify([0x548, 0x1000]);
  21. }
  22. },
  23. onResidualOrder: 21,
  24. onEnd: function () {
  25. this.add('-fieldend', 'move: Water Sport');
  26. },
  27. }
  28. },
  29. mudsport: {
  30. inherit: true,
  31. effect: {
  32. duration: 5,
  33. durationCallback: function () {
  34. if (this.turn > 2) return 999;
  35. return 5;
  36. },
  37. onStart: function (side, source) {
  38. this.add('-fieldstart', 'move: Mud Sport', '[of] ' + source);
  39. },
  40. onBasePowerPriority: 1,
  41. onBasePower: function (basePower, attacker, defender, move) {
  42. if (move.type === 'Electric') {
  43. this.debug('mud sport weaken');
  44. return this.chainModify([0x548, 0x1000]);
  45. }
  46. },
  47. onResidualOrder: 21,
  48. onEnd: function () {
  49. this.add('-fieldend', 'move: Mud Sport');
  50. },
  51. },
  52. },
  53. electricterrain: {
  54. inherit: true,
  55. effect: {
  56. duration: 5,
  57. durationCallback: function () {
  58. if (this.turn > 2) return 999;
  59. return 5;
  60. },
  61. onSetStatus: function (status, target, source, effect) {
  62. if (status.id === 'slp' && target.isGrounded() && !target.isSemiInvulnerable()) {
  63. this.debug('Interrupting sleep from Electric Terrain');
  64. return false;
  65. }
  66. },
  67. onTryHit: function (target, source, move) {
  68. if (!target.isGrounded() || target.isSemiInvulnerable()) return;
  69. if (move && move.id === 'yawn') {
  70. return false;
  71. }
  72. },
  73. onBasePower: function (basePower, attacker, defender, move) {
  74. if (move.type === 'Electric' && attacker.isGrounded() && !attacker.isSemiInvulnerable()) {
  75. this.debug('electric terrain boost');
  76. return this.chainModify(1.5);
  77. }
  78. },
  79. onStart: function () {
  80. this.add('-fieldstart', 'move: Electric Terrain');
  81. },
  82. onResidualOrder: 21,
  83. onResidualSubOrder: 2,
  84. onEnd: function () {
  85. this.add('-fieldend', 'move: Electric Terrain');
  86. },
  87. },
  88. },
  89. grassyterrain: {
  90. inherit: true,
  91. effect: {
  92. duration: 5,
  93. durationCallback: function () {
  94. if (this.turn > 2) return 999;
  95. return 5;
  96. },
  97. onBasePower: function (basePower, attacker, defender, move) {
  98. let weakenedMoves = {'earthquake':1, 'bulldoze':1, 'magnitude':1};
  99. if (move.id in weakenedMoves) {
  100. this.debug('move weakened by grassy terrain');
  101. return this.chainModify(0.5);
  102. }
  103. if (move.type === 'Grass' && attacker.isGrounded()) {
  104. this.debug('grassy terrain boost');
  105. return this.chainModify(1.5);
  106. }
  107. },
  108. onStart: function (target, source) {
  109. this.add('-fieldstart', 'move: Grassy Terrain');
  110. },
  111. onResidualOrder: 5,
  112. onResidualSubOrder: 2,
  113. onResidual: function (battle) {
  114. this.debug('onResidual battle');
  115. let pokemon;
  116. for (let s in battle.sides) {
  117. for (let p in battle.sides[s].active) {
  118. pokemon = battle.sides[s].active[p];
  119. if (pokemon.isGrounded() && !pokemon.isSemiInvulnerable()) {
  120. this.debug('Pokemon is grounded, healing through Grassy Terrain.');
  121. this.heal(pokemon.maxhp / 16, pokemon, pokemon);
  122. }
  123. }
  124. }
  125. },
  126. onEnd: function () {
  127. this.add('-fieldend', 'move: Grassy Terrain');
  128. },
  129. },
  130. },
  131. mistyterrain: {
  132. inherit: true,
  133. effect: {
  134. duration: 5,
  135. durationCallback: function () {
  136. if (this.turn > 2) return 999;
  137. return 5;
  138. },
  139. onSetStatus: function (status, target, source, effect) {
  140. if (!target.isGrounded() || target.isSemiInvulnerable()) return;
  141. this.debug('misty terrain preventing status');
  142. return false;
  143. },
  144. onBasePower: function (basePower, attacker, defender, move) {
  145. if (move.type === 'Dragon' && defender.isGrounded() && !defender.isSemiInvulnerable()) {
  146. this.debug('misty terrain weaken');
  147. return this.chainModify(0.5);
  148. }
  149. },
  150. onStart: function (side) {
  151. this.add('-fieldstart', 'Misty Terrain');
  152. },
  153. onResidualOrder: 21,
  154. onResidualSubOrder: 2,
  155. onEnd: function (side) {
  156. this.add('-fieldend', 'Misty Terrain');
  157. },
  158. },
  159. },
  160. gravity: {
  161. inherit: true,
  162. effect: {
  163. duration: 5,
  164. durationCallback: function () {
  165. //ignoring Persistent ability
  166. if (this.turn > 2) return 999;
  167. return 5;
  168. },
  169. onStart: function () {
  170. this.add('-fieldstart', 'move: Gravity');
  171. for (let side of this.sides) for (let pokemon of side.pokemon) {
  172. let applies = false;
  173. if (pokemon.removeVolatile('bounce') || pokemon.removeVolatile('fly')) {
  174. applies = true;
  175. this.cancelMove(pokemon);
  176. pokemon.removeVolatile('twoturnmove');
  177. }
  178. if (pokemon.volatiles['skydrop']) {
  179. applies = true;
  180. this.cancelMove(pokemon);
  181.  
  182. if (pokemon.volatiles['skydrop'].source) {
  183. this.add('-end', pokemon.volatiles['twoturnmove'].source, 'Sky Drop', '[interrupt]');
  184. }
  185. pokemon.removeVolatile('skydrop');
  186. pokemon.removeVolatile('twoturnmove');
  187. }
  188. if (pokemon.volatiles['magnetrise']) {
  189. applies = true;
  190. delete pokemon.volatiles['magnetrise'];
  191. }
  192. if (pokemon.volatiles['telekinesis']) {
  193. applies = true;
  194. delete pokemon.volatiles['telekinesis'];
  195. }
  196. if (applies) this.add('-activate', pokemon, 'Gravity');
  197. }
  198. },
  199. onModifyAccuracy: function (accuracy) {
  200. if (typeof accuracy !== 'number') return;
  201. return accuracy * 5 / 3;
  202. },
  203. onDisableMove: function (pokemon) {
  204. let disabledMoves = {bounce:1, fly:1, flyingpress:1, highjumpkick:1, jumpkick:1, magnetrise:1, skydrop:1, splash:1, telekinesis:1};
  205. for (let m in disabledMoves) {
  206. pokemon.disableMove(m);
  207. }
  208. },
  209. // groundedness implemented in battle.engine.js:BattlePokemon#isGrounded
  210. onBeforeMovePriority: 6,
  211. onBeforeMove: function (pokemon, target, move) {
  212. if (move.flags['gravity']) {
  213. this.add('cant', pokemon, 'move: Gravity', move);
  214. return false;
  215. }
  216. },
  217. onResidualOrder: 22,
  218. onEnd: function () {
  219. this.add('-fieldend', 'move: Gravity');
  220. },
  221. },
  222. },
  223. trickroom: {
  224. inherit: true,
  225. effect: {
  226. duration: 5,
  227. durationCallback: function () {
  228. if (this.turn > 2) return 999;
  229. return 5;
  230. },
  231. onStart: function (target, source) {
  232. this.add('-fieldstart', 'move: Trick Room', '[of] ' + source);
  233. },
  234. // Speed modification is changed in BattlePokemon.getDecisionSpeed() in battle-engine.js
  235. onResidualOrder: 23,
  236. onEnd: function () {
  237. this.add('-fieldend', 'move: Trick Room');
  238. },
  239. },
  240. },
  241. magicroom: {
  242. inherit: true,
  243. effect: {
  244. duration: 5,
  245. durationCallback: function () {
  246. if (this.turn > 2) return 999;
  247. return 5;
  248. },
  249. onStart: function (target, source) {
  250. this.add('-fieldstart', 'move: Magic Room', '[of] ' + source);
  251. },
  252. // Item suppression implemented in BattlePokemon.ignoringItem() within battle-engine.js
  253. onResidualOrder: 25,
  254. onEnd: function () {
  255. this.add('-fieldend', 'move: Magic Room', '[of] ' + this.effectData.source);
  256. },
  257. },
  258.  
  259. },
  260. wonderroom: {
  261. inherit: true,
  262. effect: {
  263. duration: 5,
  264. durationCallback: function () {
  265. if (this.turn > 2) return 999;
  266. return 5;
  267. },
  268. onStart: function (side, source) {
  269. this.add('-fieldstart', 'move: WonderRoom', '[of] ' + source);
  270. },
  271. onModifyMovePriority: -100,
  272. onModifyMove: function (move) {
  273. move.defensiveCategory = ((move.defensiveCategory || this.getCategory(move)) === 'Physical' ? 'Special' : 'Physical');
  274. this.debug('Defensive Category: ' + move.defensiveCategory);
  275. },
  276. onResidualOrder: 24,
  277. onEnd: function () {
  278. this.add('-fieldend', 'move: Wonder Room');
  279. },
  280. },
  281. },
  282. defog: {
  283. inherit: true,
  284. onHit: function (target, source, move) {
  285. if (!target.volatiles['substitute'] || move.infiltrates) this.boost({evasion:-1});
  286.  
  287. let removeTarget = {reflect:1, lightscreen:1, safeguard:1, mist:1};
  288. if (this.turn < 7) {
  289. removeTarget = {reflect:1, lightscreen:1, safeguard:1, mist:1, spikes:1, toxicspikes:1, stealthrock:1, stickyweb:1};
  290. }
  291.  
  292. let removeAll = {spikes:1, toxicspikes:1, stealthrock:1, stickyweb:1};
  293.  
  294.  
  295. for (let targetCondition in removeTarget) {
  296. if (target.side.removeSideCondition(targetCondition)) {
  297. if (!removeAll[targetCondition]) continue;
  298. this.add('-sideend', target.side, this.getEffect(targetCondition).name, '[from] move: Defog', '[of] ' + target);
  299. }
  300. }
  301. if (this.turn < 7) {
  302. for (let sideCondition in removeAll) {
  303. if (source.side.removeSideCondition(sideCondition)) {
  304. this.add('-sideend', source.side, this.getEffect(sideCondition).name, '[from] move: Defog', '[of] ' + source);
  305. }
  306. }
  307. }
  308. },
  309. },
  310. rapidspin: {
  311. inherit: true,
  312. self: {
  313. onHit: function (pokemon) {
  314. if (pokemon.hp && pokemon.removeVolatile('leechseed')) {
  315. this.add('-end', pokemon, 'Leech Seed', '[from] move: Rapid Spin', '[of] ' + pokemon);
  316. }
  317. let sideConditions = {spikes:1, toxicspikes:1, stealthrock:1, stickyweb:1};
  318. if (this.turn < 7) {
  319. for (let i in sideConditions) {
  320. if (pokemon.hp && pokemon.side.removeSideCondition(i)) {
  321. this.add('-sideend', pokemon.side, this.getEffect(i).name, '[from] move: Rapid Spin', '[of] ' + pokemon);
  322. }
  323. }
  324. }
  325. if (pokemon.hp && pokemon.volatiles['partiallytrapped']) {
  326. pokemon.removeVolatile('partiallytrapped');
  327. }
  328. },
  329. },
  330. },
  331. toxicspikes: {
  332. inherit: true,
  333. effect: {
  334. // this is a side condition
  335. onStart: function (side) {
  336. this.add('-sidestart', side, 'move: Toxic Spikes');
  337. this.effectData.layers = 1;
  338. },
  339. onRestart: function (side) {
  340. if (this.effectData.layers >= 2) return false;
  341. this.add('-sidestart', side, 'move: Toxic Spikes');
  342. this.effectData.layers++;
  343. },
  344. onSwitchIn: function (pokemon) {
  345. if (!pokemon.isGrounded()) return;
  346. if (!pokemon.runImmunity('Poison')) return;
  347. if (pokemon.hasType('Poison')) {
  348. if (this.turn < 7) {
  349. this.add('-sideend', pokemon.side, 'move: Toxic Spikes', '[of] ' + pokemon);
  350. pokemon.side.removeSideCondition('toxicspikes');
  351. }
  352. } else if (this.effectData.layers >= 2) {
  353. pokemon.trySetStatus('tox', pokemon.side.foe.active[0]);
  354. } else {
  355. pokemon.trySetStatus('psn', pokemon.side.foe.active[0]);
  356. }
  357. },
  358. },
  359. }
  360. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement