BT21_076.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //BT21-076 Wargrowlmon
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_076 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Growlmon") &&
  17. targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play/When Digivolving shared
  23. bool CanActivateConditionShared(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  26. }
  27. #endregion
  28. #region On Play
  29. if(timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("trash 2, get raid retal", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return "[On Play] Trash the top 2 cards of your deck. Then, this Digimon gains <Raid> and <Retaliation> until your opponent's turn ends.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. if (card.Owner.LibraryCards.Count >= 1)
  46. {
  47. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  48. }
  49. yield return CardEffectCommons.GainRaid(card.PermanentOfThisCard(), EffectDuration.UntilOpponentTurnEnd, activateClass);
  50. yield return CardEffectCommons.GainRetaliation(card.PermanentOfThisCard(), EffectDuration.UntilOpponentTurnEnd, activateClass);
  51. }
  52. }
  53. #endregion
  54. #region When Digivolving
  55. if (timing == EffectTiming.OnEnterFieldAnyone)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("trash 2, get raid retal", CanUseCondition, card);
  59. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  60. cardEffects.Add(activateClass);
  61. string EffectDescription()
  62. {
  63. return "[When Digivolving] Trash the top 2 cards of your deck. Then, this Digimon gains <Raid> and <Retaliation> until your opponent's turn ends.";
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable hashtable)
  70. {
  71. if (card.Owner.LibraryCards.Count >= 1)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  74. }
  75. yield return CardEffectCommons.GainRaid(card.PermanentOfThisCard(), EffectDuration.UntilOpponentTurnEnd, activateClass);
  76. yield return CardEffectCommons.GainRetaliation(card.PermanentOfThisCard(), EffectDuration.UntilOpponentTurnEnd, activateClass);
  77. }
  78. }
  79. #endregion
  80. #region When Attacking
  81. if(timing == EffectTiming.OnAllyAttack)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("Digivolve to Megidra or ChaosGallant", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  86. activateClass.SetHashString("BT21_076 when attacking");
  87. cardEffects.Add(activateClass);
  88. string EffectDescription()
  89. {
  90. return "[When Attacking][Once Per Turn] This Digimon may digivolve into a Digimon card with [Megidramon] or [ChaosGallantmon] in its name in the hand. For every 10 total cards in both players' trashes, reduce this effect's digivolution cost by 1.";
  91. }
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  95. }
  96. bool CanDigivolveIntoCardCondition(CardSource cardsource)
  97. {
  98. return cardsource.ContainsCardName("Megidramon") || cardsource.ContainsCardName("ChaosGallantmon");
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersHand(card, CanDigivolveIntoCardCondition);
  103. }
  104. int Count()
  105. {
  106. return (card.Owner.TrashCards.Count + card.Owner.Enemy.TrashCards.Count) / 10;
  107. }
  108. IEnumerator ActivateCoroutine(Hashtable hashtable)
  109. {
  110. if(CardEffectCommons.HasMatchConditionOwnersHand(card, CanDigivolveIntoCardCondition))
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(
  113. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  114. targetPermanent: card.PermanentOfThisCard(),
  115. cardCondition: CanDigivolveIntoCardCondition,
  116. payCost: true,
  117. reduceCostTuple: (reduceCost: Count(), reduceCostCardCondition: null),
  118. fixedCostTuple: null,
  119. ignoreDigivolutionRequirementFixedCost: -1,
  120. isHand: true,
  121. activateClass: activateClass,
  122. successProcess: null));
  123. }
  124. }
  125. }
  126. #endregion
  127. #region On Deletion Inherit
  128. if (timing == EffectTiming.OnDestroyedAnyone)
  129. {
  130. ActivateClass activateClass = new ActivateClass();
  131. activateClass.SetUpICardEffect("Trash the top card of your opponent's security stack.", CanUseCondition, card);
  132. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  133. activateClass.SetIsInheritedEffect(true);
  134. cardEffects.Add(activateClass);
  135. string EffectDescription()
  136. {
  137. return "[On Deletion] Trash the top card of your opponent's security stack.";
  138. }
  139. bool CanUseCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  142. }
  143. bool CanActivateCondition(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
  146. {
  147. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  148. {
  149. return true;
  150. }
  151. }
  152. return false;
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  157. player: card.Owner.Enemy,
  158. destroySecurityCount: 1,
  159. cardEffect: activateClass,
  160. fromTop: true).DestroySecurity());
  161. }
  162. }
  163. #endregion
  164. return cardEffects;
  165. }
  166. }
  167. }