TJSJ

PokeAttempt / BattleDummy Object

Nov 14th, 2019 (edited)
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Information about object: BattleDummy
  2. Sprite:
  3. Solid: false
  4. Visible: true
  5. Depth: 0
  6. Persistent: false
  7. Parent:
  8. Children:
  9. Mask:
  10.  
  11. No Physics Object
  12. Create Event:
  13.  
  14. execute code:
  15.  
  16. /// FETCH VALUES FOR POKEMON ON THE FIELD
  17. // Var object holds all the constants
  18.  
  19. // IMPORTANT vvvvvvvvvv
  20.  
  21. // m = mon id;
  22. // c = position in party;
  23.  
  24. // IMPORTANT ^^^^^^^^^^
  25. instance_create(x,y,Var);
  26. xview_offset = 0;
  27. yview_offset = 0;
  28. xoff = xview_offset;
  29. yoff = yview_offset;
  30. Bg = irandom_range(0,15);
  31. background_index = Bg;
  32. global.text_rand = 0;
  33. random_viewx = irandom_range(0,background_width-view_wview);
  34. random_viewy = irandom_range(0,background_height-view_hview);
  35. Max = keyboard_check(ord('M'));
  36. On = 0;
  37. aRandomPower = irandom_range(217,255); //set random power for specific moves
  38. bRandomPower = irandom_range(217,255); //set random power for specific moves
  39. VIS = 0;
  40. debugger = false;
  41. message_text = "";
  42. global.PlayerQueue = 0;
  43. global.Turn = 0;
  44. global.FinishedTurn = true;
  45. global.Player1Moving = false;
  46. global.Player2Moving = false;
  47. global.Player1DoneMoving = true;
  48. global.Player2DoneMoving = true;
  49. global.Player1Damaged = false;
  50. global.Player2Damaged = false;
  51. global.Player1TypeCalculated = false;
  52. global.Player2TypeCalculated = false;
  53. global.aHealth = 90;
  54. global.bHealth = 90;
  55. global.aDamageInflicted = 0;
  56. global.bDamageInflicted = 0;
  57. global.aWaiting = false;
  58. global.bWaiting = false;
  59. global.aFinishQueue = 0;
  60. global.bFinishQueue = 0;
  61. global.aSwitching = false;
  62. global.bSwitching = false;
  63. global.aFainted = false;
  64. global.bFainted = false;
  65. global.aFaintAction = false;
  66. global.bFaintAction = false;
  67. global.aComplexMove = false;
  68. global.bComplexMove = false;
  69. global.aMoveChosen = 0;
  70. global.bMoveChosen = 0;
  71. global.aCHitMod = 1;
  72. global.bCHitMod = 1;
  73. global.HoldOffNextMove = false;
  74. global.aSpecial = false;
  75. global.bSpecial = false;
  76. global.aMonPositioned = false;
  77. global.bMonPositioned = false;
  78. global.Manual = true;
  79. global.Player1Score = 0;
  80. global.Player2Score = 0;
  81. global.aDamageFrame = false;
  82. global.bDamageFrame = false;
  83. global.DamageFrame = 0;
  84. global.UseDamageFrames = false;
  85. global.MoveDelay = 0;
  86. global.MoveDelayAmount = 35; //this is manually adjusted for animations
  87. global.DelayMod = 10;
  88. global.SideBattleText = "([------TURN 0------])"+"##";
  89. global.aSideBattleText = "";
  90. global.bSideBattleText = "";
  91. SelectedMove = 0;
  92. OtherSelectedMove = 0;
  93. aSideName = "";
  94. bSideName = "";
  95. delay = 0;
  96. PreAttackDelay = 1;
  97. PostAttackDelay = 1;
  98. global.DamageFrameDelay = 0;
  99. global.BeginTurn = false;
  100. global.CoinToss = irandom_range(0,1);
  101. global.SpeedTied = false;
  102. global.aSpeedTieWin = false;
  103. global.bSpeedTieWin = false;
  104. global.aMoveTypeEffect = 1;
  105. global.bMoveTypeEffect = 1;
  106. global.TypeCalc = false;
  107. global.aMadPhase = false;
  108. global.bMadPhase = false;
  109. global.DamageActivateDelay = false;
  110. global.PlayHitSfx = false;
  111. global.CalcCrit = false;
  112.  
  113. /// STAT MODIFIERS
  114. global.aStoredAtkMod = 1;
  115. global.aStoredDefMod = 1;
  116. global.aStoredSpAMod = 1;
  117. global.aStoredSpDMod = 1;
  118. global.aStoredSpeMod = 1;
  119. global.aStoredAccMod = 1;
  120. global.aStoredEvaMod = 1;
  121. global.bStoredAtkMod = 1;
  122. global.bStoredDefMod = 1;
  123. global.bStoredSpAMod = 1;
  124. global.bStoredSpDMod = 1;
  125. global.bStoredSpeMod = 1;
  126. global.bStoredAccMod = 1;
  127. global.bStoredEvaMod = 1;
  128.  
  129. /// PERIPHERAL BATTLE EFFECTS (Weather, Terrain, Screens, Trick Room)
  130.  
  131. // Weather
  132. global.Weather = "Normal"; // Normal, Rain, Sandstorm, Snow, Sunny
  133. global.WeatherTurns = 0;
  134. global.Terrain = "Normal"; // Ice, Fire, Wind, Electric, Mist, Grass, Weird
  135. global.TerrainTurns = 0;
  136.  
  137. // Screens
  138. global.aLightScreen = 0;
  139. global.aReflectScreen = 0;
  140. global.bLightScreen = 0;
  141. global.bReflectScreen = 0;
  142.  
  143. // Trick Room
  144. global.TrickRoom = 0;
  145.  
  146. //
  147. mm = 0;
  148.  
  149. /* PLAYER 1 MON ------------------------- */
  150.  
  151. with(instance_create(x,view_yview+view_hview*0.6,Mon)) { /* PLAYER 1 MON ------------------------- */
  152.  
  153. o = 0; // set mon to be player 1
  154.  
  155. if global.monrandom = true {
  156.  
  157.     m = irandom_range(0,global.MonAmount-1); // for now we randomly select a mon
  158.    
  159.     }
  160.    
  161. if global.monrandom = false {
  162.  
  163.     m = global.specific_mon_plyr1
  164.  
  165.     }
  166.    
  167. image_index = m; //update sprite to appropriate mon
  168.  
  169. // then we grab the corresponding stats for that mon
  170. aStoredPlyrName[m,c] = Var.NameId[m];
  171. aStoredPlyrHlth[m,c] = Var.HlthId[m]*2.2;
  172. aStoredPlyrHlthCache[m,c] = Var.HlthId[m]*2.2;
  173. aStoredPlyrAttk[m,c] = Var.AttkId[m];
  174. aStoredPlyrDfns[m,c] = Var.DfnsId[m];
  175. aStoredPlyrSpat[m,c] = Var.SpatId[m];
  176. aStoredPlyrSpdf[m,c] = Var.SpdfId[m];
  177. aStoredPlyrSped[m,c] = Var.SpedId[m];
  178. aStoredPlyrMove1[m,c] = irandom_range(0,global.Moves);
  179. aStoredPlyrMove2[m,c] = irandom_range(0,global.Moves);
  180. aStoredPlyrMove3[m,c] = irandom_range(0,global.Moves);
  181. aStoredPlyrMove4[m,c] = irandom_range(0,global.Moves);
  182. aStoredPlyrFaint[m,c] = false;
  183.  
  184. // now we set our local stat variables to equal the stored data
  185. // PlyrName[0] = aStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of your party
  186.  
  187. global.aHealth = aStoredPlyrHlth[m,c];
  188. PlyrName[o] = aStoredPlyrName[m,c];
  189. PlyrHlth[o] = aStoredPlyrHlth[m,c];
  190. PlyrAttk[o] = aStoredPlyrAttk[m,c];
  191. PlyrDfns[o] = aStoredPlyrDfns[m,c];
  192. PlyrSpat[o] = aStoredPlyrSpat[m,c];
  193. PlyrSpdf[o] = aStoredPlyrSpdf[m,c];
  194. PlyrSped[0] = aStoredPlyrSped[m,c];
  195. aPlyrMove1 = aStoredPlyrMove1[m,c];
  196. aPlyrMove2 = aStoredPlyrMove2[m,c];
  197. aPlyrMove3 = aStoredPlyrMove3[m,c];
  198. aPlyrMove4 = aStoredPlyrMove4[m,c];
  199.  
  200. }
  201.  
  202. /* PLAYER 2 MON ------------------------- */
  203.  
  204. with(instance_create(x,y,Mon)) { /* PLAYER 2 MON ------------------------- */
  205.  
  206. o = 1; // set mon to be player 2
  207.  
  208. if global.monrandom = true {
  209.  
  210.     m = irandom_range(0,global.MonAmount-1); // for now we randomly select a mon
  211.    
  212.     }
  213.    
  214. if global.monrandom = false {
  215.  
  216.     m = global.specific_mon_plyr2
  217.  
  218.     }
  219.  
  220. image_index = m; //update sprite to appropriate mon
  221.  
  222. // then we grab the corresponding stats for that mon
  223. bStoredPlyrName[m,c] = Var.NameId[m];
  224. bStoredPlyrHlth[m,c] = Var.HlthId[m]*2.2;
  225. bStoredPlyrHlthCache[m,c] = Var.HlthId[m]*2.2;
  226. bStoredPlyrAttk[m,c] = Var.AttkId[m];
  227. bStoredPlyrDfns[m,c] = Var.DfnsId[m];
  228. bStoredPlyrSpat[m,c] = Var.SpatId[m];
  229. bStoredPlyrSpdf[m,c] = Var.SpdfId[m];
  230. bStoredPlyrSped[m,c] = Var.SpedId[m];
  231. bStoredPlyrMove1[m,c] = irandom_range(0,global.Moves);
  232. bStoredPlyrMove2[m,c] = irandom_range(0,global.Moves);
  233. bStoredPlyrMove3[m,c] = irandom_range(0,global.Moves);
  234. bStoredPlyrMove4[m,c] = irandom_range(0,global.Moves);
  235. bStoredPlyrFaint[m,c] = false;
  236.  
  237. // now we set our local stat variables to equal the stored data
  238. //PlyrName[1] = bStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of opponents party
  239.  
  240. global.bHealth = bStoredPlyrHlth[m,c];
  241. PlyrName[o] = bStoredPlyrName[m,c];
  242. PlyrHlth[o] = bStoredPlyrHlth[m,c];
  243. PlyrAttk[o] = bStoredPlyrAttk[m,c];
  244. PlyrDfns[o] = bStoredPlyrDfns[m,c];
  245. PlyrSpat[o] = bStoredPlyrSpat[m,c];
  246. PlyrSpdf[o] = bStoredPlyrSpdf[m,c];
  247. PlyrSped[1] = bStoredPlyrSped[m,c];
  248. bPlyrMove1 = bStoredPlyrMove1[m,c];
  249. bPlyrMove2 = bStoredPlyrMove2[m,c];
  250. bPlyrMove3 = bStoredPlyrMove3[m,c];
  251. bPlyrMove4 = bStoredPlyrMove4[m,c];
  252. }
  253.  
  254. Step Event:
  255.  
  256. for other object: execute code:
  257.  
  258. ///BATTLE INSTRUCTION
  259.  
  260. xview_offset = random_viewx;
  261. yview_offset = random_viewy;
  262.  
  263. background_x = view_xview-random_viewx;
  264. background_y = view_yview-random_viewy;
  265.  
  266. if global.Player1Score >= 6 {
  267.     global.battletext = "You lost.";
  268.     audio_sound_gain(Var.Mus,0,0);
  269.     room_goto(endroom);
  270.     }
  271. if global.Player2Score >= 6 {
  272.     global.battletext = "You won!";
  273.     audio_sound_gain(Var.Mus,0,0);
  274.     room_goto(endroom);
  275.     }
  276.  
  277. DFDelay = 3;
  278.  
  279. if global.UseDamageFrames = true && global.MoveDelay < global.MoveDelayAmount {
  280.     global.MoveDelay += 1;
  281.     }
  282.  
  283. if (global.UseDamageFrames = true && (global.DamageFrame < 6) && (global.MoveDelay >= global.MoveDelayAmount)) {
  284.  
  285.     if global.DamageFrameDelay <= DFDelay {
  286.         global.DamageFrameDelay += 1;
  287.         VIS = 0;
  288.         }
  289.    
  290.     if global.DamageFrameDelay > DFDelay {
  291.    
  292.     if global.PlayHitSfx = false && global.MusicEnabled = 1 && global.Player1Moving = true && global.Player2Moving = false && global.aMoveTypeEffect >= 0.1 {
  293.         if global.aMoveTypeEffect = 1 {
  294.             if !audio_is_playing(Var.SndHit) {
  295.                 audio_play_sound(Var.SndHit,1,false);
  296.                 }
  297.             }
  298.         if global.aMoveTypeEffect < 1 && global.aMoveTypeEffect > 0 {
  299.             if !audio_is_playing(Var.SndHitWeak) {
  300.                 audio_play_sound(Var.SndHitWeak,1,false);
  301.                 }
  302.             }
  303.         if global.aMoveTypeEffect >= 2 {
  304.             if !audio_is_playing(Var.SndHitStrong) {
  305.                 audio_play_sound(Var.SndHitStrong,1,false);
  306.                 }
  307.             }
  308.         global.PlayHitSfx = true;
  309.         }
  310.        
  311.     if global.PlayHitSfx = false && global.MusicEnabled = 1 && global.Player2Moving = true && global.Player1Moving = false && global.bMoveTypeEffect >= 0.1 {
  312.         if global.bMoveTypeEffect = 1 {
  313.             if !audio_is_playing(Var.SndHit) {
  314.                 audio_play_sound(Var.SndHit,1,false);
  315.                 }
  316.             }
  317.         if global.bMoveTypeEffect < 1 && global.bMoveTypeEffect > 0 {
  318.             if !audio_is_playing(Var.SndHitWeak) {
  319.                 audio_play_sound(Var.SndHitWeak,1,false);
  320.                 }
  321.             }
  322.         if global.bMoveTypeEffect >= 2 {
  323.             if !audio_is_playing(Var.SndHitStrong) {
  324.                 audio_play_sound(Var.SndHitStrong,1,false);
  325.                 }
  326.             }
  327.         global.PlayHitSfx = true;
  328.         }
  329.    
  330.         if global.aDamageFrame = true && global.bDamageFrame = false && global.bMoveTypeEffect >= 0.1 {  
  331.         with(Mon) {
  332.             if o = 0 && global.aMonPositioned = true {
  333.                 if visible = visible && other.VIS = 0 {
  334.                     visible = !visible;
  335.                     global.DamageFrame += 1;
  336.                     global.DamageFrameDelay = 0;
  337.                     other.VIS = 1;
  338.                     }
  339.                 if visible = !visible && global.DamageFrameDelay >= DFDelay+1 && other.VIS = 0 {
  340.                     visible = visible;
  341.                     global.DamageFrame += 1;
  342.                     global.DamageFrameDelay = 0;
  343.                     other.VIS = 1;
  344.                     }
  345.                 }
  346.             }
  347.         }
  348.        
  349.         if global.bDamageFrame = true && global.aDamageFrame = false && global.aMoveTypeEffect >= 0.1 {  
  350.         with(Mon) {
  351.             if o = 1 && global.bMonPositioned = true {
  352.                 if visible = visible && other.VIS = 0 {
  353.                     visible = !visible;
  354.                     global.DamageFrame += 1;
  355.                     global.DamageFrameDelay = 0;
  356.                     other.VIS = 1;
  357.                     }
  358.                 if visible = !visible && global.DamageFrameDelay >= DFDelay+1 && other.VIS = 0 {
  359.                     visible = visible;
  360.                     global.DamageFrame += 1;
  361.                     global.DamageFrameDelay = 0;
  362.                     other.VIS = 1;
  363.                     }
  364.                 }
  365.             }
  366.         }
  367.        
  368.         if global.DamageFrame = 6 && global.DamageActivateDelay = false && PreAttackDelay < 0 {
  369.             PreAttackDelay = 3;
  370.             global.DamageActivateDelay = true;  
  371.             }
  372.         }
  373.     }
  374.    
  375. if global.DamageFrame >= 6 && global.DamageActivateDelay = true && PreAttackDelay <= 0 {
  376.     with(Mon) {
  377.         visible = true;
  378.         }
  379.     global.aDamageFrame = false;
  380.     global.bDamageFrame = false;
  381.     global.DamageActivateDelay = false;
  382.     }
  383.  
  384. Mode = keyboard_check_pressed(vk_lshift);
  385.  
  386. //toggle manual mode
  387. if Mode
  388.    {
  389. if global.Manual = false then
  390. global.Manual = true;
  391. else
  392. global.Manual = false;
  393.    }
  394.    
  395. //same type attack bonus (STAB) calculation
  396.  
  397.  
  398. //adjust specific moves    
  399. with(Mon) {
  400.     if o = 0 && global.aWaiting = true && global.CalcCrit = false {
  401.         if global.aMoveChosen = 73 || global.aMoveChosen = 86 || global.aMoveChosen = 89 || global.aMoveChosen = 90 || global.aMoveChosen = 94 || global.aMoveChosen = 98 || global.aMoveChosen = 101 || global.aMoveChosen = 109 || global.aMoveChosen = 110 || global.aMoveChosen = 118 || global.aMoveChosen = 119 || global.aMoveChosen = 120 {
  402.         aCHitMod = choose(1,1,3,3,3);
  403.         global.bCHitMod = choose(1,1,3,3,3);
  404.         global.CalcCrit = true;
  405.         }
  406.     if global.aMoveChosen = 25 || global.aMoveChosen = 59 || global.aMoveChosen = 112 || global.aMoveChosen = 123 || global.aMoveChosen = 124 {
  407.         aCHitMod = 3;
  408.         }
  409.     if global.aMoveChosen = 103 {
  410.         aCHitMod = choose(1,3,4,3);
  411.         global.CalcCrit = true;
  412.         }
  413.     if global.aMoveChosen = 99 {
  414.         aCHitMod = choose(1,1,6,8,9,9,10);
  415.         global.CalcCrit = true;
  416.         }
  417.     }
  418.     if o = 1 && global.bWaiting = true && global.CalcCrit = false {
  419.         if global.bMoveChosen = 73 || global.bMoveChosen = 86 || global.bMoveChosen = 89 || global.bMoveChosen = 90 || global.bMoveChosen = 94 || global.bMoveChosen = 98 || global.bMoveChosen = 101 || global.bMoveChosen = 109 || global.bMoveChosen = 110 || global.bMoveChosen = 118 || global.bMoveChosen = 119 || global.bMoveChosen = 120 {
  420.         bCHitMod = choose(1,1,3,3,3);
  421.         global.aCHitMod = bCHitMod;
  422.         global.CalcCrit = true;
  423.         }
  424.     if global.bMoveChosen = 25 || global.bMoveChosen = 59 || global.bMoveChosen = 112 || global.bMoveChosen = 123 || global.bMoveChosen = 124 {
  425.         bCHitMod = 3;
  426.         }
  427.     if global.bMoveChosen = 103 {
  428.         bCHitMod = choose(1,3,4,3);
  429.         global.CalcCrit = true;
  430.         }
  431.     if global.bMoveChosen = 99 {
  432.         bCHitMod = choose(1,1,6,8,9,9,10);
  433.         global.CalcCrit = true;
  434.         }
  435.     }
  436. }
  437.  
  438. ///HANDLE ATTACKS QUEUE
  439.  
  440. MonExists = instance_exists(Mon);
  441.  
  442. xoff = xview_offset;
  443. yoff = yview_offset;
  444.  
  445. Key = keyboard_check(ord('R'));
  446. MouseRight = mouse_check_button(mb_right);
  447. NoSound = keyboard_check_pressed(ord('S'));
  448. Shifty = keyboard_check(vk_lshift);
  449.  
  450. if NoSound {
  451.     if global.NoMusic = 0 {
  452.         global.NoMusic = 1;
  453.         } else {
  454.         global.NoMusic = 0;
  455.         }
  456.    }
  457.  
  458. if Key { game_restart(); }
  459. if MouseRight && Shifty { game_restart(); }
  460.  
  461. if global.FinishedTurn = false {
  462.  
  463. if PreAttackDelay > 0 { //if delay is greater than zero
  464.     PreAttackDelay -= 0.2; //subtract 0.2
  465. }
  466.  
  467. if PreAttackDelay <= 0 { //if delay is less than or equal to zero
  468.     PreAttackDelay = -1; //set it to zero incase value goes less than zero
  469. }
  470.  
  471. if PostAttackDelay > 0 { //if delay is greater than zero
  472.     PostAttackDelay -= 0.2; //subtract 0.2
  473. }
  474.  
  475. if PostAttackDelay <= 0 { //if delay is less than or equal to zero
  476.     PostAttackDelay = -1; //set it to zero incase value goes less than zero
  477. }
  478.  
  479. }
  480.  
  481. //SET MESSAGE_TEXT TO ATTACK MESSAGES
  482.  
  483. with(Mon) {
  484. if (o = 0 && global.aWaiting = false) {
  485.     aRandomPower = irandom_range(217,255); //set random power for specific moves
  486.     }
  487. if (o = 0 && aMoveSelected = true && global.aWaiting = false) {
  488.     global.aWaiting = true;
  489.     global.aCHitMod = choose(1,1,1,1,1,1,1,3,3); //critical hit chance
  490.     switch(other.SelectedMove) {
  491.         case 0:
  492.             StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove1])+"!";
  493.             if Var.MoveCategory[aPlyrMove1] = "Physical" {
  494.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrAttk*Var.MovePower[aPlyrMove1]/global.bStoredPlyrDfns/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  495.                 }
  496.             if Var.MoveCategory[aPlyrMove1] = "Special" {
  497.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrSpat*Var.MovePower[aPlyrMove1]/global.bStoredPlyrSpdf/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  498.                 }
  499.             global.aMoveChosen = real(aPlyrMove1);
  500.             //(Var.MovePower[aPlyrMove1]*(global.aStoredPlyrAttk/global.bStoredPlyrDfns))/50+2;
  501.             break;
  502.         case 1:
  503.             StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove2])+"!";
  504.             if Var.MoveCategory[aPlyrMove2] = "Physical" {
  505.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrAttk*Var.MovePower[aPlyrMove2]/global.bStoredPlyrDfns/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  506.                 }
  507.             if Var.MoveCategory[aPlyrMove2] = "Special" {
  508.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrSpat*Var.MovePower[aPlyrMove2]/global.bStoredPlyrSpdf/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  509.                 }
  510.             //global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrAttk*Var.MovePower[aPlyrMove2]/global.bStoredPlyrDfns/50+2*1*10/10*aRandomPower/255;
  511.             global.aMoveChosen = real(aPlyrMove2);
  512.             break;
  513.         case 2:
  514.             StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove3])+"!";
  515.             if Var.MoveCategory[aPlyrMove3] = "Physical" {
  516.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrAttk*Var.MovePower[aPlyrMove3]/global.bStoredPlyrDfns/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  517.                 }
  518.             if Var.MoveCategory[aPlyrMove3] = "Special" {
  519.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrSpat*Var.MovePower[aPlyrMove3]/global.bStoredPlyrSpdf/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  520.                 }
  521.             //global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrAttk*Var.MovePower[aPlyrMove3]/global.bStoredPlyrDfns/50+2*1*10/10*aRandomPower/255;
  522.             global.aMoveChosen = real(aPlyrMove3);
  523.             break;
  524.         case 3:
  525.             StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove4])+"!";
  526.             if Var.MoveCategory[aPlyrMove4] = "Physical" {
  527.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrAttk*Var.MovePower[aPlyrMove4]/global.bStoredPlyrDfns/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  528.                 }
  529.             if Var.MoveCategory[aPlyrMove4] = "Special" {
  530.                 global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrSpat*Var.MovePower[aPlyrMove4]/global.bStoredPlyrSpdf/50+2*1*10/10*aRandomPower/255*global.aCHitMod;
  531.                 }
  532.             //global.aDamageInflicted = ((200)/5+2)*global.aStoredPlyrAttk*Var.MovePower[aPlyrMove4]/global.bStoredPlyrDfns/50+2*1*10/10*aRandomPower/255;
  533.             global.aMoveChosen = real(aPlyrMove4);
  534.             break;
  535.     }
  536.     //global.PlayerQueue += 1;
  537.     }
  538. if (o = 1 && global.bWaiting = false) {
  539.     bRandomPower = irandom_range(217,255);
  540.     }
  541. if o = 1 && bMoveSelected = true && global.bWaiting = false { //only updates the text for a moment
  542.     global.bWaiting = true;
  543.     global.bCHitMod = choose(1,1,1,1,1,1,1,3,3); //critical hit chance
  544.     switch(other.OtherSelectedMove) {
  545.         case 0:
  546.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove1])+"!";
  547.             if Var.MoveCategory[bPlyrMove1] = "Physical" {
  548.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove1]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  549.                 }
  550.             if Var.MoveCategory[bPlyrMove1] = "Special" {
  551.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrSpat*Var.MovePower[bPlyrMove1]/global.aStoredPlyrSpdf/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  552.                 }
  553.             //global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove1]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255;
  554.             global.bMoveChosen = real(bPlyrMove1);
  555.             break;
  556.         case 1:
  557.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove2])+"!";
  558.             if Var.MoveCategory[bPlyrMove2] = "Physical" {
  559.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove2]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  560.                 }
  561.             if Var.MoveCategory[bPlyrMove2] = "Special" {
  562.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrSpat*Var.MovePower[bPlyrMove2]/global.aStoredPlyrSpdf/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  563.                 }
  564.             //global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove2]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255;
  565.             global.bMoveChosen = real(bPlyrMove2);
  566.             break;
  567.         case 2:
  568.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove3])+"!";
  569.             if Var.MoveCategory[bPlyrMove3] = "Physical" {
  570.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove3]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  571.                 }
  572.             if Var.MoveCategory[bPlyrMove3] = "Special" {
  573.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrSpat*Var.MovePower[bPlyrMove3]/global.aStoredPlyrSpdf/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  574.                 }
  575.             //global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove3]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255;
  576.             global.bMoveChosen = real(bPlyrMove3);
  577.             break;
  578.         case 3:
  579.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove4])+"!";
  580.             if Var.MoveCategory[bPlyrMove4] = "Physical" {
  581.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove4]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  582.                 }
  583.             if Var.MoveCategory[bPlyrMove4] = "Special" {
  584.                 global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrSpat*Var.MovePower[bPlyrMove4]/global.aStoredPlyrSpdf/50+2*1*10/10*bRandomPower/255*global.bCHitMod;
  585.                 }
  586.             //global.bDamageInflicted = ((200)/5+2)*global.bStoredPlyrAttk*Var.MovePower[bPlyrMove4]/global.aStoredPlyrDfns/50+2*1*10/10*bRandomPower/255;
  587.             global.bMoveChosen = real(bPlyrMove4);
  588.             break;
  589.     }
  590.     //global.PlayerQueue += 1;
  591.     }
  592. }
  593.  
  594. //BEGIN ATTACKING ONCE EVERYONE HAS SELECTED A MOVE
  595. //DETERMINE WHO IS FASTER FIRST TO BUILD A QUEUE
  596.  
  597. if (global.PlayerQueue >= 2) {
  598.  
  599.     global.FinishedTurn = false; //allows text box to fire off attack cmds
  600.    
  601.     //TYPE EFFECTIVENESS CALCULATION
  602.     /*
  603.     if global.TypeCalc = false {
  604.         defender_type_matchup_plyr1_type1();
  605.         defender_type_matchup_plyr2_type1();
  606.     global.TypeCalc = true;
  607.     }
  608.     */
  609.    
  610.     //check 'o' value of Mon object and see who is faster
  611.             with(Mon) {
  612.             if (o = 0) { // player 1 moves
  613.             if ((global.aStoredPlyrSped*Var.MovePriority[global.aMoveChosen] > global.bStoredPlyrSped)
  614.                 || global.bFinishQueue = 1
  615.                 || global.aSpeedTieWin = true) /*if faster or player 2 already moved*/
  616.                 {
  617.                 if (global.Player1Moving = false && global.Player2Moving = false && aMoveSelected = true && bMoveSelected = true && global.aFinishQueue = 0) {
  618.                         global.Player1Moving = true;
  619.                         global.Player1DoneMoving = false;
  620.                         other.PreAttackDelay = 5; // Waits before hp starts depleting (where move animations and damage effect takes place)
  621.                         global.MoveDelay = 0;
  622.                         global.CalcCrit = false;
  623.                         global.BeginTurn = true;
  624.                         other.message_text = StoredText[0]; // "Player used Move!"
  625.                         global.SideBattleText += string(StoredText[0])+"##";
  626.                         defender_type_matchup_plyr2_type1();
  627.                         // STAB calculation
  628.                         if (global.aStoredPlyrType1 = Var.MoveType[global.aMoveChosen]
  629.                         || global.aStoredPlyrType2 = Var.MoveType[global.aMoveChosen]) {
  630.                             global.aDamageInflicted *= 1.5;
  631.                         }
  632.                     }
  633.                 }
  634.             }
  635.             if (o = 0 && other.PreAttackDelay = -1 && global.bDamageFrame = false && global.Player1Moving = true && global.Player1DoneMoving = false) {
  636.                     global.Player2Damaged = true;
  637.                     global.UseDamageFrames = true;
  638.                     global.bDamageFrame = true;
  639.                 }
  640.             }
  641.            
  642.             with(Mon) {
  643.             if (o = 1) { // player 2 moves
  644.             if ((global.aStoredPlyrSped <= global.bStoredPlyrSped*Var.MovePriority[global.bMoveChosen])
  645.                 || global.aFinishQueue = 1
  646.                 || global.bSpeedTieWin = true) //if faster or player 1 already moved
  647.                 {
  648.                 if (global.Player2Moving = false && global.Player1Moving = false && aMoveSelected = true && bMoveSelected = true && global.bFinishQueue = 0) {
  649.                         global.Player2Moving = true; // player 2 moves, damages player 1
  650.                         global.Player2DoneMoving = false;
  651.                         other.PreAttackDelay = 5; // Waits before hp starts depleting (where move animations and damage effect takes place)
  652.                         global.MoveDelay = 0;
  653.                         global.CalcCrit = false;
  654.                         global.BeginTurn = true;
  655.                         other.message_text = StoredText[1]; // "The opposing Player used Move!"
  656.                         global.SideBattleText += string(StoredText[1])+"##";
  657.                         defender_type_matchup_plyr1_type1();
  658.                         // STAB calculation
  659.                         if (global.bStoredPlyrType1 = Var.MoveType[global.bMoveChosen]
  660.                         || global.bStoredPlyrType2 = Var.MoveType[global.bMoveChosen]) {
  661.                             global.bDamageInflicted *= 1.5;
  662.                         }
  663.                     }        
  664.                 }
  665.             }
  666.             if (o = 1 && other.PreAttackDelay = -1 && global.aDamageFrame = false && global.Player2Moving = true && global.Player2DoneMoving = false) {
  667.                     global.Player1Damaged = true;
  668.                     global.UseDamageFrames = true;
  669.                     global.aDamageFrame = true;
  670.                 }
  671.             }
  672. }
  673.  
  674. if (MonExists) //finish the turn
  675. if (PreAttackDelay < 1 && global.aFinishQueue = 1 && global.bFinishQueue = 1 && global.FinishedTurn = false) {
  676.     global.FinishedTurn = true; //finish the turn
  677.     global.PlayerQueue = 0;
  678.     global.Player1Moving = false;
  679.     global.Player2Moving = false;
  680.     global.Player1Damaged = false;
  681.     global.Player2Damaged = false;
  682.     global.Player1DoneMoving = true;
  683.     global.Player2DoneMoving = true;
  684.     global.aDamageInflicted = 0;
  685.     global.bDamageInflicted = 0;
  686.     global.aWaiting = 0;
  687.     global.bWaiting = 0;
  688.     global.aComplexMove = false;
  689.     global.bComplexMove = false;
  690.     OtherSelectedMove = irandom_range(0,3);
  691.     if global.Manual = false {
  692.         SelectedMove = irandom_range(0,3);
  693.         }
  694.     global.HoldOffNextMove = false;
  695.     global.Player1TypeCalculated = false;
  696.     global.Player2TypeCalculated = false;
  697.     global.aMoveTypeEffect = 1;
  698.     global.bMoveTypeEffect = 1;
  699.     global.TypeCalc = false;
  700.     global.DamageFrame = 0;
  701.     global.aDamageFrame = false;
  702.     global.bDamageFrame = false;
  703.     global.UseDamageFrames = false;
  704.     global.PlayHitSfx = false;
  705.     global.MoveDelay = 0;
  706.     global.DamageFrameDelay = 0;
  707.     with(Mon) {
  708.         aMoveSelected = false;
  709.         bMoveSelected = false;
  710.         aCrit = false;
  711.         bCrit = false;
  712.         aRandomPower = irandom_range(217,255); //set random power for specific moves
  713.         bRandomPower = irandom_range(217,255); //set random power for specific moves
  714.     }
  715.     global.aFinishQueue = 0;
  716.     global.bFinishQueue = 0;
  717.     global.Turn += 1;
  718.     global.SideBattleText += "([------TURN "+string(global.Turn)+"------])"+"##";
  719.     random_viewx = irandom_range(0,room_width-view_wview);
  720.     random_viewy = irandom_range(0,room_height-view_hview);
  721.     Bg = irandom_range(0,15);
  722.     background_index = Bg;
  723.    
  724.     if global.aStoredPlyrSped = global.bStoredPlyrSped {
  725.         global.CoinToss = irandom_range(0,1);
  726.         global.SpeedTied = true;
  727.         }
  728.    
  729.     if global.aStoredPlyrSped != global.bStoredPlyrSped {
  730.         global.SpeedTied = false;
  731.         global.aSpeedTieWin = false;
  732.         global.bSpeedTieWin = false;
  733.         }
  734.        
  735.     if global.SpeedTied = true {
  736.         switch(global.CoinToss) {
  737.             case 0: global.aSpeedTieWin = true; global.bSpeedTieWin = false; break;
  738.             case 1: global.bSpeedTieWin = true; global.aSpeedTieWin = false; break;
  739.             }
  740.         }
  741. }
  742.  
  743. if global.FinishedTurn = true && global.aFinishQueue = 0 && global.bFinishQueue = 0 {
  744.     message_text = "What will "+string(aSideName)+" do?";
  745.     global.BeginTurn = true;
  746. }
  747.  
  748. //if global.Manual = false && global.FinishedTurn = true && global.PlayerQueue = 0 {
  749.     //global.PlayerQueue = 4;
  750.     //}
  751.    
  752.  
  753. execute code:
  754.  
  755. ///SWITCHING OUT POKEMON
  756.  
  757. /* PLAYER 1 MON ------------------------- */
  758.  
  759. if global.aSwitching = true && global.aFaintAction = true && global.aFainted = true {
  760.  
  761. PreAttackDelay = 10;
  762. mm = irandom_range(0,global.MonAmount-1);
  763. switch(global.text_rand) {
  764.     case 0: message_text = "Go! "+string(Var.NameId[mm])+"!"; break;
  765.     case 1: message_text = "Im counting on you "+string(Var.NameId[mm])+"!"; break;
  766.     case 2: message_text = "Take charge! "+string(Var.NameId[mm])+"!"; break;
  767.     case 3: message_text = "Lets finish this "+string(Var.NameId[mm])+"!"; break;
  768.     case 4: message_text = "You got this in the bag "+string(Var.NameId[mm])+"!"; break;
  769.     case 5: message_text = "Pull off something great! "+string(Var.NameId[mm])+"!"; break;
  770.     case 6: message_text = "Im counting on you "+string(Var.NameId[mm])+"!"; break;
  771.     case 7: message_text = "Be your very best! "+string(Var.NameId[mm])+"!"; break;
  772.     case 8: message_text = "Take it back! "+string(Var.NameId[mm])+"!"; break;
  773.     }
  774. global.SideBattleText += string(message_text)+"##";
  775. global.aFainted = false;
  776. global.aMadPhase = false;
  777. }
  778.  
  779. if PreAttackDelay < 1 && global.aSwitching = true && global.aFainted = false {
  780.  
  781. with(instance_create(view_xview+view_wview*0.2,view_yview+view_hview*0.6,Mon)) { /* PLAYER 1 MON ------------------------- */
  782.  
  783. o = 0; // set mon to be player 1
  784.  
  785. m = other.mm; // for now we randomly select a mon
  786.  
  787. image_index = m; // update sprite to appropriate mon
  788.  
  789. if global.MusicEnabled = 1 {
  790.     audio_play_sound(Var.SndSwitch,1,false);
  791.     }
  792.  
  793. // then we grab the corresponding stats for that mon
  794. aStoredPlyrName[m,c] = Var.NameId[m];
  795. aStoredPlyrHlth[m,c] = Var.HlthId[m]*2.2;
  796. aStoredPlyrHlthCache[m,c] = Var.HlthId[m]*2.2;
  797. aStoredPlyrAttk[m,c] = Var.AttkId[m];
  798. aStoredPlyrDfns[m,c] = Var.DfnsId[m];
  799. aStoredPlyrSpat[m,c] = Var.SpatId[m];
  800. aStoredPlyrSpdf[m,c] = Var.SpdfId[m];
  801. aStoredPlyrSped[m,c] = Var.SpedId[m];
  802. aStoredPlyrMove1[m,c] = irandom_range(0,global.Moves);
  803. aStoredPlyrMove2[m,c] = irandom_range(0,global.Moves);
  804. aStoredPlyrMove3[m,c] = irandom_range(0,global.Moves);
  805. aStoredPlyrMove4[m,c] = irandom_range(0,global.Moves);
  806. aStoredPlyrFaint[m,c] = false;
  807.  
  808. // now we set our local stat variables to equal the stored data
  809. // PlyrName[0] = aStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of your party
  810.  
  811. global.aHealth = aStoredPlyrHlth[m,c];
  812. PlyrName[o] = aStoredPlyrName[m,c];
  813. PlyrHlth[o] = aStoredPlyrHlth[m,c];
  814. PlyrAttk[o] = aStoredPlyrAttk[m,c];
  815. PlyrDfns[o] = aStoredPlyrDfns[m,c];
  816. PlyrSpat[o] = aStoredPlyrSpat[m,c];
  817. PlyrSpdf[o] = aStoredPlyrSpdf[m,c];
  818. PlyrSped[0] = aStoredPlyrSped[m,c];
  819. aPlyrMove1 = aStoredPlyrMove1[m,c];
  820. aPlyrMove2 = aStoredPlyrMove2[m,c];
  821. aPlyrMove3 = aStoredPlyrMove3[m,c];
  822. aPlyrMove4 = aStoredPlyrMove4[m,c];
  823.  
  824. other.PreAttackDelay = 10;
  825.  
  826. global.aSwitching = false;
  827. global.aFaintAction = false;
  828. global.aFinishQueue = 1;
  829. global.text_rand = irandom(8);
  830.  
  831. }
  832.  
  833. }
  834.  
  835. /* PLAYER 2 MON ------------------------- */
  836.  
  837. if global.bSwitching = true && global.bFaintAction = true && global.bFainted = true {
  838.  
  839. PreAttackDelay = 10;
  840. global.bFainted = false;
  841. global.bMadPhase = false;
  842. mm = irandom_range(0,global.MonAmount-1);
  843. message_text = "The opponent sent out "+string(Var.NameId[mm])+"!";
  844. global.SideBattleText += string(message_text)+"##";
  845.  
  846. }
  847.  
  848.  
  849. if PreAttackDelay < 1 && global.bSwitching = true && global.bFainted = false {
  850.  
  851. with(instance_create(view_xview-2000,view_yview-600,Mon)) { /* PLAYER 2 MON ------------------------- */
  852.  
  853. o = 1; // set mon to be player 2
  854.  
  855. m = other.mm; // for now we randomly select a mon
  856.  
  857. image_index = m; // update sprite to appropriate mon
  858.  
  859. if global.MusicEnabled = 1 {
  860.     audio_play_sound(Var.SndSwitch,1,false);
  861.     }
  862.  
  863. // then we grab the corresponding stats for that mon
  864. bStoredPlyrName[m,c] = Var.NameId[m];
  865. bStoredPlyrHlth[m,c] = Var.HlthId[m]*2.2;
  866. bStoredPlyrHlthCache[m,c] = Var.HlthId[m]*2.2;
  867. bStoredPlyrAttk[m,c] = Var.AttkId[m];
  868. bStoredPlyrDfns[m,c] = Var.DfnsId[m];
  869. bStoredPlyrSpat[m,c] = Var.SpatId[m];
  870. bStoredPlyrSpdf[m,c] = Var.SpdfId[m];
  871. bStoredPlyrSped[m,c] = Var.SpedId[m];
  872. bStoredPlyrMove1[m,c] = irandom_range(0,global.Moves);
  873. bStoredPlyrMove2[m,c] = irandom_range(0,global.Moves);
  874. bStoredPlyrMove3[m,c] = irandom_range(0,global.Moves);
  875. bStoredPlyrMove4[m,c] = irandom_range(0,global.Moves);
  876. bStoredPlyrFaint[m,c] = false;
  877.  
  878. // now we set our local stat variables to equal the stored data
  879. //PlyrName[1] = bStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of opponents party
  880.  
  881. global.bHealth = bStoredPlyrHlth[m,c];
  882. PlyrName[o] = bStoredPlyrName[m,c];
  883. PlyrHlth[o] = bStoredPlyrHlth[m,c];
  884. PlyrAttk[o] = bStoredPlyrAttk[m,c];
  885. PlyrDfns[o] = bStoredPlyrDfns[m,c];
  886. PlyrSpat[o] = bStoredPlyrSpat[m,c];
  887. PlyrSpdf[o] = bStoredPlyrSpdf[m,c];
  888. PlyrSped[1] = bStoredPlyrSped[m,c];
  889. bPlyrMove1 = bStoredPlyrMove1[m,c];
  890. bPlyrMove2 = bStoredPlyrMove2[m,c];
  891. bPlyrMove3 = bStoredPlyrMove3[m,c];
  892. bPlyrMove4 = bStoredPlyrMove4[m,c];
  893.  
  894. other.PreAttackDelay = 10;
  895.  
  896. global.bSwitching = false;
  897. global.bFaintAction = false;
  898. global.bFinishQueue = 1;
  899.  
  900. }
  901.  
  902. }
  903.  
  904. execute code:
  905.  
  906. ///MISCELLANEOUS
  907.  
  908. Click = mouse_check_button_pressed(mb_left);
  909. rClickHold = mouse_check_button(mb_right);
  910. lClickHold = mouse_check_button(mb_left);
  911. Enter = keyboard_check(vk_enter);
  912.  
  913. if (Enter && lClickHold && rClickHold) {
  914.     room_goto(debugroom);
  915.     }
  916.  
  917. Max = keyboard_check_pressed(ord('M'));
  918. Sfx = keyboard_check_pressed(ord('N'));
  919.  
  920. if Max
  921.    {
  922. if window_get_fullscreen()=0 then
  923. window_set_fullscreen(true)
  924. else
  925. window_set_fullscreen(false)
  926.    }
  927.    
  928. if Sfx {
  929.     if global.MusicEnabled = 1 {
  930.         global.MusicEnabled = 0;
  931.         } else {
  932.         global.MusicEnabled = 1;
  933.         }
  934.     }
  935.    
  936. if global.MusicEnabled = 0
  937.     {
  938.     //audio_stop_all();
  939.     }
  940.  
  941. Draw Event:
  942.  
  943. execute code:
  944.  
  945. ///DRAW EVENT
  946.  
  947. /*
  948.  
  949. x1y1====================================
  950. ========================================
  951. ========================================
  952. ====================================x2y2
  953.  
  954. */
  955.  
  956. draw_set_font(font0);
  957.  
  958. padding = 32;
  959. box_height = 128;
  960. textcolor = c_black;
  961. textboxcolor = c_white;
  962. mainCol = make_colour_rgb(80, 191, 29);
  963. mainCol2 = make_colour_rgb(30, 145, 212);
  964.  
  965. text_draw(view_xview+4,view_yview+16,"P1: "+string(global.Player1Score),c_white)
  966. text_draw(view_xview+4,view_yview+38,"P2: "+string(global.Player2Score),c_white)
  967.  
  968. box_left = view_xview+padding;
  969. box_top = view_yview+view_hview-padding-box_height;
  970. box_right = view_xview+view_wview-padding;
  971. box_bottom = view_yview+view_hview-padding;
  972.  
  973. with(Mon) {
  974.     if o = 0 {
  975.         other.aSideName = PlyrName[0];
  976.         }
  977.     if o = 1 {
  978.         other.bSideName = PlyrName[1];
  979.         }
  980. }
  981.  
  982. draw_set_color(textboxcolor);
  983. draw_set_alpha(0.82);
  984. draw_rectangle(box_left,box_top,box_right,box_bottom,false);
  985. draw_set_alpha(1);
  986.  
  987. // display text message
  988.  
  989. draw_set_font(minecraftia);
  990.  
  991. text_draw(box_left*1.3,box_top*1.01,string(message_text),textcolor);
  992.  
  993. draw_set_font(font0);
  994.  
  995. Left = keyboard_check_pressed(vk_left);
  996. Right = keyboard_check_pressed(vk_right);
  997. Up = keyboard_check_pressed(vk_up);
  998. Down = keyboard_check_pressed(vk_down);
  999. ScrollUp = mouse_wheel_up();
  1000. ScrollDown = mouse_wheel_down();
  1001. Select = keyboard_check_pressed(vk_enter);
  1002. MouseSelect = mouse_check_button_pressed(mb_left);
  1003. XMouseSelect = mouse_check_button(mb_left);
  1004. pQ = keyboard_check_pressed(ord('Q'));
  1005. maxStringWidth = "ThisIsTheMaxStringLimit";
  1006. longestString = string_width(maxStringWidth);
  1007. mainTextCol = mainCol;
  1008. mainTextCol2 = mainCol2;
  1009.  
  1010. if Var.MoveCategory[global.aStoredPlyrMove1] == "Physical" && SelectedMove != 0 {
  1011.     MoveColor1 = mainTextCol;
  1012.     }
  1013. if Var.MoveCategory[global.aStoredPlyrMove1] == "Special" && SelectedMove != 0 {
  1014.     MoveColor1 = mainTextCol2;
  1015.     }
  1016. if Var.MoveCategory[global.aStoredPlyrMove2] == "Physical" && SelectedMove != 1 {
  1017.     MoveColor2 = mainTextCol;
  1018.     }
  1019. if Var.MoveCategory[global.aStoredPlyrMove2] == "Special" && SelectedMove != 1 {
  1020.     MoveColor2 = mainTextCol2;
  1021.     }
  1022. if Var.MoveCategory[global.aStoredPlyrMove3] == "Physical" && SelectedMove != 2 {
  1023.     MoveColor3 = mainTextCol;
  1024.     }
  1025. if Var.MoveCategory[global.aStoredPlyrMove3] == "Special" && SelectedMove != 2 {
  1026.     MoveColor3 = mainTextCol2;
  1027.     }
  1028. if Var.MoveCategory[global.aStoredPlyrMove4] == "Physical" && SelectedMove != 3 {
  1029.     MoveColor4 = mainTextCol;
  1030.     }
  1031. if Var.MoveCategory[global.aStoredPlyrMove4] == "Special" && SelectedMove != 3 {
  1032.     MoveColor4 = mainTextCol2;
  1033.     }
  1034.  
  1035. /* Moves
  1036.  
  1037.   0  |  1
  1038. -----------
  1039.   2  |  3
  1040.  
  1041. */
  1042.  
  1043. if delay > 0 {
  1044.     delay -= 0.2;
  1045.     }
  1046.  
  1047. audio_sound_pitch(select,1);
  1048.  
  1049. if global.aWaiting = false {
  1050.  
  1051. if (Left && delay = 0)
  1052. if (SelectedMove = 1 || SelectedMove = 3) {
  1053.     SelectedMove -= 1;
  1054.     delay = 0.6;
  1055.     play_select();
  1056.     }
  1057.  
  1058. if (Left && delay = 0)
  1059. if (SelectedMove = 0 || SelectedMove = 2) {
  1060.     SelectedMove += 1;
  1061.     delay = 0.6;
  1062.     play_select();
  1063.     }
  1064.  
  1065. if (Right && delay = 0)
  1066. if (SelectedMove = 0 || SelectedMove = 2) {
  1067.     SelectedMove += 1;
  1068.     delay = 0.6;
  1069.     play_select();
  1070.     }
  1071.  
  1072. if (Right && delay = 0)
  1073. if (SelectedMove = 1 || SelectedMove = 3) {
  1074.     SelectedMove -= 1;
  1075.     delay = 0.6;
  1076.     play_select();
  1077.     }
  1078.  
  1079. if (Up && delay = 0)
  1080. if (SelectedMove = 2 || SelectedMove = 3) {
  1081.     SelectedMove -= 2;
  1082.     delay = 0.6;
  1083.     play_select();
  1084.     }
  1085.  
  1086. if (Up && delay = 0)
  1087. if (SelectedMove = 0 || SelectedMove = 1) {
  1088.     SelectedMove += 2;
  1089.     delay = 0.6;
  1090.     play_select();
  1091.     }
  1092.  
  1093. if (Down && delay = 0)
  1094. if (SelectedMove = 0 || SelectedMove = 1) {
  1095.     SelectedMove += 2;
  1096.     delay = 0.6;
  1097.     play_select();
  1098.     }
  1099.  
  1100. if (Down && delay = 0)
  1101. if (SelectedMove = 2 || SelectedMove = 3) {
  1102.     SelectedMove -= 2;
  1103.     delay = 0.6;
  1104.     play_select();
  1105.     }
  1106.  
  1107. if (ScrollDown && delay = 0) {
  1108.     if SelectedMove < 3 {
  1109.         SelectedMove += 1;
  1110.         delay = 0.6;
  1111.         } else {
  1112.         SelectedMove = 0;
  1113.         delay = 0.6;
  1114.         }
  1115.     }
  1116.  
  1117. if (ScrollUp && delay = 0) {
  1118.     if SelectedMove > 0 {
  1119.         SelectedMove -= 1;
  1120.         delay = 0.6;
  1121.         } else {
  1122.         SelectedMove = 3;
  1123.         delay = 0.6;
  1124.         }
  1125.     }
  1126.  
  1127. }
  1128.  
  1129.  
  1130. switch(SelectedMove) {
  1131.     case 0:
  1132.         MoveColor1 = c_yellow;
  1133.         break;
  1134.     case 1:
  1135.         MoveColor2 = c_yellow;
  1136.         break;
  1137.     case 2:
  1138.         MoveColor3 = c_yellow;
  1139.         break;
  1140.     case 3:
  1141.         MoveColor4 = c_yellow;  
  1142. }
  1143.  
  1144. if (pQ) {
  1145.     if (debugger)
  1146.         debugger = false;
  1147.     else
  1148.         debugger = true;
  1149.     }
  1150.  
  1151. if debugger = true {
  1152. //text_draw(box_left*1.3,box_top*0.90,"Player Queue: "+string(global.PlayerQueue),mainTextCol);
  1153. //text_draw(box_left*1.3,box_top*0.85,"bSelected: "+string(Mon.bMoveSelected),mainTextCol);
  1154. //text_draw(box_left*1.3,box_top*0.80,"aSelected: "+string(Mon.aMoveSelected),mainTextCol);
  1155. //text_draw(box_left*1.3,box_top*0.70,"bMoving: "+string(global.Player2Moving),mainTextCol);
  1156. //text_draw(box_left*1.3,box_top*0.65,"aMoving: "+string(global.Player1Moving),mainTextCol);
  1157. //text_draw(box_left*1.3,box_top*0.70,"bDamageInflicted: "+string(global.bDamageInflicted),mainTextCol);
  1158. //text_draw(box_left*1.3,box_top*0.65,"aDamageInflicted: "+string(global.aDamageInflicted),mainTextCol);
  1159. //text_draw(box_left*1.3,box_top*0.75,"FinishedTurn: "+string(global.FinishedTurn),mainTextCol);
  1160. //text_draw(box_left*1.3,box_top*0.85,"PreAttackDelay: "+string(PreAttackDelay),mainTextCol);
  1161. //text_draw(box_left*1.3,box_top*0.80,"Text Rand: "+string(global.text_rand),mainTextCol);
  1162. if XMouseSelect {
  1163.     text_draw(mouse_x,mouse_y,"x: "+string(mouse_x)+"#y: "+string(mouse_y),c_yellow);
  1164.     }
  1165. }
  1166.  
  1167. with(Mon) {
  1168. if global.Manual = true && aMoveSelected = false
  1169. if (other.Select = true || other.MouseSelect = true) {
  1170.     if !audio_is_playing(select) && aMoveSelected = false {
  1171.         play_select();
  1172.         }
  1173.     aMoveSelected = true;
  1174.     global.PlayerQueue += 1;
  1175.     if bMoveSelected = false {
  1176.         bMoveSelected = true;
  1177.         global.PlayerQueue += 1;
  1178.     }
  1179.     //global.PlayerQueue += 1;
  1180.     }
  1181. }
  1182.  
  1183. with(Mon) {
  1184. if global.Manual = false && aMoveSelected = false {
  1185.     //if !audio_is_playing(select) && aMoveSelected = false {
  1186.         //play_select();
  1187.         //aMoveSelected = true;
  1188.         //}
  1189.     SelectedMove = irandom_range(0,3);
  1190.     aMoveSelected = true;
  1191.     global.PlayerQueue += 1;
  1192.     if bMoveSelected = false {
  1193.         bMoveSelected = true;
  1194.         global.PlayerQueue += 1;
  1195.     }
  1196.     //global.PlayerQueue += 1;
  1197.     }
  1198. }
  1199.  
  1200. // display the movepool
  1201.  
  1202. draw_set_font(minecraftia);
  1203.  
  1204. PadOffset = 1.75;
  1205. Pad2Offset = 1.90;
  1206. VerBoxOffset = 1.10;
  1207. VBO2 = 0.08;    
  1208.  
  1209. if global.aWaiting = false {
  1210.     text_draw(box_right-(longestString*2)-(padding*PadOffset),box_top*VerBoxOffset,string(Var.MoveName[global.aStoredPlyrMove1])+"  ("+string(Var.MoveType[global.aStoredPlyrMove1])+" "+string(Var.MovePower[global.aStoredPlyrMove1])+")",MoveColor1);
  1211.     text_draw(box_right-(padding*Pad2Offset)-string_width("("+string(Var.MovePower[global.aStoredPlyrMove2])+" "+string(Var.MoveType[global.aStoredPlyrMove2])+")  "+string(Var.MoveName[global.aStoredPlyrMove2]))+24,box_top*VerBoxOffset,"("+string(Var.MovePower[global.aStoredPlyrMove2])+" "+string(Var.MoveType[global.aStoredPlyrMove2])+")  "+string(Var.MoveName[global.aStoredPlyrMove2]),MoveColor2);
  1212.     text_draw(box_right-(longestString*2)-(padding*PadOffset),box_top*(VerBoxOffset+VBO2),string(Var.MoveName[global.aStoredPlyrMove3])+"  ("+string(Var.MoveType[global.aStoredPlyrMove3])+" "+string(Var.MovePower[global.aStoredPlyrMove3])+")",MoveColor3);
  1213.     text_draw(box_right-(padding*Pad2Offset)-string_width("("+string(Var.MovePower[global.aStoredPlyrMove4])+" "+string(Var.MoveType[global.aStoredPlyrMove4])+")  "+string(Var.MoveName[global.aStoredPlyrMove4]))+24,box_top*(VerBoxOffset+VBO2),"("+string(Var.MovePower[global.aStoredPlyrMove4])+" "+string(Var.MoveType[global.aStoredPlyrMove4])+")  "+string(Var.MoveName[global.aStoredPlyrMove4]),MoveColor4);
  1214.     }
  1215.    
  1216. /*
  1217. box_left = view_xview+padding;
  1218. box_top = view_yview+view_hview-padding-box_height;
  1219. box_right = view_xview+view_wview-padding;
  1220. box_bottom = view_yview+view_hview-padding;
  1221. */
  1222.    
  1223. draw_set_font(font0);
Add Comment
Please, Sign In to add comment