BT17_011.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_011 : 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
  12. // Takuya Kanbara
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Takuya Kanbara") ||
  18. targetPermanent.TopCard.EqualsCardName("TakuyaKanbara");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
  22. card: card, condition: null));
  23. }
  24. // BurningGreymon
  25. if (timing == EffectTiming.None)
  26. {
  27. bool PermanentCondition(Permanent targetPermanent)
  28. {
  29. return targetPermanent.TopCard.EqualsCardName("BurningGreymon");
  30. }
  31. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  32. permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false,
  33. card: card, condition: null));
  34. }
  35. // Any red tamer
  36. if (timing == EffectTiming.None)
  37. {
  38. bool Condition()
  39. {
  40. return card.Owner.HandCards.Contains(card);
  41. }
  42. bool PermanentCondition(Permanent targetPermanent)
  43. {
  44. return targetPermanent.IsTamer && targetPermanent.TopCard.CardColors.Contains(CardColor.Red);
  45. }
  46. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  47. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  48. card: card, condition: Condition));
  49. }
  50. #endregion
  51. #region When Digivolving
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("This Digimon digivolves into [AncientGreymon]", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
  57. EffectDescription());
  58. cardEffects.Add(activateClass);
  59. string EffectDescription()
  60. {
  61. return
  62. "[When Digivolving] If [BurningGreymon] is in this Digimon's digivolution cards or you have a blue or green Digimon or Tamer, this Digimon may digivolve into [AncientGreymon] in the hand for a digivolution cost of 3, ignoring its digivolution requirements. If digivolved by this effect, delete this Digimon at the end of the turn.";
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  67. }
  68. bool CanActivateCondition(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.IsExistOnBattleArea(card))
  71. {
  72. if (card.PermanentOfThisCard().DigivolutionCards.Count(cardSource =>
  73. cardSource.EqualsCardName("BurningGreymon")) >= 1)
  74. {
  75. return true;
  76. }
  77. if (card.Owner.HandCards.Count >= 1)
  78. {
  79. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card,
  80. permanent =>
  81. permanent.TopCard.CardColors.Contains(CardColor.Blue) ||
  82. permanent.TopCard.CardColors.Contains(CardColor.Green)))
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. return false;
  89. }
  90. IEnumerator ActivateCoroutine(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleArea(card))
  93. {
  94. Permanent thisPermanent = card.PermanentOfThisCard();
  95. yield return ContinuousController.instance.StartCoroutine(
  96. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  97. targetPermanent: thisPermanent,
  98. cardCondition: cardSource =>
  99. cardSource.IsDigimon && cardSource.EqualsCardName("AncientGreymon"),
  100. payCost: true,
  101. reduceCostTuple: null,
  102. fixedCostTuple: null,
  103. ignoreDigivolutionRequirementFixedCost: 3,
  104. isHand: true,
  105. activateClass: activateClass,
  106. successProcess: SuccessProcess()));
  107. IEnumerator SuccessProcess()
  108. {
  109. ActivateClass activateClass1 = new ActivateClass();
  110. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseSuccessCondition, card);
  111. activateClass1.SetUpActivateClass(CanActivateSuccessCondition, ActivateSuccessCoroutine, -1,
  112. false, "");
  113. activateClass1.SetEffectSourcePermanent(thisPermanent);
  114. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd,
  115. card: card, cardEffect: activateClass1, timing: EffectTiming.OnEndTurn);
  116. bool CanUseSuccessCondition(Hashtable successHashtable)
  117. {
  118. return true;
  119. }
  120. bool CanActivateSuccessCondition(Hashtable successHashtable)
  121. {
  122. if (thisPermanent.TopCard != null)
  123. {
  124. if (thisPermanent.TopCard.IsDigimon)
  125. {
  126. if (thisPermanent.CanBeDestroyedBySkill(activateClass1))
  127. {
  128. if (!thisPermanent.TopCard.CanNotBeAffected(activateClass1))
  129. {
  130. return true;
  131. }
  132. }
  133. }
  134. }
  135. return false;
  136. }
  137. IEnumerator ActivateSuccessCoroutine(Hashtable successHashtable)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(
  140. new DestroyPermanentsClass(new List<Permanent>() { thisPermanent },
  141. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  142. }
  143. yield return null;
  144. }
  145. }
  146. }
  147. }
  148. #endregion
  149. #region Your Turn - ESS
  150. if (timing == EffectTiming.None)
  151. {
  152. bool Condition()
  153. {
  154. if (CardEffectCommons.IsExistOnBattleArea(card))
  155. {
  156. if (CardEffectCommons.IsOwnerTurn(card))
  157. {
  158. return true;
  159. }
  160. }
  161. return false;
  162. }
  163. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true,
  164. card: card, condition: Condition));
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }