BT16_090.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_090 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Start Turn
  12. if (timing == EffectTiming.OnStartTurn)
  13. {
  14. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  15. }
  16. #endregion
  17. #region Main Effect
  18. if (timing == EffectTiming.OnDeclaration)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Delete [Ukkomon] and breeding area Digimon to play [BigUkkomon]", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  23. activateClass.SetHashString("Play_ST16_090");
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return
  28. "[Main] [Once Per Turn] By deleting 1 of your [Ukkomon] and trashing 1 of your Digimon in the breeding area, you may play 1 [BigUkkomon] in your breeding area from your hand for a cost of 3.";
  29. }
  30. bool CanSelectPermanentCondition(Permanent permanent)
  31. {
  32. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  33. {
  34. if (permanent.TopCard.CardNames.Contains("Ukkomon"))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanSelectBreedingAreaDigimon(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
  44. {
  45. if (permanent.IsDigimon)
  46. {
  47. return !permanent.ImmuneFromStackTrashing(activateClass);
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanSelectCardCondition(CardSource cardSource)
  53. {
  54. if (cardSource.ContainsCardName("Big Ukkomon"))
  55. {
  56. return true;
  57. }
  58. return false;
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.IsExistOnBattleArea(card))
  63. {
  64. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition) &&
  65. card.Owner.GetBreedingAreaPermanents().Count(CanSelectBreedingAreaDigimon) >= 1)
  66. {
  67. return true;
  68. }
  69. }
  70. return false;
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.IsExistOnBattleArea(card);
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable hashtable)
  77. {
  78. bool ukkomonDeleted = false;
  79. bool breedingAreaPermanentDeleted = false;
  80. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  81. {
  82. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  83. selectPermanentEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: CanSelectPermanentCondition,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: false,
  90. canEndNotMax: false,
  91. selectPermanentCoroutine: SelectPermanentCoroutine,
  92. afterSelectPermanentCoroutine: null,
  93. mode: SelectPermanentEffect.Mode.Custom,
  94. cardEffect: activateClass);
  95. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  96. "The opponent is selecting 1 Digimon to delete.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(
  101. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  102. targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass,
  103. successProcess: _ => SuccessProcess(), failureProcess: null));
  104. IEnumerator SuccessProcess()
  105. {
  106. ukkomonDeleted = true;
  107. yield return null;
  108. }
  109. }
  110. if (!ukkomonDeleted)
  111. yield break;
  112. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectBreedingAreaDigimon) >= 1)
  113. {
  114. List<Permanent> digitamaPermanents = card.Owner.GetBreedingAreaPermanents()
  115. .Filter(permanent => permanent.IsDigimon)
  116. .Clone();
  117. if (digitamaPermanents.Count >= 1)
  118. {
  119. foreach (Permanent permanent in digitamaPermanents)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(permanent.DiscardEvoRoots());
  122. CardSource cardSource = permanent.TopCard;
  123. ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
  124. .ShowCardEffect(new List<CardSource>() { cardSource }, "Cards put to trash", true, true));
  125. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveField(permanent));
  126. yield return ContinuousController.instance.StartCoroutine(
  127. CardObjectController.AddTrashCard(cardSource));
  128. breedingAreaPermanentDeleted = true;
  129. }
  130. }
  131. if (ukkomonDeleted && breedingAreaPermanentDeleted)
  132. {
  133. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  134. {
  135. List<CardSource> selectedCards = new List<CardSource>();
  136. int maxCount = 1;
  137. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  138. selectHandEffect.SetUp(
  139. selectPlayer: card.Owner,
  140. canTargetCondition: CanSelectCardCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: maxCount,
  144. canNoSelect: true,
  145. canEndNotMax: false,
  146. isShowOpponent: true,
  147. selectCardCoroutine: SelectCardCoroutine,
  148. afterSelectCardCoroutine: null,
  149. mode: SelectHandEffect.Mode.Custom,
  150. cardEffect: activateClass);
  151. selectHandEffect.SetUpCustomMessage("Select 1 card to play.",
  152. "The opponent is selecting 1 card to play.");
  153. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  154. yield return StartCoroutine(selectHandEffect.Activate());
  155. IEnumerator SelectCardCoroutine(CardSource cardSource)
  156. {
  157. selectedCards.Add(cardSource);
  158. yield return null;
  159. }
  160. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  161. cardSources: selectedCards,
  162. activateClass: activateClass,
  163. payCost: true,
  164. isTapped: false,
  165. root: SelectCardEffect.Root.Hand,
  166. activateETB: true,
  167. isBreedingArea: true,
  168. fixedCost: 3));
  169. }
  170. }
  171. }
  172. }
  173. }
  174. }
  175. #endregion
  176. #region Security Skill
  177. if (timing == EffectTiming.SecuritySkill)
  178. {
  179. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  180. }
  181. #endregion
  182. return cardEffects;
  183. }
  184. }
  185. }