Advertisement
Pikachuun

mods/poweredup/abilities.js

Feb 28th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.71 KB | None | 0 0
  1. exports.BattleAbilities = {
  2. "adaptability": {
  3. inherit: true,
  4. onModifyMove: function (move) {
  5. move.stab = 8/3;
  6. }
  7. },
  8. "aftermath": {
  9. inherit: true,
  10. onAfterDamage: function (damage, target, source, move) {
  11. if (source && source !== target && move && move.isContact && !target.hp) {
  12. this.damage(source.maxhp / 2, source, target, null, true);
  13. }
  14. }
  15. },
  16. "aerilate": {
  17. inherit: true,
  18. effect: {
  19. duration: 1,
  20. onBasePowerPriority: 8,
  21. onBasePower: function (basePower, pokemon, target, move) {
  22. return this.chainModify([0x199A, 0x1000]);
  23. }
  24. }
  25. },
  26. "analytic": {
  27. inherit: true,
  28. onBasePower: function (basePower, attacker, defender, move) {
  29. if (!this.willMove(defender)) {
  30. this.debug('Analytic boost');
  31. return this.chainModify([0x199A, 0x1000]); // The Analytic modifier is slightly higher than the normal 1.3 (0x14CC)
  32. }
  33. }
  34. },
  35. "baddreams": {
  36. inherit: true,
  37. onResidual: function (pokemon) {
  38. if (!pokemon.hp) return;
  39. for (var i = 0; i < pokemon.side.foe.active.length; i++) {
  40. var target = pokemon.side.foe.active[i];
  41. if (!target || !target.hp) continue;
  42. if (target.status === 'slp') {
  43. this.damage(target.maxhp / 4, target);
  44. }
  45. }
  46. }
  47. },
  48. "blaze": {
  49. inherit: true,
  50. onModifyAtk: function (atk, attacker, defender, move) {
  51. if (move.type === 'Fire' && attacker.hp <= attacker.maxhp / 3) {
  52. this.debug('Blaze boost');
  53. return this.chainModify(2);
  54. }
  55. },
  56. onModifySpA: function (atk, attacker, defender, move) {
  57. if (move.type === 'Fire' && attacker.hp <= attacker.maxhp / 3) {
  58. this.debug('Blaze boost');
  59. return this.chainModify(2);
  60. }
  61. }
  62. },
  63. "cheekpouch": {
  64. inherit: true,
  65. onEatItem: function (item, pokemon) {
  66. this.heal(2 * pokemon.maxhp / 3);
  67. }
  68. },
  69. "chlorophyll": {
  70. inherit: true,
  71. onModifySpe: function (speMod) {
  72. if (this.isWeather(['sunnyday', 'desolateland'])) {
  73. return this.chain(speMod, 3);
  74. }
  75. }
  76. },
  77. "competitive": {
  78. inherit: true,
  79. onAfterEachBoost: function (boost, target, source) {
  80. if (!source || target.side === source.side) {
  81. return;
  82. }
  83. var statsLowered = false;
  84. for (var i in boost) {
  85. if (boost[i] < 0) {
  86. statsLowered = true;
  87. }
  88. }
  89. if (statsLowered) {
  90. this.boost({spa: 4});
  91. }
  92. }
  93. },
  94. "compoundeyes": {
  95. inherit: true,
  96. onSourceAccuracy: function (accuracy) {
  97. if (typeof accuracy !== 'number') return;
  98. this.debug('compoundeyes - enhancing accuracy');
  99. return accuracy * 1.6;
  100. }
  101. },
  102. "cursedbody": {
  103. inherit: true,
  104. onAfterDamage: function (damage, target, source, move) {
  105. if (!source || source.volatiles['disable']) return;
  106. if (source !== target && move && move.effectType === 'Move') {
  107. if (this.random(10) < 6) {
  108. source.addVolatile('disable');
  109. }
  110. }
  111. }
  112. },
  113. "cutecharm": {
  114. inherit: true,
  115. onAfterDamage: function (damage, target, source, move) {
  116. if (move && move.isContact) {
  117. if (this.random(10) < 6) {
  118. source.addVolatile('attract', target);
  119. }
  120. }
  121. }
  122. },
  123. "defeatist": {
  124. inherit: true,
  125. onModifyAtk: function (atk, pokemon) {
  126. if (pokemon.hp < pokemon.maxhp / 2) {
  127. return this.chainModify(1/3);
  128. }
  129. },
  130. onModifySpA: function (atk, pokemon) {
  131. if (pokemon.hp < pokemon.maxhp / 2) {
  132. return this.chainModify(1/3);
  133. }
  134. }
  135. },
  136. "defiant": {
  137. inherit: true,
  138. onAfterEachBoost: function (boost, target, source) {
  139. if (!source || target.side === source.side) {
  140. return;
  141. }
  142. var statsLowered = false;
  143. for (var i in boost) {
  144. if (boost[i] < 0) {
  145. statsLowered = true;
  146. }
  147. }
  148. if (statsLowered) {
  149. this.boost({atk: 4});
  150. }
  151. }
  152. },
  153. "download": {
  154. inherit: true,
  155. onStart: function (pokemon) {
  156. var foeactive = pokemon.side.foe.active;
  157. var totaldef = 0;
  158. var totalspd = 0;
  159. for (var i = 0; i < foeactive.length; i++) {
  160. if (!foeactive[i] || foeactive[i].fainted) continue;
  161. totaldef += foeactive[i].getStat('def', false, true);
  162. totalspd += foeactive[i].getStat('spd', false, true);
  163. }
  164. if (totaldef && totaldef >= totalspd) {
  165. this.boost({spa:2});
  166. } else if (totalspd) {
  167. this.boost({atk:2});
  168. }
  169. }
  170. },
  171. "dryskin": {
  172. inherit: true,
  173. onTryHit: function (target, source, move) {
  174. if (target !== source && move.type === 'Water') {
  175. if (!this.heal(target.maxhp / 2)) {
  176. this.add('-immune', target, '[msg]');
  177. }
  178. return null;
  179. }
  180. },
  181. onFoeBasePower: function (basePower, attacker, defender, move) {
  182. if (this.effectData.target !== defender) return;
  183. if (move.type === 'Fire') {
  184. return this.chainModify(1.5);
  185. }
  186. },
  187. onWeather: function (target, source, effect) {
  188. if (effect.id === 'raindance' || effect.id === 'primordialsea') {
  189. this.heal(target.maxhp / 4);
  190. } else if (effect.id === 'sunnyday' || effect.id === 'desolateland') {
  191. this.damage(target.maxhp / 4);
  192. }
  193. }
  194. },
  195. "effectspore": {
  196. inherit: true,
  197. onAfterDamage: function (damage, target, source, move) {
  198. if (move && move.isContact && !source.status && source.runImmunity('powder')) {
  199. var r = this.random(100);
  200. if (r < 21) {
  201. source.setStatus('slp', target);
  202. } else if (r < 41) {
  203. source.setStatus('par', target);
  204. } else if (r < 60) {
  205. source.setStatus('psn', target);
  206. }
  207. }
  208. }
  209. },
  210. "filter": {
  211. inherit: true,
  212. onSourceModifyDamage: function (damage, source, target, move) {
  213. if (target.runEffectiveness(move) > 0) {
  214. this.debug('Filter neutralize');
  215. return this.chainModify(0.5);
  216. }
  217. }
  218. },
  219. "flamebody": {
  220. inherit: true,
  221. onAfterDamage: function (damage, target, source, move) {
  222. if (move && move.isContact) {
  223. if (this.random(10) < 6) {
  224. source.trySetStatus('brn', target, move);
  225. }
  226. }
  227. }
  228. },
  229. "flareboost": {
  230. inherit: true,
  231. onBasePower: function (basePower, attacker, defender, move) {
  232. if (attacker.status === 'brn' && move.category === 'Special') {
  233. return this.chainModify(2);
  234. }
  235. }
  236. },
  237. "flashfire": {
  238. inherit: true,
  239. effect: {
  240. noCopy: true, // doesn't get copied by Baton Pass
  241. onStart: function (target) {
  242. this.add('-start', target, 'ability: Flash Fire');
  243. },
  244. onModifyAtkPriority: 5,
  245. onModifyAtk: function (atk, attacker, defender, move) {
  246. if (move.type === 'Fire') {
  247. this.debug('Flash Fire boost');
  248. return this.chainModify(2);
  249. }
  250. },
  251. onModifySpAPriority: 5,
  252. onModifySpA: function (atk, attacker, defender, move) {
  253. if (move.type === 'Fire') {
  254. this.debug('Flash Fire boost');
  255. return this.chainModify(2);
  256. }
  257. }
  258. }
  259. },
  260. "flowergift": {
  261. inherit: true,
  262. onAllyModifyAtk: function (atk) {
  263. if (this.effectData.target.template.speciesid !== 'cherrim') return;
  264. if (this.isWeather(['sunnyday', 'desolateland'])) {
  265. return this.chainModify(2);
  266. }
  267. },
  268. onAllyModifySpD: function (spd) {
  269. if (this.effectData.target.template.speciesid !== 'cherrim') return;
  270. if (this.isWeather(['sunnyday', 'desolateland'])) {
  271. return this.chainModify(2);
  272. }
  273. }
  274. },
  275. "forewarn": {
  276. inherit: true,
  277. onStart: function (pokemon) {
  278. var targets = pokemon.side.foe.active;
  279. var warnMoves0 = [];
  280. var warnMoves1 = [];
  281. var warnBp0 = 1;
  282. var warnBp1 = 1;
  283. for (var i = 0; i < targets.length; i++) {
  284. if (targets[i].fainted) continue;
  285. for (var j = 0; j < targets[i].moveset.length; j++) {
  286. var move = this.getMove(targets[i].moveset[j].move);
  287. var bp = move.basePower;
  288. if (move.ohko) bp = 160;
  289. if (move.id === 'counter' || move.id === 'metalburst' || move.id === 'mirrorcoat') bp = 120;
  290. if (!bp && move.category !== 'Status') bp = 80;
  291. if (bp > warnBp0) {
  292. warnMoves1 = warnMoves0;
  293. warnMoves0 = [[move, targets[i]]];
  294. warnBp1 = warnBp0;
  295. warnBp0 = bp;
  296. } else if (bp === warnBp0) {
  297. warnMoves0.push([move, targets[i]]);
  298. } else if (bp === warnBp1) {
  299. warnMoves1.push([move, targets[i]]);
  300. }
  301. }
  302. }
  303. if (!warnMoves0.length) return;
  304. var warnMove0 = warnMoves0[this.random(warnMoves0.length)];
  305. this.add('-activate', pokemon, 'ability: Forewarn', warnMove0[0], warnMove0[1]);
  306. if (!warnMoves1.length) return;
  307. var warnMove1 = warnMoves1[this.random(warnMoves1.length)];
  308. this.add('-activate', pokemon, 'ability: Forewarn', warnMove1[0], warnMove0[1]);
  309. }
  310. },
  311. "friendguard": {
  312. inherit: true,
  313. onAnyModifyDamage: function (damage, source, target, move) {
  314. if (target !== this.effectData.target && target.side === this.effectData.target.side) {
  315. this.debug('Friend Guard weaken');
  316. return this.chainModify(0.5);
  317. }
  318. }
  319. },
  320. "furcoat": {
  321. inherit: true,
  322. onModifyDef: function (def) {
  323. return this.chainModify(3);
  324. }
  325. },
  326. "galewings": {
  327. inherit: true,
  328. onModifyPriority: function (priority, pokemon, target, move) {
  329. if (move && move.type === 'Flying') return priority + 2;
  330. }
  331. },
  332. "gooey": {
  333. inherit: true,
  334. onAfterDamage: function (damage, target, source, effect) {
  335. if (effect && effect.isContact) this.boost({spe: -2}, source, target);
  336. }
  337. },
  338. "grasspelt": {
  339. inherit: true,
  340. onModifyDef: function (pokemon) {
  341. if (this.isTerrain('grassyterrain')) return this.chainModify(2);
  342. }
  343. },
  344. "guts": {
  345. inherit: true,
  346. onModifyAtk: function (atk, pokemon) {
  347. if (pokemon.status) {
  348. return this.chainModify(2);
  349. }
  350. }
  351. },
  352. "harvest": {
  353. inherit: true,
  354. onResidual: function (pokemon) {
  355. if (pokemon.hp && !pokemon.item && this.getItem(pokemon.lastItem).isBerry) {
  356. pokemon.setItem(pokemon.lastItem);
  357. this.add('-item', pokemon, pokemon.getItem(), '[from] ability: Harvest');
  358. }
  359. }
  360. },
  361. "healer": {
  362. inherit: true,
  363. onResidual: function (pokemon) {
  364. var allyActive = pokemon.side.active;
  365. if (allyActive.length === 1) {
  366. return;
  367. }
  368. for (var i = 0; i < allyActive.length; i++) {
  369. if (allyActive[i] && this.isAdjacent(pokemon, allyActive[i]) && allyActive[i].status && this.random(10) < 6) {
  370. allyActive[i].cureStatus();
  371. }
  372. }
  373. }
  374. },
  375. "heatproof": {
  376. inherit: true,
  377. onSourceBasePower: function (basePower, attacker, defender, move) {
  378. if (move.type === 'Fire') {
  379. return this.chainModify(1/3);
  380. }
  381. },
  382. onDamage: function (damage, target, source, effect) {
  383. if (effect && effect.id === 'brn') {
  384. return damage / 3;
  385. }
  386. },
  387. },
  388. "heavymetal": {
  389. inherit: true,
  390. onModifyPokemon: function (pokemon) {
  391. pokemon.weightkg *= 3;
  392. }
  393. },
  394. "hugepower": {
  395. inherit: true,
  396. onModifyAtk: function (atk) {
  397. return this.chainModify(3);
  398. }
  399. },
  400. "hustle": {
  401. inherit: true,
  402. onModifyAtk: function (atk) {
  403. return this.modify(atk, 2);
  404. },
  405. onModifyMove: function (move) {
  406. if (move.category === 'Physical' && typeof move.accuracy === 'number') {
  407. move.accuracy *= 0.6;
  408. }
  409. }
  410. },
  411. "icebody": {
  412. inherit: true,
  413. onWeather: function (target, source, effect) {
  414. if (effect.id === 'hail') {
  415. this.heal(target.maxhp / 8);
  416. }
  417. }
  418. },
  419. "intimidate": {
  420. inherit: true,
  421. onStart: function (pokemon) {
  422. var foeactive = pokemon.side.foe.active;
  423. for (var i = 0; i < foeactive.length; i++) {
  424. if (!foeactive[i] || !this.isAdjacent(foeactive[i], pokemon)) continue;
  425. if (foeactive[i].volatiles['substitute']) {
  426. // does it give a message?
  427. this.add('-activate', foeactive[i], 'Substitute', 'ability: Intimidate', '[of] ' + pokemon);
  428. } else {
  429. this.add('-ability', pokemon, 'Intimidate', '[of] ' + foeactive[i]);
  430. this.boost({atk: -2}, foeactive[i], pokemon);
  431. }
  432. }
  433. }
  434. },
  435. "ironbarbs": {
  436. inherit: true,
  437. onAfterDamage: function (damage, target, source, move) {
  438. if (source && source !== target && move && move.isContact) {
  439. this.damage(source.maxhp / 4, source, target, null, true);
  440. }
  441. }
  442. },
  443. "ironfist": {
  444. inherit: true,
  445. onBasePower: function (basePower, attacker, defender, move) {
  446. if (move.isPunchAttack) {
  447. this.debug('Iron Fist boost');
  448. return this.chainModify(1.4);
  449. }
  450. }
  451. },
  452. "justified": {
  453. inherit: true,
  454. onAfterDamage: function (damage, target, source, effect) {
  455. if (effect && effect.type === 'Dark') {
  456. this.boost({atk:2});
  457. }
  458. }
  459. },
  460. "lightmetal": {
  461. inherit: true,
  462. onModifyPokemon: function (pokemon) {
  463. pokemon.weightkg /= 3;
  464. }
  465. },
  466. "lightningrod": {
  467. inherit: true,
  468. onTryHit: function (target, source, move) {
  469. if (target !== source && move.type === 'Electric') {
  470. if (!this.boost({spa:2})) {
  471. this.add('-immune', target, '[msg]');
  472. }
  473. return null;
  474. }
  475. }
  476. },
  477. "liquidooze": {
  478. inherit: true,
  479. onSourceTryHeal: function (damage, target, source, effect) {
  480. this.debug("Heal is occurring: " + target + " <- " + source + " :: " + effect.id);
  481. var canOoze = {drain: 1, leechseed: 1};
  482. if (canOoze[effect.id]) {
  483. this.damage(damage * 2, null, null, null, true);
  484. return 0;
  485. }
  486. }
  487. },
  488. "marvelscale": {
  489. inherit: true,
  490. onModifyDef: function (def, pokemon) {
  491. if (pokemon.status) {
  492. return this.chainModify(2);
  493. }
  494. }
  495. },
  496. "megalauncher": {
  497. inherit: true,
  498. onBasePower: function (basePower, attacker, defender, move) {
  499. if (move.flags && move.flags['pulse']) {
  500. return this.chainModify(2);
  501. }
  502. }
  503. },
  504. "minus": {
  505. inherit: true,
  506. onModifySpA: function (spa, pokemon) {
  507. var allyActive = pokemon.side.active;
  508. if (allyActive.length === 1) {
  509. return;
  510. }
  511. for (var i = 0; i < allyActive.length; i++) {
  512. if (allyActive[i] && allyActive[i].position !== pokemon.position && !allyActive[i].fainted && allyActive[i].hasAbility(['minus', 'plus'])) {
  513. return this.chainModify(2);
  514. }
  515. }
  516. }
  517. },
  518. "moody": {
  519. inherit: true,
  520. onResidual: function (pokemon) {
  521. var stats = [], i = '';
  522. var boost = {};
  523. for (var i in pokemon.boosts) {
  524. if (pokemon.boosts[i] < 6) {
  525. stats.push(i);
  526. }
  527. }
  528. if (stats.length) {
  529. i = stats[this.random(stats.length)];
  530. boost[i] = 4;
  531. }
  532. stats = [];
  533. for (var j in pokemon.boosts) {
  534. if (pokemon.boosts[j] > -6 && j !== i) {
  535. stats.push(j);
  536. }
  537. }
  538. if (stats.length) {
  539. i = stats[this.random(stats.length)];
  540. boost[i] = -2;
  541. }
  542. this.boost(boost);
  543. }
  544. },
  545. "motordrive": {
  546. inherit: true,
  547. onTryHit: function (target, source, move) {
  548. if (target !== source && move.type === 'Electric') {
  549. if (!this.boost({spe:2})) {
  550. this.add('-immune', target, '[msg]');
  551. }
  552. return null;
  553. }
  554. }
  555. },
  556. "moxie": {
  557. inherit: true,
  558. onSourceFaint: function (target, source, effect) {
  559. if (effect && effect.effectType === 'Move') {
  560. this.boost({atk:2}, source);
  561. }
  562. }
  563. },
  564. "multiscale": {
  565. inherit: true,
  566. onSourceModifyDamage: function (damage, source, target, move) {
  567. if (target.hp >= target.maxhp) {
  568. this.debug('Multiscale weaken');
  569. return this.chainModify(1/3);
  570. }
  571. }
  572. },
  573. "overgrow": {
  574. inherit: true,
  575. onModifyAtk: function (atk, attacker, defender, move) {
  576. if (move.type === 'Grass' && attacker.hp <= attacker.maxhp / 3) {
  577. this.debug('Overgrow boost');
  578. return this.chainModify(2);
  579. }
  580. },
  581. onModifySpA: function (atk, attacker, defender, move) {
  582. if (move.type === 'Grass' && attacker.hp <= attacker.maxhp / 3) {
  583. this.debug('Overgrow boost');
  584. return this.chainModify(2);
  585. }
  586. }
  587. },
  588. "parentalbond": {
  589. inherit: true,
  590. onModifyMove: function (move, pokemon, target) {
  591. if (move.category !== 'Status' && !move.selfdestruct && !move.multihit && ((target.side && target.side.active.length < 2) || move.target in {any:1, normal:1, randomNormal:1})) {
  592. move.multihit = 3;
  593. pokemon.addVolatile('parentalbond');
  594. }
  595. },
  596. effect: {
  597. duration: 1,
  598. onBasePowerPriority: 8,
  599. onBasePower: function (basePower) {
  600. if (this.effectData.hit > 0) {
  601. return this.chainModify(Math.pow(.5, this.effectData.hit));
  602. } else {
  603. this.effectData.hit++;
  604. }
  605. }
  606. }
  607. },
  608. "pixilate": {
  609. inherit: true,
  610. effect: {
  611. duration: 1,
  612. onBasePowerPriority: 8,
  613. onBasePower: function (basePower, pokemon, target, move) {
  614. return this.chainModify([0x199A, 0x1000]);
  615. }
  616. }
  617. },
  618. "plus": {
  619. inherit: true,
  620. onModifySpA: function (spa, pokemon) {
  621. var allyActive = pokemon.side.active;
  622. if (allyActive.length === 1) {
  623. return;
  624. }
  625. for (var i = 0; i < allyActive.length; i++) {
  626. if (allyActive[i] && allyActive[i].position !== pokemon.position && !allyActive[i].fainted && allyActive[i].hasAbility(['minus', 'plus'])) {
  627. return this.chainModify(2);
  628. }
  629. }
  630. }
  631. },
  632. "poisonheal": {
  633. inherit: true,
  634. onDamage: function (damage, target, source, effect) {
  635. if (effect.id === 'psn' || effect.id === 'tox') {
  636. this.heal(target.maxhp / 4);
  637. return false;
  638. }
  639. }
  640. },
  641. "poisonpoint": {
  642. inherit: true,
  643. onAfterDamage: function (damage, target, source, move) {
  644. if (move && move.isContact) {
  645. if (this.random(10) < 6) {
  646. source.trySetStatus('psn', target, move);
  647. }
  648. }
  649. }
  650. },
  651. "poisontouch": {
  652. inherit: true,
  653. onModifyMove: function (move) {
  654. if (!move || !move.isContact) return;
  655. if (!move.secondaries) {
  656. move.secondaries = [];
  657. }
  658. move.secondaries.push({
  659. chance: 60,
  660. status: 'psn'
  661. });
  662. }
  663. },
  664. "prankster": {
  665. inherit: true,
  666. onModifyPriority: function (priority, pokemon, target, move) {
  667. if (move && move.category === 'Status') {
  668. return priority + 2;
  669. }
  670. }
  671. },
  672. "pressure": {
  673. inherit: true,
  674. onSourceDeductPP: function (pp, target, source) {
  675. if (target.side === source.side) return;
  676. return pp + 2;
  677. }
  678. },
  679. "purepower": {
  680. inherit: true,
  681. onModifyAtk: function (atk) {
  682. return this.chainModify(3);
  683. }
  684. },
  685. "quickfeet": {
  686. inherit: true,
  687. onModifySpe: function (speMod, pokemon) {
  688. if (pokemon.status) {
  689. return this.chain(speMod, 2);
  690. }
  691. }
  692. },
  693. "raindish": {
  694. inherit: true,
  695. onWeather: function (target, source, effect) {
  696. if (effect.id === 'raindance' || effect.id === 'primordialsea') {
  697. this.heal(target.maxhp / 8);
  698. }
  699. }
  700. },
  701. "rattled": {
  702. inherit: true,
  703. onAfterDamage: function (damage, target, source, effect) {
  704. if (effect && (effect.type === 'Dark' || effect.type === 'Bug' || effect.type === 'Ghost')) {
  705. this.boost({spe:2});
  706. }
  707. }
  708. },
  709. "reckless": {
  710. inherit: true,
  711. onBasePower: function (basePower, attacker, defender, move) {
  712. if (move.recoil || move.hasCustomRecoil) {
  713. this.debug('Reckless boost');
  714. return this.chainModify(1.4);
  715. }
  716. }
  717. },
  718. "refrigerate": {
  719. inherit: true,
  720. effect: {
  721. duration: 1,
  722. onBasePowerPriority: 8,
  723. onBasePower: function (basePower, pokemon, target, move) {
  724. return this.chainModify([0x199A, 0x1000]);
  725. }
  726. }
  727. },
  728. "regenerator": {
  729. inherit: true,
  730. onSwitchOut: function (pokemon) {
  731. pokemon.heal(2 * pokemon.maxhp / 3);
  732. }
  733. },
  734. "rivalry": {
  735. inherit: true,
  736. onBasePower: function (basePower, attacker, defender, move) {
  737. if (attacker.gender && defender.gender) {
  738. if (attacker.gender === defender.gender) {
  739. this.debug('Rivalry boost');
  740. return this.chainModify(1.5);
  741. } else {
  742. this.debug('Rivalry weaken');
  743. return this.chainModify(0.5);
  744. }
  745. }
  746. }
  747. },
  748. "roughskin": {
  749. inherit: true,
  750. onAfterDamage: function (damage, target, source, move) {
  751. if (source && source !== target && move && move.isContact) {
  752. this.damage(source.maxhp / 4, source, target, null, true);
  753. }
  754. }
  755. },
  756. "sandforce": {
  757. inherit: true,
  758. onBasePower: function (basePower, attacker, defender, move) {
  759. if (this.isWeather('sandstorm')) {
  760. if (move.type === 'Rock' || move.type === 'Ground' || move.type === 'Steel') {
  761. this.debug('Sand Force boost');
  762. return this.chainModify([0x199A, 0x1000]); // The Sand Force modifier is slightly higher than the normal 1.3 (0x14CC)
  763. }
  764. }
  765. }
  766. },
  767. "sandrush": {
  768. inherit: true,
  769. onModifySpe: function (speMod, pokemon) {
  770. if (this.isWeather('sandstorm')) {
  771. return this.chain(speMod, 3);
  772. }
  773. }
  774. },
  775. "sandveil": {
  776. inherit: true,
  777. onAccuracy: function (accuracy) {
  778. if (typeof accuracy !== 'number') return;
  779. if (this.isWeather('sandstorm')) {
  780. this.debug('Sand Veil - decreasing accuracy');
  781. return 2 * accuracy / 3; //Technically, this is a 50% increase in evasion.
  782. }
  783. }
  784. },
  785. "sapsipper": {
  786. inherit: true,
  787. onTryHit: function (target, source, move) {
  788. if (target !== source && move.type === 'Grass') {
  789. if (!this.boost({atk:2})) {
  790. this.add('-immune', target, '[msg]');
  791. }
  792. return null;
  793. }
  794. },
  795. onAllyTryHitSide: function (target, source, move) {
  796. if (target.side !== source.side) return;
  797.  
  798. if (move.type === 'Grass') {
  799. this.boost({atk:2}, this.effectData.target);
  800. }
  801. }
  802. },
  803. "serenegrace": {
  804. inherit: true,
  805. onModifyMove: function (move) {
  806. if (move.secondaries && move.id !== 'secretpower') {
  807. this.debug('doubling secondary chance');
  808. for (var i = 0; i < move.secondaries.length; i++) {
  809. move.secondaries[i].chance *= 3;
  810. }
  811. }
  812. }
  813. },
  814. "shedskin": {
  815. inherit: true,
  816. onResidual: function (pokemon) {
  817. if (pokemon.hp && pokemon.status && this.random(3) < 2) {
  818. this.debug('shed skin');
  819. this.add('-activate', pokemon, 'ability: Shed Skin');
  820. pokemon.cureStatus();
  821. }
  822. }
  823. },
  824. "sheerforce": {
  825. inherit: true,
  826. effect: {
  827. duration: 1,
  828. onBasePowerPriority: 8,
  829. onBasePower: function (basePower, pokemon, target, move) {
  830. return this.chainModify([0x199A, 0x1000]); // The Sheer Force modifier is slightly higher than the normal 1.3 (0x14CC)
  831. }
  832. }
  833. },
  834. "simple": {
  835. inherit: true,
  836. onBoost: function (boost) {
  837. for (var i in boost) {
  838. boost[i] *= 3;
  839. }
  840. }
  841. },
  842. "slowstart": {
  843. inherit: true,
  844. effect: {
  845. duration: 5, //Why is this still 5? If we were to make this 10, we'd have a quadrupling effect, not a doubling effect.
  846. onStart: function (target) {
  847. this.add('-start', target, 'Slow Start');
  848. },
  849. onModifyAtkPriority: 5,
  850. onModifyAtk: function (atk, pokemon) {
  851. if (pokemon.ignore['Ability'] === true || pokemon.ability !== 'slowstart') {
  852. pokemon.removeVolatile('slowstart');
  853. return;
  854. }
  855. return this.chainModify(0.25);
  856. },
  857. onModifySpe: function (speMod, pokemon) {
  858. if (pokemon.ignore['Ability'] === true || pokemon.ability !== 'slowstart') {
  859. pokemon.removeVolatile('slowstart');
  860. return;
  861. }
  862. return this.chain(speMod, 0.25);
  863. },
  864. onEnd: function (target) {
  865. this.add('-end', target, 'Slow Start');
  866. }
  867. }
  868. },
  869. "sniper": {
  870. inherit: true,
  871. onModifyDamage: function (damage, source, target, move) {
  872. if (move.crit) {
  873. this.debug('Sniper boost');
  874. return this.chainModify(2);
  875. }
  876. }
  877. },
  878. "snowcloak": {
  879. inherit: true,
  880. onAccuracy: function (accuracy) {
  881. if (typeof accuracy !== 'number') return;
  882. if (this.isWeather('hail')) {
  883. this.debug('Snow Cloak - decreasing accuracy');
  884. return 2 * accuracy / 3; //Technically, this is a 50% increase in evasion.
  885. }
  886. }
  887. },
  888. "solarpower": {
  889. inherit: true,
  890. onModifySpA: function (spa, pokemon) {
  891. if (this.isWeather(['sunnyday', 'desolateland'])) {
  892. return this.chainModify(2);
  893. }
  894. },
  895. onWeather: function (target, source, effect) {
  896. if (effect.id === 'sunnyday' || effect.id === 'desolateland') {
  897. this.damage(target.maxhp / 4);
  898. }
  899. }
  900. },
  901. "solidrock": {
  902. inherit: true,
  903. onSourceModifyDamage: function (damage, source, target, move) {
  904. if (target.runEffectiveness(move) > 0) {
  905. this.debug('Solid Rock neutralize');
  906. return this.chainModify(0.5);
  907. }
  908. }
  909. },
  910. "speedboost": {
  911. inherit: true,
  912. onResidual: function (pokemon) {
  913. if (pokemon.activeTurns) {
  914. this.boost({spe:2}); //gotta go fast
  915. }
  916. }
  917. },
  918. "stall": {
  919. inherit: true,
  920. onModifyPriority: function (priority) {
  921. return priority - 0.2; //Not that this makes a difference :^)
  922. }
  923. },
  924. "static": {
  925. inherit: true,
  926. onAfterDamage: function (damage, target, source, effect) {
  927. if (effect && effect.isContact) {
  928. if (this.random(10) < 6) {
  929. source.trySetStatus('par', target, effect);
  930. }
  931. }
  932. }
  933. },
  934. "steadfast": {
  935. inherit: true,
  936. onFlinch: function (pokemon) {
  937. this.boost({spe: 2});
  938. }
  939. },
  940. "stench": {
  941. inherit: true,
  942. onModifyMove: function (move) {
  943. if (move.category !== "Status") {
  944. this.debug('Adding Stench flinch');
  945. if (!move.secondaries) move.secondaries = [];
  946. for (var i = 0; i < move.secondaries.length; i++) {
  947. if (move.secondaries[i].volatileStatus === 'flinch') return;
  948. }
  949. move.secondaries.push({
  950. chance: 20,
  951. volatileStatus: 'flinch'
  952. });
  953. }
  954. }
  955. },
  956. "stormdrain": {
  957. inherit: true,
  958. onTryHit: function (target, source, move) {
  959. if (target !== source && move.type === 'Water') {
  960. if (!this.boost({spa:2})) {
  961. this.add('-immune', target, '[msg]');
  962. }
  963. return null;
  964. }
  965. }
  966. },
  967. "strongjaw": {
  968. inherit: true,
  969. onBasePower: function (basePower, attacker, defender, move) {
  970. if (move.flags && move.flags['bite']) {
  971. return this.chainModify(2);
  972. }
  973. }
  974. },
  975. "sturdy": {
  976. inherit: true,
  977. onDamage: function (damage, target, source, effect) {
  978. if (effect && effect.ohko) {
  979. this.add('-activate', target, 'Sturdy');
  980. return 0;
  981. }
  982. if (target.hp === target.maxhp && damage >= target.hp && effect && effect.effectType === 'Move') {
  983. this.add('-activate', target, 'Sturdy');
  984. if (target.hp === 1) return 0; //Just in case
  985. return target.hp - 2; //Does this even matter
  986. }
  987. }
  988. },
  989. "superluck": {
  990. inherit: true,
  991. onModifyMove: function (move) {
  992. (move.critRatio++)++;
  993. }
  994. },
  995. "swarm": {
  996. inherit: true,
  997. onModifyAtk: function (atk, attacker, defender, move) {
  998. if (move.type === 'Bug' && attacker.hp <= attacker.maxhp / 3) {
  999. this.debug('Swarm boost');
  1000. return this.chainModify(2);
  1001. }
  1002. },
  1003. onModifySpA: function (atk, attacker, defender, move) {
  1004. if (move.type === 'Bug' && attacker.hp <= attacker.maxhp / 3) {
  1005. this.debug('Swarm boost');
  1006. return this.chainModify(2);
  1007. }
  1008. }
  1009. },
  1010. "swiftswim": {
  1011. inherit: true,
  1012. onModifySpe: function (speMod, pokemon) {
  1013. if (this.isWeather(['raindance', 'primordialsea'])) {
  1014. return this.chain(speMod, 3);
  1015. }
  1016. }
  1017. },
  1018. "tangledfeet": {
  1019. inherit: true,
  1020. onAccuracy: function (accuracy, target) {
  1021. if (typeof accuracy !== 'number') return;
  1022. if (target && target.volatiles['confusion']) {
  1023. this.debug('Tangled Feet - decreasing accuracy');
  1024. return accuracy / 3;
  1025. }
  1026. }
  1027. },
  1028. "technician": {
  1029. inherit: true,
  1030. onBasePower: function (basePower, attacker, defender, move) {
  1031. if (basePower <= 60) {
  1032. this.debug('Technician boost');
  1033. return this.chainModify(2);
  1034. }
  1035. }
  1036. },
  1037. "thickfat": {
  1038. inherit: true,
  1039. onSourceModifyAtk: function (atk, attacker, defender, move) {
  1040. if (move.type === 'Ice' || move.type === 'Fire') {
  1041. this.debug('Thick Fat weaken');
  1042. return this.chainModify(1/3);
  1043. }
  1044. },
  1045. onSourceModifySpA: function (atk, attacker, defender, move) {
  1046. if (move.type === 'Ice' || move.type === 'Fire') {
  1047. this.debug('Thick Fat weaken');
  1048. return this.chainModify(1/3);
  1049. }
  1050. }
  1051. },
  1052. "tintedlens": {
  1053. inherit: true,
  1054. onModifyDamage: function (damage, source, target, move) {
  1055. if (target.runEffectiveness(move) < 0) {
  1056. this.debug('Tinted Lens boost');
  1057. return this.chainModify(3);
  1058. }
  1059. }
  1060. },
  1061. "torrent": {
  1062. inherit: true,
  1063. onModifyAtk: function (atk, attacker, defender, move) {
  1064. if (move.type === 'Water' && attacker.hp <= attacker.maxhp / 3) {
  1065. this.debug('Torrent boost');
  1066. return this.chainModify(2);
  1067. }
  1068. },
  1069. onModifySpA: function (atk, attacker, defender, move) {
  1070. if (move.type === 'Water' && attacker.hp <= attacker.maxhp / 3) {
  1071. this.debug('Torrent boost');
  1072. return this.chainModify(2);
  1073. }
  1074. }
  1075. },
  1076. "toxicboost": {
  1077. inherit: true,
  1078. onBasePower: function (basePower, attacker, defender, move) {
  1079. if ((attacker.status === 'psn' || attacker.status === 'tox') && move.category === 'Physical') {
  1080. return this.chainModify(2);
  1081. }
  1082. }
  1083. },
  1084. "toughclaws": {
  1085. inherit: true,
  1086. onBasePower: function (basePower, attacker, defender, move) {
  1087. if (move.isContact) {
  1088. return this.chainModify(1.66);
  1089. }
  1090. }
  1091. },
  1092. "truant": {
  1093. inherit: true,
  1094. effect: {
  1095. duration: 3
  1096. }
  1097. },
  1098. "unburden": {
  1099. inherit: true,
  1100. effect: {
  1101. onModifySpe: function (speMod, pokemon) {
  1102. if (pokemon.ignore['Ability'] === true || pokemon.ability !== 'unburden') {
  1103. pokemon.removeVolatile('unburden');
  1104. return;
  1105. }
  1106. if (!pokemon.item) {
  1107. return this.chain(speMod, 3);
  1108. }
  1109. }
  1110. }
  1111. },
  1112. "victorystar": {
  1113. inherit: true,
  1114. onAllyModifyMove: function (move) {
  1115. if (typeof move.accuracy === 'number') {
  1116. move.accuracy *= 1.2;
  1117. }
  1118. }
  1119. },
  1120. "voltabsorb": {
  1121. inherit: true,
  1122. onTryHit: function (target, source, move) {
  1123. if (target !== source && move.type === 'Electric') {
  1124. if (!this.heal(target.maxhp / 2)) {
  1125. this.add('-immune', target, '[msg]');
  1126. }
  1127. return null;
  1128. }
  1129. }
  1130. },
  1131. "waterabsorb": {
  1132. inherit: true,
  1133. onTryHit: function (target, source, move) {
  1134. if (target !== source && move.type === 'Water') {
  1135. if (!this.heal(target.maxhp / 2)) {
  1136. this.add('-immune', target, '[msg]');
  1137. }
  1138. return null;
  1139. }
  1140. }
  1141. },
  1142. "weakarmor": {
  1143. inherit: true,
  1144. onAfterDamage: function (damage, target, source, move) {
  1145. if (move.category === 'Physical') {
  1146. this.boost({spe:2, def:-2});
  1147. }
  1148. }
  1149. },
  1150. "wonderskin": {
  1151. inherit: true,
  1152. onAccuracy: function (accuracy, target, source, move) {
  1153. if (move.category === 'Status' && typeof move.accuracy === 'number') {
  1154. this.debug('Wonder Skin - setting accuracy to 100/3');
  1155. return 100/3;
  1156. }
  1157. }
  1158. }
  1159. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement