Advertisement
Guest User

Untitled

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