ST21_08.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //st21-08 Togemon
  4. //Code largely copied from st20 birdramon, so if one has a problem, check the other to make sure it's not also there
  5. namespace DCGO.CardEffects.ST21
  6. {
  7. public class ST21_08 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasAdventureTraits && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On-Play/When-Digivolving Shared
  23. bool CanActivateCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. List<CardSource> tamerCards = new List<CardSource>();
  28. foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents())
  29. {
  30. if (permanent.IsTamer && permanent.TopCard.HasAdventureTraits)
  31. {
  32. tamerCards.Add(permanent.TopCard);
  33. }
  34. }
  35. return Combinations.GetDifferenetColorCardCount(tamerCards) >= 3;
  36. }
  37. return false;
  38. }
  39. #endregion
  40. #region On Play
  41. if (timing == EffectTiming.OnEnterFieldAnyone)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("If your Tamers with the [ADVENTURE] trait have 3 or more total colors, this Digimon may digivolve into a Digimon card with the [ADVENTURE] trait in the hand without paying the cost.", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[On Play] If your Tamers with the [ADVENTURE] trait have 3 or more total colors, this Digimon may digivolve into a Digimon card with the [ADVENTURE] trait in the hand without paying the cost.";
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  54. }
  55. bool CanDigivolveIntoCardCondition(CardSource cardSource)
  56. {
  57. return cardSource.IsDigimon && cardSource.HasAdventureTraits;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(
  62. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  63. targetPermanent: card.PermanentOfThisCard(),
  64. cardCondition: CanDigivolveIntoCardCondition,
  65. payCost: false,
  66. reduceCostTuple: null,
  67. fixedCostTuple: null,
  68. ignoreDigivolutionRequirementFixedCost: -1,
  69. isHand: true,
  70. activateClass: activateClass,
  71. successProcess: null));
  72. }
  73. }
  74. #endregion
  75. #region When Digivolving
  76. if (timing == EffectTiming.OnEnterFieldAnyone)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("If your Tamers with the [ADVENTURE] trait have 3 or more total colors, this Digimon may digivolve into a Digimon card with the [ADVENTURE] trait in the hand without paying the cost.", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[When Digivolving] If your Tamers with the [ADVENTURE] trait have 3 or more total colors, this Digimon may digivolve into a Digimon card with the [ADVENTURE] trait in the hand without paying the cost.";
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  89. }
  90. bool CanDigivolveIntoCardCondition(CardSource cardSource)
  91. {
  92. return cardSource.IsDigimon && cardSource.HasAdventureTraits;
  93. }
  94. IEnumerator ActivateCoroutine(Hashtable hashtable)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(
  97. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  98. targetPermanent: card.PermanentOfThisCard(),
  99. cardCondition: CanDigivolveIntoCardCondition,
  100. payCost: false,
  101. reduceCostTuple: null,
  102. fixedCostTuple: null,
  103. ignoreDigivolutionRequirementFixedCost: -1,
  104. isHand: true,
  105. activateClass: activateClass,
  106. successProcess: null));
  107. }
  108. }
  109. #endregion
  110. #region All Turn - ESS
  111. if (timing == EffectTiming.None)
  112. {
  113. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: null));
  114. }
  115. #endregion
  116. return cardEffects;
  117. }
  118. }
  119. }