Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.16 KB | None | 0 0
  1. 'use strict';
  2.  
  3. exports.BattleAbilities = {
  4. //worth mentioning that -ates still list the normal type moves as the -ate type
  5. //I have confirmed that -ates work though
  6. //all weathers only use rock, water, ice, or fire
  7. "drizzle": {
  8. inherit: true,
  9. onStart: function (source) {
  10. switch(source.hpType) {
  11. case 'Fire':
  12. this.setWeather('sunnyday');
  13. break;
  14. case 'Ice':
  15. this.setWeather('hail');
  16. break;
  17. case 'Rock':
  18. this.setWeather('sandstorm');
  19. break;
  20. default:
  21. this.setWeather('raindance');
  22. break;
  23. }
  24. }
  25. },
  26. "drought": {
  27. inherit: true,
  28. onStart: function (source) {
  29. switch(source.hpType) {
  30. case 'Water':
  31. this.setWeather('raindance');
  32. break;
  33. case 'Ice':
  34. this.setWeather('hail');
  35. break;
  36. case 'Rock':
  37. this.setWeather('sandstorm');
  38. break;
  39. default:
  40. this.setWeather('sunnyday');
  41. break;
  42. }
  43. }
  44. },
  45. "sandstream": {
  46. inherit: true,
  47. onStart: function (source) {
  48. switch(source.hpType) {
  49. case 'Fire':
  50. this.setWeather('sunnyday');
  51. break;
  52. case 'Water':
  53. this.setWeather('raindance');
  54. break;
  55. case 'Ice':
  56. this.setWeather('hail');
  57. break;
  58. default:
  59. this.setWeather('sandstorm');
  60. break;
  61. }
  62. }
  63. },
  64. "snowwarning": {
  65. inherit: true,
  66. onStart: function (source) {
  67. switch(source.hpType) {
  68. case 'Fire':
  69. this.setWeather('sunnyday');
  70. break;
  71. case 'Water':
  72. this.setWeather('raindance');
  73. break;
  74. case 'Rock':
  75. this.setWeather('sandstorm');
  76. break;
  77. default:
  78. this.setWeather('hail');
  79. break;
  80. }
  81. }
  82. },
  83. "hydration": {
  84. inherit: true,
  85. onResidual: function (pokemon) {
  86. let hpType = pokemon.hpType;
  87. let neededWeather = '';
  88. switch(hpType) {
  89. case 'Fire':
  90. neededWeather = 'sunnyday';
  91. break;
  92. case 'Ice':
  93. neededWeather = 'hail';
  94. break;
  95. case 'Rock':
  96. neededWeather = 'sandstorm';
  97. break;
  98. default:
  99. neededWeather = 'raindance';
  100. break;
  101. }
  102. if (pokemon.status && this.isWeather(neededWeather)) {
  103. this.debug('hydration');
  104. this.add('-activate', pokemon, 'ability: Hydration');
  105. pokemon.cureStatus();
  106. }
  107. }
  108. },
  109. "leafguard": {
  110. inherit: true,
  111. onSetStatus: function (pokemon) {
  112. let hpType = pokemon.hpType;
  113. let neededWeather = '';
  114. switch(hpType) {
  115. case 'Water':
  116. neededWeather = 'raindance';
  117. break;
  118. case 'Ice':
  119. neededWeather = 'hail';
  120. break;
  121. case 'Rock':
  122. neededWeather = 'sandstorm';
  123. break;
  124. default:
  125. neededWeather = 'sunnyday';
  126. break;
  127. }
  128. if (this.isWeather(neededWeather)) {
  129. return false;
  130. }
  131. },
  132. onTryHit: function (target, source, move) {
  133. let hpType = target.hpType;
  134. let neededWeather = '';
  135. switch(hpType) {
  136. case 'Water':
  137. neededWeather = 'raindance';
  138. break;
  139. case 'Ice':
  140. neededWeather = 'hail';
  141. break;
  142. case 'Rock':
  143. neededWeather = 'sandstorm';
  144. break;
  145. default:
  146. neededWeather = 'sunnyday';
  147. break;
  148. }
  149. if (move && move.id === 'yawn' && this.isWeather(neededWeather)) {
  150. return false;
  151. }
  152. }
  153. },
  154. "swiftswim": {
  155. inherit: true,
  156. onModifySpe: function (spe, pokemon) {
  157. let hpType = pokemon.hpType;
  158. let neededWeather = '';
  159. switch(hpType) {
  160. case 'Fire':
  161. neededWeather = 'sunnyday';
  162. break;
  163. case 'Ice':
  164. neededWeather = 'hail';
  165. break;
  166. case 'Rock':
  167. neededWeather = 'sandstorm';
  168. break;
  169. default:
  170. neededWeather = 'raindance';
  171. break;
  172. }
  173. if (this.isWeather(neededWeather)) {
  174. return this.chainModify(2);
  175. }
  176. },
  177. onImmunity: function (type, pokemon) {
  178. let hpType = pokemon.hpType;
  179. let neededWeather = '';
  180. switch(hpType) {
  181. case 'Ice':
  182. neededWeather = 'hail';
  183. break;
  184. default:
  185. neededWeather = 'sandstorm';
  186. break;
  187. }
  188. if (type === neededWeather) return false;
  189. }
  190. },
  191. "chlorophyll": {
  192. inherit: true,
  193. onModifySpe: function (spe, pokemon) {
  194. let hpType = pokemon.hpType;
  195. let neededWeather = '';
  196. switch(hpType) {
  197. case 'Water':
  198. neededWeather = 'raindance';
  199. break;
  200. case 'Ice':
  201. neededWeather = 'hail';
  202. break;
  203. case 'Rock':
  204. neededWeather = 'sandstorm';
  205. break;
  206. default:
  207. neededWeather = 'sunnyday';
  208. break;
  209. }
  210. if (this.isWeather(neededWeather)) {
  211. return this.chainModify(2);
  212. }
  213. },
  214. onImmunity: function (type, pokemon) {
  215. let hpType = pokemon.hpType;
  216. let neededWeather = '';
  217. switch(hpType) {
  218. case 'Ice':
  219. neededWeather = 'hail';
  220. break;
  221. default:
  222. neededWeather = 'sandstorm';
  223. break;
  224. }
  225. if (type === neededWeather) return false;
  226. }
  227. },
  228. "sandrush": {
  229. inherit: true,
  230. onModifySpe: function (spe, pokemon) {
  231. let hpType = pokemon.hpType;
  232. let neededWeather = '';
  233. switch(hpType) {
  234. case 'Water':
  235. neededWeather = 'raindance';
  236. break;
  237. case 'Ice':
  238. neededWeather = 'hail';
  239. break;
  240. case 'Fire':
  241. neededWeather = 'sunnyday';
  242. break;
  243. default:
  244. neededWeather = 'sandstorm';
  245. break;
  246. }
  247. if (this.isWeather(neededWeather)) {
  248. return this.chainModify(2);
  249. }
  250. },
  251. onImmunity: function (type, pokemon) {
  252. let hpType = pokemon.hpType;
  253. let neededWeather = '';
  254. switch(hpType) {
  255. case 'Ice':
  256. neededWeather = 'hail';
  257. break;
  258. default:
  259. neededWeather = 'sandstorm';
  260. break;
  261. }
  262. if (type === neededWeather) return false;
  263. }
  264. },
  265. "solarpower": {
  266. inherit: true,
  267. onModifySpA: function (spa, pokemon) {
  268. let hpType = pokemon.hpType;
  269. let neededWeather = '';
  270. switch(hpType) {
  271. case 'Water':
  272. neededWeather = 'raindance';
  273. break;
  274. case 'Ice':
  275. neededWeather = 'hail';
  276. break;
  277. case 'rock':
  278. neededWeather = 'sandstorm';
  279. break;
  280. default:
  281. neededWeather = 'sunnyday';
  282. break;
  283. }
  284. if (this.isWeather(neededWeather)) {
  285. return this.chainModify(1.5);
  286. }
  287. },
  288. onWeather: function (target, source, effect) {
  289. let hpType = target.hpType;
  290. let neededWeather = '';
  291. switch(hpType) {
  292. case 'Water':
  293. neededWeather = 'raindance';
  294. break;
  295. case 'Ice':
  296. neededWeather = 'hail';
  297. break;
  298. case 'rock':
  299. neededWeather = 'sandstorm';
  300. break;
  301. default:
  302. neededWeather = 'sunnyday';
  303. break;
  304. }
  305. if (effect.id === neededWeather) {
  306. this.damage(target.maxhp / 8, target, target);
  307. }
  308. }
  309. },
  310. //ignoring flower gift bc it's exclusive to Cherrim
  311. //if you use cherrim, I'm sorry
  312. //also doesn't make any sense for it to change forms in something like hail
  313. //seriously though, if you use Cherrim, I'm sorry. Also don't use Cherrim.
  314. "sandveil": {
  315. inherit: true,
  316. onImmunity: function (type, pokemon) {
  317. let hpType = pokemon.hpType;
  318. let neededWeather = '';
  319. switch(hpType) {
  320. case 'Ice':
  321. neededWeather = 'hail';
  322. break;
  323. default:
  324. neededWeather = 'sandstorm';
  325. break;
  326. }
  327. if (type === neededWeather) return false;
  328. },
  329. onModifyAccuracy: function (accuracy, pokemon) {
  330. if (typeof accuracy !== 'number') return;
  331. let hpType = pokemon.hpType;
  332. let neededWeather = '';
  333. switch(hpType) {
  334. case 'Water':
  335. neededWeather = 'raindance';
  336. break;
  337. case 'Ice':
  338. neededWeather = 'hail';
  339. break;
  340. case 'Fire':
  341. neededWeather = 'sunnyday';
  342. break;
  343. default:
  344. neededWeather = 'sandstorm';
  345. break;
  346. }
  347. if (this.isWeather(neededWeather)) {
  348. this.debug('Sand Veil - decreasing accuracy');
  349. return accuracy * 0.8;
  350. }
  351. }
  352. },
  353. "snowcloak": {
  354. inherit: true,
  355. onImmunity: function (type, pokemon) {
  356. let hpType = pokemon.hpType;
  357. let neededWeather = '';
  358. switch(hpType) {
  359. case 'Rock':
  360. neededWeather = 'sandstorm';
  361. break;
  362. default:
  363. neededWeather = 'hail';
  364. break;
  365. }
  366. if (type === neededWeather) return false;
  367. },
  368. onModifyAccuracy: function (accuracy, pokemon) {
  369. if (typeof accuracy !== 'number') return;
  370. let hpType = pokemon.hpType;
  371. let neededWeather = '';
  372. switch(hpType) {
  373. case 'Water':
  374. neededWeather = 'raindance';
  375. break;
  376. case 'Rock':
  377. neededWeather = 'sandstorm';
  378. break;
  379. case 'Fire':
  380. neededWeather = 'sunnyday';
  381. break;
  382. default:
  383. neededWeather = 'hail';
  384. break;
  385. }
  386. if (this.isWeather(neededWeather)) {
  387. this.debug('Snow Cloak - decreasing accuracy');
  388. return accuracy * 0.8;
  389. }
  390. }
  391. },
  392. "raindish": {
  393. inherit: true,
  394. onWeather: function (target, source, effect) {
  395. let hpType = target.hpType;
  396. let neededWeather = '';
  397. switch(hpType) {
  398. case 'Fire':
  399. neededWeather = 'sunnyday';
  400. break;
  401. case 'Ice':
  402. neededWeather = 'hail';
  403. break;
  404. case 'Rock':
  405. neededWeather = 'sandstorm';
  406. break;
  407. default:
  408. neededWeather = 'raindance';
  409. break;
  410. }
  411. if (effect.id === neededWeather) {
  412. this.heal(target.maxhp / 16);
  413. }
  414. }
  415. },
  416. //weather done, onto next ones, shouldn't need many switch functions now
  417.  
  418. "aerilate": {
  419. inherit: true,
  420. onModifyMove: function (move, pokemon) {
  421. if (move.type === 'Normal' && move.id !== 'naturalgift') {
  422. move.type = pokemon.hpType;
  423. if (move.category !== 'Status') pokemon.addVolatile('aerilate');
  424. }
  425. }
  426. },
  427. "pixilate": {
  428. inherit: true,
  429. onModifyMove: function (move, pokemon) {
  430. if (move.type === 'Normal' && move.id !== 'naturalgift') {
  431. move.type = pokemon.hpType;
  432. if (move.category !== 'Status') pokemon.addVolatile('pixilate');
  433. }
  434. }
  435. },
  436. "refrigerate": {
  437. inherit: true,
  438. onModifyMove: function (move, pokemon) {
  439. if (move.type === 'Normal' && move.id !== 'naturalgift') {
  440. move.type = pokemon.hpType;
  441. if (move.category !== 'Status') pokemon.addVolatile('refrigerate');
  442. }
  443. }
  444. },
  445. //ates done
  446.  
  447. "blaze": {
  448. inherit: true,
  449. onModifyAtk: function (atk, attacker, defender, move) {
  450. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  451. this.debug('Blaze boost');
  452. return this.chainModify(1.5);
  453. }
  454. },
  455. onModifySpA: function (atk, attacker, defender, move) {
  456. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  457. this.debug('Blaze boost');
  458. return this.chainModify(1.5);
  459. }
  460. }
  461. },
  462. "torrent": {
  463. inherit: true,
  464. onModifyAtk: function (atk, attacker, defender, move) {
  465. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  466. this.debug('Torrent boost');
  467. return this.chainModify(1.5);
  468. }
  469. },
  470. onModifySpA: function (atk, attacker, defender, move) {
  471. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  472. this.debug('Torrent boost');
  473. return this.chainModify(1.5);
  474. }
  475. }
  476. },
  477. "overgrow": {
  478. inherit: true,
  479. onModifyAtk: function (atk, attacker, defender, move) {
  480. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  481. this.debug('Overgrow boost');
  482. return this.chainModify(1.5);
  483. }
  484. },
  485. onModifySpA: function (atk, attacker, defender, move) {
  486. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  487. this.debug('Overgrow boost');
  488. return this.chainModify(1.5);
  489. }
  490. }
  491. },
  492. "swarm": {
  493. inherit: true,
  494. onModifyAtk: function (atk, attacker, defender, move) {
  495. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  496. this.debug('Swarm boost');
  497. return this.chainModify(1.5);
  498. }
  499. },
  500. onModifySpA: function (atk, attacker, defender, move) {
  501. if (move.type === attacker.hpType && attacker.hp <= attacker.maxhp / 3) {
  502. this.debug('Swarm boost');
  503. return this.chainModify(1.5);
  504. }
  505. }
  506. },
  507. //skipping Uber only abilities, also Flower Veil
  508.  
  509. "galewings": {
  510. inherit: true,
  511. onModifyPriority: function (priority, pokemon, target, move) {
  512. if (move && move.type === pokemon.hpType) return priority + 1;
  513. }
  514. },
  515. "heatproof": {
  516. inherit: true,
  517. onSourceBasePower: function (basePower, attacker, defender, move) {
  518. if (move.type === defender.hpType) {
  519. return this.chainModify(0.5);
  520. }
  521. }
  522. //ignoring halving toxic damage bc they're already steel
  523. },
  524. "justified": {
  525. inherit: true,
  526. onAfterDamage: function (damage, target, source, effect) {
  527. if (effect && effect.type === target.hpType) {
  528. this.boost({atk:1});
  529. }
  530. }
  531. },
  532. "levitate": {
  533. inherit: true,
  534. onImmunity: function (type, pokemon) {
  535. if (type === pokemon.hpType) return false;
  536. }
  537. },
  538. "lightningrod": {
  539. inherit: true,
  540. onTryHit: function (target, source, move) {
  541. if (target !== source && move.type === target.hpType) {
  542. if (!this.boost({spa:1})) {
  543. this.add('-immune', target, '[msg]', '[from] ability: Lightning Rod');
  544. }
  545. return null;
  546. }
  547. }
  548. },
  549. "magnetpull": {
  550. //note: may be iffy, if doesn't work, idk man, maybe get rid of modify
  551. inherit: true,
  552. onFoeModifyPokemon: function (pokemon, source) {
  553. if (pokemon.hasType(source.hpType) && this.isAdjacent(pokemon, this.effectData.target)) {
  554. pokemon.tryTrap(true);
  555. }
  556. },
  557. onFoeMaybeTrapPokemon: function (pokemon, source) {
  558. if (!source) source = this.effectData.target;
  559. if (pokemon.hasType(source.hpType) && this.isAdjacent(pokemon, source)) {
  560. pokemon.maybeTrapped = true;
  561. }
  562. }
  563. },
  564. "motordrive": {
  565. inherit: true,
  566. onTryHit: function (target, source, move) {
  567. if (target !== source && move.type === target.hpType) {
  568. if (!this.boost({spe:1})) {
  569. this.add('-immune', target, '[msg]', '[from] ability: Motor Drive');
  570. }
  571. return null;
  572. }
  573. }
  574. },
  575. "normalize": {
  576. inherit: true,
  577. onModifyMove: function (move, pokemon) {
  578. if (move.id !== 'struggle') {
  579. move.type = pokemon.hpType;
  580. }
  581. }
  582. },
  583. //"scrappy" problem
  584. "stormdrain": {
  585. inherit: true,
  586. onTryHit: function (target, source, move) {
  587. if (target !== source && move.type === target.hpType) {
  588. if (!this.boost({spa:1})) {
  589. this.add('-immune', target, '[msg]', '[from] ability: Storm Drain');
  590. }
  591. return null;
  592. }
  593. }
  594. },
  595. "sapsipper": {
  596. inherit: true,
  597. onTryHit: function (target, source, move) {
  598. if (target !== source && move.type === target.hpType) {
  599. if (!this.boost({atk:1})) {
  600. this.add('-immune', target, '[msg]', '[from] ability: Sap Sipper');
  601. }
  602. return null;
  603. }
  604. }
  605. },
  606. "voltabsorb": {
  607. inherit: true,
  608. onTryHit: function (target, source, move) {
  609. if (target !== source && move.type === target.hpType) {
  610. if (!this.heal(target.maxhp / 4)) {
  611. this.add('-immune', target, '[msg]', '[from] ability: Volt Absorb');
  612. }
  613. return null;
  614. }
  615. }
  616. },
  617. "waterabsorb": {
  618. inherit: true,
  619. onTryHit: function (target, source, move) {
  620. if (target !== source && move.type === target.hpType) {
  621. if (!this.heal(target.maxhp / 4)) {
  622. this.add('-immune', target, '[msg]', '[from] ability: Water Absorb');
  623. }
  624. return null;
  625. }
  626. }
  627. },
  628. "flashfire": {
  629. //note: flash fire will raise the power of its Hidden Power type moves
  630. //can't change the message displayed
  631. inherit: true,
  632. onTryHit: function (target, source, move) {
  633. if (target !== source && move.type === target.hpType) {
  634. move.accuracy = true;
  635. if (!target.addVolatile('flashfire')) {
  636. this.add('-immune', target, '[msg]', '[from] ability: Flash Fire');
  637. }
  638. return null;
  639. }
  640. },
  641. effect: {
  642. noCopy: true, // doesn't get copied by Baton Pass
  643. onStart: function (target) {
  644. this.add('-start', target, 'ability: Flash Fire');
  645. },
  646. onModifyAtkPriority: 5,
  647. onModifyAtk: function (atk, attacker, defender, move) {
  648. if (move.type === defender.hpType) {
  649. this.debug('Flash Fire boost');
  650. return this.chainModify(1.5);
  651. }
  652. },
  653. onModifySpAPriority: 5,
  654. onModifySpA: function (atk, attacker, defender, move) {
  655. if (move.type === defender.hpType) {
  656. this.debug('Flash Fire boost');
  657. return this.chainModify(1.5);
  658. }
  659. },
  660. onEnd: function (target) {
  661. this.add('-end', target, 'ability: Flash Fire', '[silent]');
  662. }
  663. }
  664. }
  665. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement