Advertisement
Pikachuun

mods/acidrain

Sep 29th, 2014
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.71 KB | None | 0 0
  1. -------abilities.js---------
  2. exports.BattleAbilities = {
  3. "chlorophyll": {
  4. inherit: true,
  5. onModifySpe: function (speMod) {
  6. if (this.isWeather('sunnyday') || this.isWeather('raindance')) {
  7. return this.chain(speMod, 2);
  8. }
  9. }
  10. },
  11. "drought": {
  12. inherit: true,
  13. onStart: function (source) {
  14. this.setWeather('raindance');
  15. }
  16. },
  17. "flowergift": {
  18. inherit: true,
  19. onUpdate: function (pokemon) {
  20. if (!pokemon.isActive || pokemon.speciesid !== 'cherrim') return;
  21. if (this.isWeather('sunnyday') || this.isWeather('raindance')) {
  22. if (this.effectData.forme !== 'Sunshine') {
  23. this.effectData.forme = 'Sunshine';
  24. this.add('-formechange', pokemon, 'Cherrim-Sunshine');
  25. this.add('-message', pokemon.name + ' transformed! (placeholder)');
  26. }
  27. } else {
  28. if (this.effectData.forme) {
  29. delete this.effectData.forme;
  30. this.add('-formechange', pokemon, 'Cherrim');
  31. this.add('-message', pokemon.name + ' transformed! (placeholder)');
  32. }
  33. }
  34. },
  35. onAllyModifyAtk: function (atk) {
  36. if (this.effectData.target.template.speciesid !== 'cherrim') return;
  37. if (this.isWeather('sunnyday') || this.isWeather('raindance')) {
  38. return this.chainModify(1.5);
  39. }
  40. },
  41. onAllyModifySpD: function (spd) {
  42. if (this.effectData.target.template.speciesid !== 'cherrim') return;
  43. if (this.isWeather('sunnyday') || this.isWeather('raindance')) {
  44. return this.chainModify(1.5);
  45. }
  46. }
  47. },
  48. "harvest": {
  49. inherit: true,
  50. onResidual: function (pokemon) {
  51. if (this.isWeather('sunnyday') || this.isWeather('raindance') || this.random(2) === 0) {
  52. if (pokemon.hp && !pokemon.item && this.getItem(pokemon.lastItem).isBerry) {
  53. pokemon.setItem(pokemon.lastItem);
  54. this.add('-item', pokemon, pokemon.getItem(), '[from] ability: Harvest');
  55. }
  56. }
  57. }
  58. },
  59. "icebody": {
  60. inherit: true,
  61. onWeather: function (target, source, effect) {
  62. if (effect.id === 'hail' || effect.id === 'raindance') {
  63. this.heal(target.maxhp / 16);
  64. }
  65. }
  66. },
  67. "leafguard": {
  68. inherit: true,
  69. onSetStatus: function (pokemon) {
  70. if (this.isWeather('sunnyday') || this.isWeather('raindance')) {
  71. return false;
  72. }
  73. },
  74. onTryHit: function (target, source, move) {
  75. if (move && move.id === 'yawn' && (this.isWeather('sunnyday') || this.isWeather('raindance'))) {
  76. return false;
  77. }
  78. }
  79. },
  80. "sandforce": {
  81. inherit: true,
  82. onBasePower: function (basePower, attacker, defender, move) {
  83. if (this.isWeather('sandstorm') || this.isWeather('raindance')) {
  84. if (move.type === 'Rock' || move.type === 'Ground' || move.type === 'Steel') {
  85. this.debug('Sand Force boost');
  86. return this.chainModify([0x14CD, 0x1000]); // The Sand Force modifier is slightly higher than the normal 1.3 (0x14CC)
  87. }
  88. }
  89. },
  90. },
  91. "sandrush": {
  92. inherit: true,
  93. onModifySpe: function (speMod, pokemon) {
  94. if (this.isWeather('sandstorm') || this.isWeather('raindance')) {
  95. return this.chain(speMod, 2);
  96. }
  97. },
  98. },
  99. "sandstream": {
  100. inherit: true,
  101. onStart: function (source) {
  102. this.setWeather('raindance');
  103. }
  104. },
  105. "sandveil": {
  106. inherit: true,
  107. onAccuracy: function (accuracy) {
  108. if (typeof accuracy !== 'number') return;
  109. if (this.isWeather('sandstorm') || this.isWeather('raindance')) {
  110. this.debug('Sand Veil - decreasing accuracy');
  111. return accuracy * 0.8;
  112. }
  113. },
  114. },
  115. "snowcloak": {
  116. inherit: true,
  117. onAccuracy: function (accuracy) {
  118. if (typeof accuracy !== 'number') return;
  119. if (this.isWeather('hail') || this.isWeather('raindance')) {
  120. this.debug('Snow Cloak - decreasing accuracy');
  121. return accuracy * 0.8;
  122. }
  123. }
  124. },
  125. "snowwarning": {
  126. inherit: true,
  127. onStart: function (source) {
  128. this.setWeather('raindance');
  129. }
  130. },
  131. "solarpower": {
  132. inherit: true,
  133. onModifySpA: function (spa, pokemon) {
  134. if (this.isWeather('sunnyday') || this.isWeather('raindance')) {
  135. return this.chainModify(1.5);
  136. }
  137. },
  138. onWeather: function (target, source, effect) {
  139. if (effect.id === 'sunnyday' || effect.id === 'raindance') {
  140. this.damage(target.maxhp / 8);
  141. }
  142. }
  143. }
  144. };
  145. -------statuses.js---------
  146. exports.BattleStatuses = {
  147. raindance: {
  148. effectType: 'Weather',
  149. duration: 5,
  150. onBasePower: function (basePower, attacker, defender, move) {
  151. if (move.type === 'Water') {
  152. this.debug('acid rain water supress');
  153. return this.chainModify(0.75);
  154. }
  155. if (move.type === 'Fire') {
  156. this.debug('acid rain fire suppress');
  157. return this.chainModify(0.75);
  158. }
  159. },
  160. onModifySpDPriority: 10,
  161. onModifySpD: function (spd, pokemon) {
  162. if (pokemon.hasType('Rock') && this.isWeather('RainDance')) {
  163. return this.modify(spd, 1.5);
  164. }
  165. },
  166. onImmunity: function (type) {
  167. if (type === 'frz') return false;
  168. },
  169. onStart: function (battle, source, effect) {
  170. if (effect && effect.effectType === 'Ability' && this.gen <= 5) {
  171. this.effectData.duration = 0;
  172. this.add('-weather', 'RainDance', '[from] ability: ' + effect, '[of] ' + source);
  173. } else {
  174. this.add('-weather', 'RainDance');
  175. }
  176. },
  177. onResidualOrder: 1,
  178. onResidual: function () {
  179. this.add('-weather', 'RainDance', '[upkeep]');
  180. this.eachEvent('Weather');
  181. },
  182. onWeather: function (target) {
  183. if (target.runImmunity('sandstorm') && target.runImmunity('hail')) {
  184. this.damage(target.maxhp / 8);
  185. } else if ((!target.runImmunity('sandstorm') && target.runImmunity('hail')) || (target.runImmunity('sandstorm') && !target.runImmunity('hail'))) {
  186. this.damage(target.maxhp / 16);
  187. }
  188.  
  189. },
  190. onEnd: function () {
  191. this.add('-weather', 'none');
  192. }
  193. }
  194. };
  195. -------moves.js---------
  196. exports.BattleMovedex = {
  197. "blizzard": {
  198. inherit: true,
  199. onModifyMove: function (move) {
  200. if (this.isWeather('hail') || this.isWeather('raindance')) move.accuracy = true;
  201. }
  202. },
  203. "growth": {
  204. inherit: true,
  205. onModifyMove: function (move) {
  206. if (this.isWeather('sunnyday') || this.isWeather('raindance')) move.boosts = {atk: 2, spa: 2};
  207. }
  208. },
  209. "hail": {
  210. inherit: true,
  211. weather: 'raindance'
  212. },
  213. "moonlight": {
  214. inherit: true,
  215. onHit: function (pokemon) {
  216. if (this.isWeather('sunnyday')) this.heal(this.modify(pokemon.maxhp, 0.667));
  217. else if (this.isWeather(['sandstorm', 'hail'])) this.heal(this.modify(pokemon.maxhp, 0.25));
  218. else if (this.isWeather('raindance')) this.heal(this.modify(pokemon.maxhp, 0.0833));
  219. else this.heal(this.modify(pokemon.maxhp, 0.5));
  220. }
  221. },
  222. "morningsun": {
  223. inherit: true,
  224. onHit: function (pokemon) {
  225. if (this.isWeather('sunnyday')) this.heal(this.modify(pokemon.maxhp, 0.667));
  226. else if (this.isWeather(['sandstorm', 'hail'])) this.heal(this.modify(pokemon.maxhp, 0.25));
  227. else if (this.isWeather('raindance')) this.heal(this.modify(pokemon.maxhp, 0.0833));
  228. else this.heal(this.modify(pokemon.maxhp, 0.5));
  229. }
  230. },
  231. "sandstorm": {
  232. inherit: true,
  233. weather: 'raindance'
  234. },
  235. "solarbeam": {
  236. inherit: true,
  237. onTry: function (attacker, defender, move) {
  238. if (attacker.removeVolatile(move.id)) {
  239. return;
  240. }
  241. this.add('-prepare', attacker, move.name, defender);
  242. if (this.isWeather('sunnyday') || this.isWeather('raindance') || !this.runEvent('ChargeMove', attacker, defender, move)) {
  243. this.add('-anim', attacker, move.name, defender);
  244. return;
  245. }
  246. attacker.addVolatile('twoturnmove', defender);
  247. return null;
  248. },
  249. onBasePower: function (basePower, pokemon, target) {
  250. if (this.isWeather(['sandstorm', 'hail'])) {
  251. this.debug('weakened by weather');
  252. return this.chainModify(0.5);
  253. } else if (this.isWeather('raindance')) {
  254. this.debug('super-weakened by weather');
  255. return this.chainModify(0.125);
  256. }
  257. }
  258. },
  259. "sunnyday": {
  260. inherit: true,
  261. weather: 'raindance'
  262. },
  263. "synthesis": {
  264. inherit: true,
  265. onHit: function (pokemon) {
  266. if (this.isWeather('sunnyday')) this.heal(this.modify(pokemon.maxhp, 0.667));
  267. else if (this.isWeather(['sandstorm', 'hail'])) this.heal(this.modify(pokemon.maxhp, 0.25));
  268. else if (this.isWeather('raindance')) this.heal(this.modify(pokemon.maxhp, 0.0833));
  269. else this.heal(this.modify(pokemon.maxhp, 0.5));
  270. }
  271. },
  272. "weatherball": {
  273. inherit: true,
  274. basePowerCallback: function () {
  275. if (this.isWeather('raindance')) return 800; //We have 4 weathers active at once.
  276. else if (this.weather) return 100;
  277. return 50;
  278. },
  279. onModifyMove: function (move) {
  280. switch (this.effectiveWeather()) {
  281. case 'sunnyday':
  282. move.type = 'Fire';
  283. break;
  284. case 'raindance':
  285. move.type = 'Ice'; //Hail is the highest priority weather.
  286. break;
  287. case 'sandstorm':
  288. move.type = 'Rock';
  289. break;
  290. case 'hail':
  291. move.type = 'Ice';
  292. break;
  293. }
  294. }
  295. }
  296. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement