EX7_052.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_052 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Reveal the top 3 cards of your deck. Among them, add 1 card with [Lilithmon] in its text to the hand and trash 1 purple card. Return the rest to the bottom of the deck.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.HasText("Lilithmon"))
  24. {
  25. return true;
  26. }
  27. return false;
  28. }
  29. bool CanSelectCardCondition1(CardSource cardSource)
  30. {
  31. if (cardSource.HasCardColor(CardColor.Purple))
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  44. {
  45. if (card.Owner.LibraryCards.Count >= 1)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  55. revealCount: 3,
  56. simplifiedSelectCardConditions:
  57. new SimplifiedSelectCardConditionClass[]
  58. {
  59. new SimplifiedSelectCardConditionClass(
  60. canTargetCondition:CanSelectCardCondition,
  61. message: "Select 1 card with [Lilithmon] in its text to add to your hand.",
  62. mode: SelectCardEffect.Mode.AddHand,
  63. maxCount: 1,
  64. selectCardCoroutine: null),
  65. new SimplifiedSelectCardConditionClass(
  66. canTargetCondition:CanSelectCardCondition1,
  67. message: "Select 1 purple card to discard.",
  68. mode: SelectCardEffect.Mode.Discard,
  69. maxCount: 1,
  70. selectCardCoroutine: null),
  71. },
  72. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  73. activateClass: activateClass
  74. ));
  75. }
  76. }
  77. #endregion
  78. #region Inherit
  79. if (timing == EffectTiming.OnAllyAttack)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("End the attack by deleting 1 of your Digimon", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  84. activateClass.SetHashString("StopAttack_EX7-052");
  85. activateClass.SetIsInheritedEffect(true);
  86. cardEffects.Add(activateClass);
  87. string EffectDiscription()
  88. {
  89. return "[Opponent's Turn][Once Per Turn] When an opponent's Digimon attacks, by deleting 1 of your other Digimon, end the attack.";
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  94. {
  95. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, permanent => true))
  96. {
  97. if (CardEffectCommons.IsOpponentTurn(card))
  98. {
  99. return true;
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  108. {
  109. if (CardEffectCommons.IsOpponentTurn(card))
  110. {
  111. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  112. {
  113. return true;
  114. }
  115. }
  116. }
  117. return false;
  118. }
  119. bool CanSelectPermanentCondition(Permanent permanent)
  120. {
  121. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  122. {
  123. if (permanent != card.PermanentOfThisCard())
  124. {
  125. return true;
  126. }
  127. }
  128. return false;
  129. }
  130. IEnumerator ActivateCoroutine(Hashtable hashtable)
  131. {
  132. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  133. {
  134. int maxCount = 1;
  135. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  136. selectPermanentEffect.SetUp(
  137. selectPlayer: card.Owner,
  138. canTargetCondition: CanSelectPermanentCondition,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. maxCount: maxCount,
  142. canNoSelect: false,
  143. canEndNotMax: false,
  144. selectPermanentCoroutine: SelectPermanentCoroutine,
  145. afterSelectPermanentCoroutine: null,
  146. mode: SelectPermanentEffect.Mode.Custom,
  147. cardEffect: activateClass);
  148. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  149. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  150. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  151. {
  152. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  153. IEnumerator SuccessProcess()
  154. {
  155. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.EndAttack());
  156. }
  157. }
  158. }
  159. }
  160. }
  161. #endregion
  162. return cardEffects;
  163. }
  164. }
  165. }