BT18_089.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_089 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Security Effect
  11. if (timing == EffectTiming.SecuritySkill)
  12. {
  13. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  14. }
  15. #endregion
  16. #region Start of Your Main Phase
  17. if (timing == EffectTiming.OnStartMainPhase)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Trash 1 [Hybrid]/[Ten Warriors] to gain 1 memory", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  22. cardEffects.Add(activateClass);
  23. string EffectDescription()
  24. {
  25. return
  26. "[Start of Your Main Phase] By trashing 1 card with the [Hybrid]/[Ten Warriors] trait in your hand, gain 1 memory.";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card) &&
  31. CardEffectCommons.IsOwnerTurn(card);
  32. }
  33. bool HasHybridInTrait(CardSource cardSource)
  34. {
  35. return cardSource.HasHybridTenWarriorsTraits;
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleArea(card) &&
  40. CardEffectCommons.HasMatchConditionOwnersHand(card, HasHybridInTrait);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  45. selectHandEffect.SetUp(
  46. canTargetCondition: HasHybridInTrait,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. canNoSelect: true,
  50. selectCardCoroutine: null,
  51. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  52. maxCount: 1,
  53. canEndNotMax: false,
  54. isShowOpponent: true,
  55. mode: SelectHandEffect.Mode.Discard,
  56. selectPlayer: card.Owner,
  57. cardEffect: activateClass);
  58. selectHandEffect.SetUpCustomMessage("Select 1 card with [Hybrid]/[Ten Warriors] trait to discard.",
  59. "The opponent is selecting 1 card with [Hybrid]/[Ten Warriors] trait to discard.");
  60. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  61. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  62. {
  63. if (cardSources.Count > 0)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(
  66. card.Owner.AddMemory(1, activateClass));
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. #region When Attacking
  73. if (timing == EffectTiming.OnAllyAttack)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Trash bottom digivolution card", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  78. activateClass.SetIsInheritedEffect(true);
  79. activateClass.SetHashString("WhenAttacking_BT18-089");
  80. cardEffects.Add(activateClass);
  81. string EffectDescription()
  82. {
  83. return
  84. "[When Attacking] (Once Per Turn) Trash the bottom digivolution card of 1 of your opponent's Digimon. Then, if your opponent has no Digimon with digivolution cards, <Draw 1>.";
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  89. }
  90. bool CanSelectPermanentCondition(Permanent permanent)
  91. {
  92. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  93. }
  94. bool CanActivateCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.IsExistOnBattleArea(card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  101. {
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentCondition,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: 1,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: SelectPermanentCoroutine,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Custom,
  114. cardEffect: activateClass);
  115. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.",
  116. "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(
  121. CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  122. targetPermanent: permanent,
  123. trashCount: 1,
  124. isFromTop: false,
  125. activateClass: activateClass));
  126. }
  127. }
  128. if (!CardEffectCommons.HasMatchConditionOpponentsPermanent(card,permanent => permanent.IsDigimon && !permanent.HasNoDigivolutionCards))
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(
  131. new DrawClass(card.Owner, 1, activateClass).Draw());
  132. }
  133. }
  134. }
  135. #endregion
  136. return cardEffects;
  137. }
  138. }
  139. }