EX9_069.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Analog Youth
  6. namespace DCGO.CardEffects.EX9
  7. {
  8. public class EX9_069 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Main Phase
  14. if (timing == EffectTiming.OnStartMainPhase)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Place 1 card from hand as FD source on a [DM] digimon", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Start of Your Main Phase] You may place 1 card from your hand face down as any of your [DM] trait Digimon's bottom digivolution card.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleArea(card) &&
  27. CardEffectCommons.IsOwnerTurn(card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleArea(card) &&
  32. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition) &&
  33. card.Owner.HandCards.Count >= 1;
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  38. permanent.TopCard.HasDMTraits;
  39. }
  40. bool CanSelectCard(CardSource sources)
  41. {
  42. return true;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. CardSource selectedCard = null;
  47. int maxCount = Math.Min(1, card.Owner.HandCards.Count);
  48. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  49. selectHandEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectCard,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: maxCount,
  55. canNoSelect: true,
  56. canEndNotMax: true,
  57. isShowOpponent: false,
  58. selectCardCoroutine: SelectCardCoroutine,
  59. afterSelectCardCoroutine: null,
  60. mode: SelectHandEffect.Mode.Custom,
  61. cardEffect: activateClass);
  62. selectHandEffect.SetUpCustomMessage("Select 1 card to add as face down source", "The opponent is selecting 1 card to add as face down source");
  63. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  64. yield return StartCoroutine(selectHandEffect.Activate());
  65. IEnumerator SelectCardCoroutine(CardSource cardSource)
  66. {
  67. selectedCard = cardSource;
  68. yield return null;
  69. }
  70. if (selectedCard != null)
  71. {
  72. Permanent selectedPermanent = null;
  73. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount1,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to get face down source", "The opponent is selecting 1 Digimon to get face down source");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. selectedPermanent = permanent;
  92. yield return null;
  93. }
  94. if (selectedPermanent != null)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  97. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  98. }
  99. }
  100. }
  101. }
  102. #endregion
  103. #region Your Turn
  104. if (timing == EffectTiming.OnAddDigivolutionCards)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("Suspend tamer, +1 memory. if 7 or less hand cards, draw 1", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  109. cardEffects.Add(activateClass);
  110. string EffectDiscription()
  111. {
  112. return "[Your Turn] When face-down cards are placed as any of your Digimon's digivolution cards, by suspending this Tamer, gain 1 memory. Then, if you have 7 or fewer cards in your hand, <Draw 1> (Draw 1 card from your deck).";
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.IsExistOnBattleArea(card) &&
  117. CardEffectCommons.CanTriggerOnAddDigivolutionCard(hashtable, PermanentCondition, null, CardCondition);
  118. }
  119. bool CanActivateCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.IsExistOnBattleArea(card) &&
  122. CardEffectCommons.CanActivateSuspendCostEffect(card) &&
  123. CardEffectCommons.IsOwnerTurn(card);
  124. }
  125. bool PermanentCondition(Permanent permanent)
  126. {
  127. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  128. }
  129. bool CardCondition(CardSource cardSource)
  130. {
  131. return cardSource.IsFlipped;
  132. }
  133. IEnumerator ActivateCoroutine(Hashtable hashtable)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  136. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  137. if (card.Owner.HandCards.Count <= 7)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  140. }
  141. }
  142. }
  143. #endregion
  144. #region Opponent's Turn - Reboot
  145. if (timing == EffectTiming.None)
  146. {
  147. bool CanUseCondition()
  148. {
  149. if (CardEffectCommons.IsExistOnBattleArea(card))
  150. {
  151. if (CardEffectCommons.IsOpponentTurn(card))
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. bool PermanentCondition(Permanent permanent)
  159. {
  160. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  161. {
  162. if (permanent.DigivolutionCards.Filter(x => x.IsFlipped).Any())
  163. {
  164. return true;
  165. }
  166. }
  167. return false;
  168. }
  169. cardEffects.Add(CardEffectFactory.RebootStaticEffect(
  170. permanentCondition: PermanentCondition,
  171. isInheritedEffect: false,
  172. card: card,
  173. condition: CanUseCondition));
  174. }
  175. #endregion
  176. #region Security
  177. if (timing == EffectTiming.SecuritySkill)
  178. {
  179. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  180. }
  181. #endregion
  182. return cardEffects;
  183. }
  184. }
  185. }