BT23_093.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Big Bang Punch!
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_093 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Ignore Color Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool HasAppmonTrait(Permanent permanent)
  20. {
  21. if (CardEffectCommons.IsOwnerPermanent(permanent, card))
  22. {
  23. if (permanent.TopCard.EqualsTraits("Appmon"))
  24. {
  25. if (permanent.IsDigimon || permanent.IsTamer)
  26. {
  27. return true;
  28. }
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.HasMatchConditionPermanent(HasAppmonTrait, true);
  36. }
  37. bool CardCondition(CardSource cardSource)
  38. {
  39. return cardSource == card;
  40. }
  41. }
  42. #endregion
  43. #region Main
  44. if (timing == EffectTiming.OptionSkill)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[Main] <Draw 1> (Draw 1 card from your deck.) Then, place this card in the battle area.";
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable hashtable)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  62. }
  63. }
  64. #endregion
  65. #region All Turns
  66. if (timing == EffectTiming.OnTappedAnyone)
  67. {
  68. List<Permanent> suspendedPermaments = new List<Permanent>();
  69. ActivateClass activateClass = new ActivateClass();
  70. activateClass.SetUpICardEffect("Link 1 [Appmon] trait digimon from hand", CanUseCondition, card);
  71. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  72. cardEffects.Add(activateClass);
  73. string EffectDiscription()
  74. {
  75. return "[All Turns] When any of your [Appmon] trait Digimon suspend <Delay>, You may link 1 [Appmon] trait Digimon card from your hand to 1 of those Digimon without paying the cost.";
  76. }
  77. bool CanUseCondition(Hashtable hashtable)
  78. {
  79. return CardEffectCommons.IsExistOnBattleArea(card)
  80. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsYourAppmon);
  81. }
  82. bool CanActivateCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.IsExistOnBattleArea(card)
  85. && CardEffectCommons.CanDeclareOptionDelayEffect(card);
  86. }
  87. bool IsYourAppmon(Permanent permanent)
  88. {
  89. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  90. {
  91. if (permanent.TopCard.HasAppmonTraits)
  92. {
  93. suspendedPermaments.Add(permanent);
  94. return true;
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanSelectPermanentCondition(Permanent permanent)
  100. {
  101. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  102. && suspendedPermaments.Contains(permanent);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  107. IEnumerator SuccessProcess()
  108. {
  109. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  110. {
  111. Permanent selectedPermament = null;
  112. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  113. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  114. selectPermanentEffect.SetUp(
  115. selectPlayer: card.Owner,
  116. canTargetCondition: CanSelectPermanentCondition,
  117. canTargetCondition_ByPreSelecetedList: null,
  118. canEndSelectCondition: null,
  119. maxCount: maxCount,
  120. canNoSelect: true,
  121. canEndNotMax: false,
  122. selectPermanentCoroutine: SelectPermanentCoroutine,
  123. afterSelectPermanentCoroutine: null,
  124. mode: SelectPermanentEffect.Mode.Custom,
  125. cardEffect: activateClass);
  126. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  127. {
  128. selectedPermament = permanent;
  129. yield return null;
  130. }
  131. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain link", "The opponent is selecting 1 Digimon that will gain link");
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. bool CanSelectCardCondition(CardSource cardSource)
  134. {
  135. return cardSource.IsDigimon
  136. && cardSource.HasAppmonTraits
  137. && cardSource.CanLinkToTargetPermanent(selectedPermament, false);
  138. }
  139. if (selectedPermament != null && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  140. {
  141. CardSource selectedCard = null;
  142. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  143. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  144. selectHandEffect.SetUp(
  145. selectPlayer: card.Owner,
  146. canTargetCondition: CanSelectCardCondition,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. maxCount: maxCount1,
  150. canNoSelect: true,
  151. canEndNotMax: false,
  152. isShowOpponent: true,
  153. selectCardCoroutine: SelectCardCoroutine1,
  154. afterSelectCardCoroutine: null,
  155. mode: SelectHandEffect.Mode.Custom,
  156. cardEffect: activateClass);
  157. IEnumerator SelectCardCoroutine1(CardSource cardSource)
  158. {
  159. selectedCard = cardSource;
  160. yield return null;
  161. }
  162. selectHandEffect.SetUpCustomMessage("Select 1 digimon to link.", "The opponent is selecting 1 digimon to link.");
  163. selectHandEffect.SetUpCustomMessage_ShowCard("Selected card");
  164. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  165. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(selectedPermament.AddLinkCard(
  166. addedLinkCard: selectedCard,
  167. cardEffect: activateClass));
  168. }
  169. }
  170. }
  171. }
  172. }
  173. #endregion
  174. #region Security
  175. if (timing == EffectTiming.SecuritySkill)
  176. {
  177. ActivateClass activateClass = new ActivateClass();
  178. activateClass.SetUpICardEffect("place in battle area", CanUseCondition, card);
  179. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  180. activateClass.SetIsSecurityEffect(true);
  181. cardEffects.Add(activateClass);
  182. string EffectDescription()
  183. {
  184. return "[Security] place this card in the battle area.";
  185. }
  186. bool CanUseCondition(Hashtable hashtable)
  187. {
  188. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  189. }
  190. IEnumerator ActivateCoroutine(Hashtable hashtable)
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(
  193. CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  194. }
  195. }
  196. #endregion
  197. return cardEffects;
  198. }
  199. }
  200. }