Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1. public void DestroyWeapon(GameObject card)
  2. {
  3. int i;
  4. int bullet = card.GetComponent<WeaponCardAttributes>().tempid;
  5. bool cleared = false;
  6. for (i = 0; i < MatchControl.mcontrol.TurnBuffs.Count; i++)
  7. {
  8. if (MatchControl.mcontrol.TurnBuffs[i].SemiTempCardID == bullet)
  9. {
  10. BuffGrande.BuffStruct BuffLambda = new BuffGrande.BuffStruct(-1, -1, -1, () => { });
  11. MatchControl.mcontrol.TurnBuffs[i] = BuffLambda;
  12. }
  13. }
  14.  
  15. if (card.GetComponent<WeaponCardAttributes>().owner == 1)
  16. {
  17. for (i = 0; i < 2; i++)
  18. {
  19. if (MatchControl.mcontrol.weaponslots1[i]!= null)
  20. {
  21. if (MatchControl.mcontrol.weaponslots1[i].GetComponent<WeaponCardAttributes>().tempid == bullet)
  22. {
  23. MatchControl.mcontrol.weaponslots1[i] = null;
  24. cleared = true;
  25. }
  26. }
  27. }
  28. if (cleared == false)
  29. {
  30. int cardinhand = -1;
  31. for (i = 0; i < 10; i++)
  32. {
  33. if (MatchControl.mcontrol.player1cards[i] != null)
  34. {
  35. if (MatchControl.mcontrol.player1cards[i].GetComponent<WeaponCardAttributes>() != null)
  36. {
  37. if (MatchControl.mcontrol.player1cards[i].GetComponent<WeaponCardAttributes>().tempid == bullet)
  38. {
  39. cardinhand = i;
  40. break;
  41. }
  42. }
  43. }
  44. }
  45. if (cardinhand != -1)
  46. {
  47. MatchControl.mcontrol.player1cards[cardinhand] = null;
  48. for (i = cardinhand; i < 9 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
  49. {
  50. MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
  51. }
  52. MatchControl.mcontrol.player1cards[9] = null;
  53. MatchControl.mcontrol.player1handamount--;
  54. }
  55. else//in decks,check left first
  56. {
  57. int cardinldeck = -1;
  58. for (i = 0; i < 20; i++)
  59. {
  60. if (MatchControl.mcontrol.ldeck1[i] != null)
  61. {
  62. if (MatchControl.mcontrol.ldeck1[i].GetComponent<WeaponCardAttributes>() != null)
  63. {
  64. if (MatchControl.mcontrol.ldeck1[i].GetComponent<WeaponCardAttributes>().tempid == bullet)
  65. {
  66. cardinldeck = i;
  67. break;
  68. }
  69. }
  70. }
  71. }
  72. MatchControl.mcontrol.ldeck1[cardinldeck] = null;
  73. for (i = cardinhand; i < 19 && MatchControl.mcontrol.ldeck1[i + 1] != null; i++)
  74. {
  75. MatchControl.mcontrol.ldeck1[i] = MatchControl.mcontrol.ldeck1[i + 1];
  76. }
  77. MatchControl.mcontrol.ldeck1[19] = null;
  78. }
  79. }
  80. MatchControl.mcontrol.graveyard1.Add(card);
  81. card.SetActive(false);
  82. }
  83. else
  84. {
  85. for (i = 0; i < 2; i++)
  86. {
  87. if (MatchControl.mcontrol.weaponslots2[i] != null)
  88. {
  89. if (MatchControl.mcontrol.weaponslots2[i].GetComponent<WeaponCardAttributes>().tempid == bullet)
  90. {
  91. MatchControl.mcontrol.weaponslots2[i] = null;
  92. cleared = true;
  93. break;
  94. }
  95. }
  96.  
  97. }
  98. if (cleared == false)
  99. {
  100. int cardinhand = -1;
  101. for (i = 0; i < 10; i++)
  102. {
  103. if (MatchControl.mcontrol.player2cards[i] != null)
  104. {
  105. if (MatchControl.mcontrol.player2cards[i].GetComponent<WeaponCardAttributes>() != null)
  106. {
  107. if (MatchControl.mcontrol.player2cards[i].GetComponent<WeaponCardAttributes>().tempid == bullet)
  108. {
  109. cardinhand = i;
  110. break;
  111. }
  112. }
  113. }
  114. }
  115. if (cardinhand != -1)
  116. {
  117. MatchControl.mcontrol.player2cards[cardinhand] = null;
  118. for (i = cardinhand; i < 9 && MatchControl.mcontrol.player2cards[i + 1] != null; i++)
  119. {
  120. MatchControl.mcontrol.player2cards[i] = MatchControl.mcontrol.player2cards[i + 1];
  121. }
  122. MatchControl.mcontrol.player2cards[9] = null;
  123.  
  124. MatchControl.mcontrol.player2handamount--;
  125. //cleared = true;
  126. }
  127. else//in decks,check left first
  128. {
  129. int cardinldeck = -1;
  130. for (i = 0; i < 20; i++)
  131. {
  132. if (MatchControl.mcontrol.ldeck2[i] != null)
  133. {
  134. if (MatchControl.mcontrol.ldeck2[i].GetComponent<WeaponCardAttributes>() != null)
  135. {
  136. if (MatchControl.mcontrol.ldeck2[i].GetComponent<WeaponCardAttributes>().tempid == bullet)
  137. {
  138. cardinldeck = i;
  139. break;
  140. }
  141. }
  142. }
  143. }
  144. MatchControl.mcontrol.ldeck2[cardinldeck] = null;
  145. for (i = cardinhand; i < 19 && MatchControl.mcontrol.ldeck2[i + 1] != null; i++)
  146. {
  147. MatchControl.mcontrol.ldeck2[i] = MatchControl.mcontrol.ldeck2[i + 1];
  148. }
  149. MatchControl.mcontrol.ldeck2[19] = null;
  150. }
  151. }
  152. MatchControl.mcontrol.graveyard2.Add(card);
  153. card.SetActive(false);
  154. }
  155.  
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement