Pikachuun

Okay

Apr 7th, 2015
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. move.anim = function (battle, args, effObj) {
  2. var attacker = args[0];
  3. var defender = args[1];
  4.  
  5. for (var i in effObj) {
  6. var potato = effObj[i];
  7. if (potato.type === 'effect') {
  8. var matlab1 = {x: 0, y: 0, z: 0, opaque: 0, scale: 0, time: 0};
  9. for (var j in matlab1) {
  10. var stuff1 = potato.stuff1
  11. if (!stuff1[j] && stuff1[j] !== 0) {
  12. delete matlab1[j];
  13. } else {
  14. if (j.length !== 1) {
  15. matlab1[j] = stuff1[j]
  16. } else {
  17. if (stuff1[j].length === 1) {
  18. matlab1[j] = stuff1[j];
  19. } else {
  20. if (stuff1[j][0] === 'a') {
  21. matlab1[j] = attacker[j] + stuff1[j][1];
  22. } else if (stuff1[j][0] === 'd') {
  23. matlab1[j] = defender[j] + stuff1[j][1];
  24. } else if (stuff1[j][0] === 'ab' && j === 'z') {
  25. matlab1[j] = attacker.behind(stuff1[j][1]);
  26. } else if (stuff1[j][0] === 'db' && j === 'z') {
  27. matlab1[j] = defender.behind(stuff1[j][1]);
  28. } else if (stuff1[j][0] === 'al' && j === 'x') {
  29. matlab1[j] = attacker.leftof(stuff1[j][1]);
  30. } else if (stuff1[j][0] === 'dl' && j === 'x') {
  31. matlab1[j] = defender.leftof(stuff1[j][1]);
  32. } else if (stuff1[j][0] === 'avg') {
  33. matlab1[j] = parseInt((attacker[j]+defender[j])/2) + stuff1[j][1];
  34. }
  35. }
  36. }
  37. }
  38. };
  39. var matlab2 = {x: 0, y: 0, z: 0, opaque: 0, scale: 0, time: 0};
  40. for (var k in matlab2) {
  41. var stuff2 = potato.stuff2
  42. if (!stuff2[j] && stuff2[j] !== 0) {
  43. delete matlab2[j];
  44. } else {
  45. if (j.length !== 1) {
  46. matlab2[j] = stuff2[j]
  47. } else {
  48. if (stuff2[j].length === 1) {
  49. matlab2[j] = stuff2[j];
  50. } else {
  51. if (stuff2[j][0] === 'a') {
  52. matlab2[j] = attacker[j] + stuff2[j][1];
  53. } else if (stuff2[j][0] === 'd') {
  54. matlab2[j] = defender[j] + stuff2[j][1];
  55. } else if (stuff2[j][0] === 'ab' && j === 'z') {
  56. matlab2[j] = attacker.behind(stuff2[j][1]);
  57. } else if (stuff2[j][0] === 'db' && j === 'z') {
  58. matlab2[j] = defender.behind(stuff2[j][1]);
  59. } else if (stuff2[j][0] === 'al' && j === 'x') {
  60. matlab2[j] = attacker.leftof(stuff2[j][1]);
  61. } else if (stuff2[j][0] === 'dl' && j === 'x') {
  62. matlab2[j] = defender.leftof(stuff2[j][1]);
  63. } else if (stuff2[j][0] === 'avg') {
  64. matlab2[j] = parseInt((attacker[j]+defender[j])/2) + stuff2[j][1];
  65. }
  66. }
  67. }
  68. }
  69. };
  70. if (potato.type === 'attacker.sp') potato.type = attacker.sp;
  71. if (potato.transitions.length === 1) {
  72. battle.showEffect(potato.type, matlab, potato.transitions[0]);
  73. } else if (potato.transitions.length > 1) { //caps at 2 things
  74. battle.showEffect(potato.type, matlab, potato.transitions[0], potato.transitions[1]);
  75. } else {
  76. battle.showEffect(potato.type, matlab);
  77. }
  78. } else if (potato.type === 'anim') {
  79. var matlab = {x: 0, y: 0, z: 0, opaque: 0, scale: 0, time: 0};
  80. for (var j in matlab) {
  81. var stuff = potato.stuff
  82. if (!stuff[j] && stuff[j] !== 0) {
  83. delete matlab[j];
  84. } else {
  85. if (j.length !== 1) {
  86. matlab[j] = stuff[j]
  87. } else {
  88. if (stuff[j].length === 1) {
  89. matlab[j] = stuff[j];
  90. } else {
  91. if (stuff[j][0] === 'a') {
  92. matlab[j] = attacker[j] + stuff[j][1];
  93. } else if (stuff[j][0] === 'd') {
  94. matlab[j] = defender[j] + stuff[j][1];
  95. } else if (stuff[j][0] === 'ab' && j === 'z') {
  96. matlab[j] = attacker.behind(stuff[j][1]);
  97. } else if (stuff[j][0] === 'db' && j === 'z') {
  98. matlab[j] = defender.behind(stuff[j][1]);
  99. } else if (stuff[j][0] === 'al' && j === 'x') {
  100. matlab[j] = attacker.leftof(stuff[j][1]);
  101. } else if (stuff[j][0] === 'dl' && j === 'x') {
  102. matlab[j] = defender.leftof(stuff[j][1]);
  103. } else if (stuff[j][0] === 'avg') {
  104. matlab[j] = parseInt((attacker[j]+defender[j])/2) + stuff[j][1];
  105. }
  106. }
  107. }
  108. }
  109. };
  110. if (potato.target === 'a') {
  111. if (potato.transitions.length === 1) {
  112. attacker.anim(matlab, potato.transitions[0]);
  113. } else if (potato.transitions.length > 1) { //caps at 2 things
  114. attacker.anim(matlab, potato.transitions[0], potato.transitions[1]);
  115. } else {
  116. attacker.anim(matlab);
  117. }
  118. } else if (potato.target === 'd') {
  119. if (potato.transitions.length === 1) {
  120. defender.anim(matlab, potato.transitions[0]);
  121. } else if (potato.transitions.length > 1) { //caps at 2 things
  122. defender.anim(matlab, potato.transitions[0], potato.transitions[1]);
  123. } else {
  124. defender.anim(matlab);
  125. }
  126. }
  127. } else if (potato.type === 'delay') {
  128. if (potato.target === 'a') {
  129. attacker.delay(potato.time);
  130. } else if (potato.target === 'd') {
  131. defender.delay(potato.time);
  132. }
  133. } else if (potato.type === 'wait') {
  134. battle.activityWait(potato.time);
  135. }
  136. }
  137. };
Advertisement
Add Comment
Please, Sign In to add comment