BT22_095.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Akemi Suedou
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_095 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Security
  13. if (timing == EffectTiming.SecuritySkill)
  14. {
  15. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  16. }
  17. #endregion
  18. #region Your Turn
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("+1 memory, then if you have 7 or less in hand, draw 1", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Your Turn] When any of your Digimon with the [Eater] trait are played, 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.)";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsEater);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnField(card)
  36. && CardEffectCommons.IsOwnerTurn(card)
  37. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  38. }
  39. bool IsEater(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  42. permanent.TopCard.HasEaterTraits;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent> { card.PermanentOfThisCard() }, hashtable).Tap());
  47. if (card.Owner.CanAddMemory(activateClass)) yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  48. if (card.Owner.HandCards.Count <= 7) yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  49. }
  50. }
  51. #endregion
  52. #region Main
  53. if (timing == EffectTiming.OnDeclaration)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("Place underneath a [Mother Eater]", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  58. cardEffects.Add(activateClass);
  59. string EffectDiscription()
  60. {
  61. return "[Main] Place this Tamer as any of your [Mother Eater]s' bottom digivolution card.";
  62. }
  63. bool CanUseCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.HasMatchConditionPermanent(IsMotherEater);
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnField(card)
  70. && CardEffectCommons.IsOwnerTurn(card);
  71. }
  72. bool IsMotherEater(Permanent permanent)
  73. {
  74. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,card) &&
  75. permanent.TopCard.EqualsCardName("Mother Eater");
  76. }
  77. IEnumerator ActivateCoroutine(Hashtable hashtable)
  78. {
  79. if (CardEffectCommons.HasMatchConditionPermanent(IsMotherEater))
  80. {
  81. Permanent motherEater = null;
  82. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsMotherEater));
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: IsMotherEater,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: maxCount,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. motherEater = permanent;
  99. yield return null;
  100. }
  101. selectPermanentEffect.SetUpCustomMessage("Select 1 Mother eater to add to digivolution cards", "The opponent is selecting 1 Mother eater to add to digivolution cards");
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. if (motherEater != null) yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { card.PermanentOfThisCard(), motherEater } }, false, activateClass).PlacePermanentToDigivolutionCards());
  104. }
  105. }
  106. }
  107. #endregion
  108. #region ESS
  109. bool ESSCondition()
  110. {
  111. return CardEffectCommons.IsExistOnField(card)
  112. && card.PermanentOfThisCard().TopCard.EqualsCardName("Mother Eater");
  113. }
  114. #region Rush
  115. if (timing == EffectTiming.None)
  116. {
  117. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: true, card: card, condition: ESSCondition));
  118. }
  119. #endregion
  120. #region Alliance
  121. if (timing == EffectTiming.OnAllyAttack)
  122. {
  123. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: true, card: card, condition: ESSCondition));
  124. }
  125. #endregion
  126. #region Scapegoat
  127. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  128. {
  129. cardEffects.Add(CardEffectFactory.ScapegoatSelfEffect(isInheritedEffect: true, card: card, condition: ESSCondition, effectName: "<Scapegoat>", effectDiscription: null));
  130. }
  131. #endregion
  132. #endregion
  133. return cardEffects;
  134. }
  135. }
  136. }