Guest User

M4A High Voltage Ability (IsoCon)

a guest
Sep 15th, 2020
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // THUNDER WAVE (MOVE)
  2. // This part specifically addresses Ground-types' immunity to Thunder Wave. Electric-types are dealt with later.
  3.  
  4. thunderwave: {
  5. num: 86,
  6. accuracy: 90,
  7. basePower: 0,
  8. category: "Status",
  9. desc: "Paralyzes the target. This move does not ignore type immunity.",
  10. shortDesc: "Paralyzes the target.",
  11. name: "Thunder Wave",
  12. pp: 20,
  13. priority: 0,
  14. flags: {protect: 1, reflectable: 1, mirror: 1},
  15. status: 'par',
  16. ignoreImmunity: false,
  17. onTryMove(attacker, defender, move) {
  18. if (attacker.hasAbility('highvoltage')) {
  19. move.ignoreImmunity['Ground'] = true;
  20. }
  21. },
  22. secondary: null,
  23. target: "normal",
  24. type: "Electric",
  25. zMove: {boost: {spd: 1}},
  26. contestType: "Cool",
  27. },
  28.  
  29. // HIGH VOLTAGE (ABILITY)
  30. // The idea I had was to suppress the target's Electric type for the duration of the Pokémon's moves, making it possible for secondary effects to paralyze them. This part doesn't need to account for Ground-types.
  31. // I feel like there are many ways for this to go wrong, so please be on the lookout for bugs if this ends up used. Still, if this one wins, this can be our rough draft, and we can test and work from there!
  32. // Basically, this removes the target's Electric type before using moves, corrects for any type effectiveness problems that would cause, and then adds it back when the move ends.
  33. // There are then a bunch of failsafes in case this somehow doesn't happen - before the affected Pokémon attempts its own move, whenever this Ability is lost and at the end of the turn - so no Pokémon should ever be stuck with the volatile if this doesn't go as planned.
  34. // This is maybe the worst way ever to implement this effect and I am positive any other coder would have done it differently, but... yeah, you guys are stuck with me for now! XP Sorry, haha.
  35.  
  36. highvoltage: {
  37. shortDesc: "This Pokémon can paralyze other Pokémon regardless of their typing.",
  38. onBeforeMovePriority: 0.5,
  39. onPrepareHit(source, target, move) {
  40. if (!move || !target) return;
  41. if (target.hasType('Electric')) {
  42. target.addVolatile('highvoltage');
  43. target.setType(pokemon.getTypes(true).map(type => type === "Electric" ? "???" : type));
  44. }
  45. },
  46. onEffectiveness(typeMod, target, type, move) {
  47. if (target.volatiles['highvoltage']) {
  48. if (move.type === 'Electric' || move.type === 'Flying' || move.type === 'Steel') {
  49. if (type === '???') return -1;
  50. }
  51. if (move.type === 'Ground') {
  52. if (type === '???') return 1;
  53. }
  54. }
  55. },
  56. onSourceHit(target, source, move) {
  57. if (target.volatiles['highvoltage']) {
  58. target.setType(pokemon.getTypes(true).map(type => type === "???" ? "Electric" : type));
  59. target.removeVolatile('highvoltage');
  60. }
  61. },
  62. onPrepareHit(source, target, move) {
  63. if (source.volatiles['highvoltage']) {
  64. source.setType(pokemon.getTypes(true).map(type => type === "???" ? "Electric" : type));
  65. source.removeVolatile('highvoltage');
  66. }
  67. },
  68. onEnd(pokemon) {
  69. for (const target of this.getAllActive()) {
  70. if (target.volatiles['highvoltage']) {
  71. target.setType(pokemon.getTypes(true).map(type => type === "???" ? "Electric" : type));
  72. pokemon.removeVolatile('highvoltage');
  73. }
  74. }
  75. },
  76. onResidualOrder: 26,
  77. onResidualSubOrder: 1,
  78. onResidual(pokemon) {
  79. for (const target of this.getAllActive()) {
  80. if (target.volatiles['highvoltage']) {
  81. target.setType(pokemon.getTypes(true).map(type => type === "???" ? "Electric" : type));
  82. pokemon.removeVolatile('highvoltage');
  83. }
  84. }
  85. },
  86. name: "High Voltage",
  87. rating: 2.5,
  88. num: -1009,
  89. },
RAW Paste Data