BT21_097.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_097 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Ignore Color Requirment
  12. if (timing == EffectTiming.None)
  13. {
  14. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  15. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  16. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  17. cardEffects.Add(ignoreColorConditionClass);
  18. bool HasAppmonTrait(Permanent permanent)
  19. {
  20. if(CardEffectCommons.IsOwnerPermanent(permanent, card))
  21. {
  22. if (permanent.TopCard.EqualsTraits("Appmon"))
  23. {
  24. if (permanent.IsDigimon || permanent.IsTamer)
  25. {
  26. return true;
  27. }
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.HasMatchConditionPermanent(HasAppmonTrait, true);
  35. }
  36. bool CardCondition(CardSource cardSource)
  37. {
  38. return cardSource == card;
  39. }
  40. }
  41. #endregion
  42. #region Main
  43. if (timing == EffectTiming.OptionSkill)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  47. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  48. cardEffects.Add(activateClass);
  49. string EffectDescription()
  50. {
  51. return "[Main] Reveal the top 3 cards of your deck. Add 1 card with the [Appmon]/[App Driver] trait among them to the hand. Trash the rest. Then, place this card in the battle area.";
  52. }
  53. bool CanSelectCardCondition(CardSource cardSource)
  54. {
  55. return cardSource.EqualsTraits("Appmon") || cardSource.EqualsTraits("App Driver");
  56. }
  57. bool CanUseCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  64. revealCount: 3,
  65. simplifiedSelectCardConditions:
  66. new SimplifiedSelectCardConditionClass[]
  67. {
  68. new SimplifiedSelectCardConditionClass(
  69. canTargetCondition:CanSelectCardCondition,
  70. message: "Select 1 card with [Appmon]/[App Driver] in its traits.",
  71. mode: SelectCardEffect.Mode.AddHand,
  72. maxCount: 1,
  73. selectCardCoroutine: null)
  74. },
  75. remainingCardsPlace: RemainingCardsPlace.Trash,
  76. activateClass: activateClass
  77. ));
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  79. }
  80. }
  81. #endregion
  82. #region End of Your Turn - Delay
  83. if (timing == EffectTiming.OnEndTurn)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("Link 1 card from hand with 1 Digimon", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDiscription());
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[End of Your Turn] You may link 1 card from your hand with 1 of your Digimon without paying the cost.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsOwnerTurn(card))
  96. {
  97. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  98. }
  99. return false;
  100. }
  101. bool CanSelectLinkTarget(CardSource cardSoure)
  102. {
  103. return cardSoure.CanLink(false);
  104. }
  105. IEnumerator ActivateCoroutine(Hashtable hashtable)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  108. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  109. activateClass: activateClass,
  110. successProcess: permanents => SuccessProcess(),
  111. failureProcess: null));
  112. IEnumerator SuccessProcess()
  113. {
  114. Permanent selectedPermanent = null;
  115. CardSource cardForLinking = null;
  116. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectLinkTarget))
  117. {
  118. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  119. selectHandEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectLinkTarget,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: 1,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. isShowOpponent: true,
  128. selectCardCoroutine: SelectCardCoroutine,
  129. afterSelectCardCoroutine: null,
  130. mode: SelectHandEffect.Mode.Custom,
  131. cardEffect: activateClass);
  132. selectHandEffect.SetUpCustomMessage("Select 1 card to link.", "The opponent is selecting 1 card to link.");
  133. yield return StartCoroutine(selectHandEffect.Activate());
  134. }
  135. IEnumerator SelectCardCoroutine(CardSource cardSource)
  136. {
  137. cardForLinking = cardSource;
  138. yield return null;
  139. }
  140. if(cardForLinking != null)
  141. {
  142. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  143. selectPermanentEffect.SetUp(
  144. selectPlayer: card.Owner,
  145. canTargetCondition: CanSelectPermanentCondition,
  146. canTargetCondition_ByPreSelecetedList: null,
  147. canEndSelectCondition: null,
  148. maxCount: 1,
  149. canNoSelect: false,
  150. canEndNotMax: false,
  151. selectPermanentCoroutine: SelectPermanentCoroutine,
  152. afterSelectPermanentCoroutine: null,
  153. mode: SelectPermanentEffect.Mode.Custom,
  154. cardEffect: activateClass);
  155. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  156. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  157. bool CanSelectPermanentCondition(Permanent permanent)
  158. {
  159. return cardForLinking.CanLinkToTargetPermanent(permanent, false);
  160. }
  161. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  162. {
  163. selectedPermanent = permanent;
  164. yield return null;
  165. }
  166. if (selectedPermanent != null)
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(cardForLinking, activateClass));
  169. }
  170. }
  171. }
  172. }
  173. }
  174. #endregion
  175. #region Security
  176. if (timing == EffectTiming.SecuritySkill)
  177. {
  178. cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
  179. }
  180. #endregion
  181. return cardEffects;
  182. }
  183. }
  184. }