BT8_104.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT8_104 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] <De-Digivolve 1> 1 of your opponent's Digimon. (Trash 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.) Then, you may place 1 card with [X-Antibody] in its traits from your hand as the bottom digivolution card of 1 of your black Digimon with [X-Antibody] in its traits to delete 1 of your opponent's Digimon with a play cost of 4 or less.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanSelectCardCondition(CardSource cardSource)
  28. {
  29. return cardSource.HasXAntibodyTraits;
  30. }
  31. bool CanSelectPermanentCondition1(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  34. {
  35. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  36. {
  37. if (permanent.TopCard.HasXAntibodyTraits)
  38. {
  39. if (!permanent.IsToken)
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanSelectPermanentCondition2(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  51. {
  52. if (permanent.TopCard.GetCostItself <= 4)
  53. {
  54. if (permanent.TopCard.HasPlayCost)
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  87. {
  88. Permanent selectedPermanent = permanent;
  89. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  90. }
  91. }
  92. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  95. {
  96. Permanent selectedPermanent = null;
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition1,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: true,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. selectPermanentEffect.SetUpCustomMessage("Select a black Digimon with [X-Antibody] in its traits.", "The opponent is selecting a black Digimon with [X-Antibody] in its traits.");
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  114. {
  115. selectedPermanent = permanent;
  116. yield return null;
  117. }
  118. if (selectedPermanent != null)
  119. {
  120. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  121. {
  122. List<CardSource> selectedCards = new List<CardSource>();
  123. maxCount = 1;
  124. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  125. selectHandEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: CanSelectCardCondition,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: maxCount,
  131. canNoSelect: true,
  132. canEndNotMax: false,
  133. isShowOpponent: true,
  134. selectCardCoroutine: SelectCardCoroutine,
  135. afterSelectCardCoroutine: null,
  136. mode: SelectHandEffect.Mode.Custom,
  137. cardEffect: activateClass);
  138. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  139. yield return StartCoroutine(selectHandEffect.Activate());
  140. IEnumerator SelectCardCoroutine(CardSource cardSource)
  141. {
  142. selectedCards.Add(cardSource);
  143. yield return null;
  144. }
  145. if (selectedCards.Count >= 1)
  146. {
  147. yield return ContinuousController.instance.StartCoroutine(selectedPermanent
  148. .AddDigivolutionCardsBottom(selectedCards, activateClass));
  149. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  150. {
  151. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition2));
  152. selectPermanentEffect.SetUp(
  153. selectPlayer: card.Owner,
  154. canTargetCondition: CanSelectPermanentCondition2,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. maxCount: maxCount,
  158. canNoSelect: false,
  159. canEndNotMax: false,
  160. selectPermanentCoroutine: null,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Destroy,
  163. cardEffect: activateClass);
  164. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  165. }
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. }
  173. if (timing == EffectTiming.SecuritySkill)
  174. {
  175. ActivateClass activateClass = new ActivateClass();
  176. activateClass.SetUpICardEffect($"De-Digivolve 1 to 1 Digimon and delete 1 Digimon with 4 or less Cost", CanUseCondition, card);
  177. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  178. activateClass.SetIsSecurityEffect(true);
  179. cardEffects.Add(activateClass);
  180. string EffectDiscription()
  181. {
  182. return "[Security] <De-Digivolve 1> 1 of your opponent's Digimon. Then, delete 1 of your opponent's Digimon with a play cost of 4 or less.";
  183. }
  184. bool CanSelectPermanentCondition(Permanent permanent)
  185. {
  186. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  187. }
  188. bool CanSelectPermanentCondition1(Permanent permanent)
  189. {
  190. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  191. {
  192. if (permanent.TopCard.GetCostItself <= 4)
  193. {
  194. if (permanent.TopCard.HasPlayCost)
  195. {
  196. return true;
  197. }
  198. }
  199. }
  200. return false;
  201. }
  202. bool CanUseCondition(Hashtable hashtable)
  203. {
  204. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  205. }
  206. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  207. {
  208. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  209. {
  210. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  211. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  212. selectPermanentEffect.SetUp(
  213. selectPlayer: card.Owner,
  214. canTargetCondition: CanSelectPermanentCondition,
  215. canTargetCondition_ByPreSelecetedList: null,
  216. canEndSelectCondition: null,
  217. maxCount: maxCount,
  218. canNoSelect: false,
  219. canEndNotMax: false,
  220. selectPermanentCoroutine: SelectPermanentCoroutine,
  221. afterSelectPermanentCoroutine: null,
  222. mode: SelectPermanentEffect.Mode.Custom,
  223. cardEffect: activateClass);
  224. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  225. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  226. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  227. {
  228. Permanent selectedPermanent = permanent;
  229. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  230. }
  231. }
  232. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  233. {
  234. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  235. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  236. selectPermanentEffect.SetUp(
  237. selectPlayer: card.Owner,
  238. canTargetCondition: CanSelectPermanentCondition1,
  239. canTargetCondition_ByPreSelecetedList: null,
  240. canEndSelectCondition: null,
  241. maxCount: maxCount,
  242. canNoSelect: false,
  243. canEndNotMax: false,
  244. selectPermanentCoroutine: null,
  245. afterSelectPermanentCoroutine: null,
  246. mode: SelectPermanentEffect.Mode.Destroy,
  247. cardEffect: activateClass);
  248. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  249. }
  250. }
  251. }
  252. return cardEffects;
  253. }
  254. }