BT14_013.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT14
  4. {
  5. public class BT14_013 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnStartMainPhase)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Reduce digivolution cost", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[Start of Your Main Phase] For the turn, when this Digimon would digivolve into a card with [Tyrannomon] in its name, or the [Dinosaur] or [Ceratopsian] trait, reduce the digivolution cost by 1.";
  19. }
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. if (CardEffectCommons.IsExistOnBattleArea(card))
  23. {
  24. if (CardEffectCommons.IsOwnerTurn(card))
  25. {
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleArea(card);
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. Permanent selectedPermanent = card.PermanentOfThisCard();
  40. if (selectedPermanent != null)
  41. {
  42. bool Condition()
  43. {
  44. return CardEffectCommons.IsExistOnBattleArea(card);
  45. }
  46. bool PermanentCondition(Permanent targetPermanent)
  47. {
  48. return targetPermanent == card.PermanentOfThisCard();
  49. }
  50. bool CardSourceCondition(CardSource cardSource)
  51. {
  52. if (cardSource.ContainsCardName("Tyrannomon"))
  53. {
  54. return true;
  55. }
  56. if (cardSource.CardTraits.Contains("Dinosaur"))
  57. {
  58. return true;
  59. }
  60. if (cardSource.CardTraits.Contains("Ceratopsian"))
  61. {
  62. return true;
  63. }
  64. return false;
  65. }
  66. ChangeCostClass changeCostClass = CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  67. changeValue: -1,
  68. permanentCondition: PermanentCondition,
  69. cardCondition: CardSourceCondition,
  70. rootCondition: null,
  71. isInheritedEffect: false,
  72. card: card,
  73. condition: Condition,
  74. setFixedCost: false);
  75. selectedPermanent.UntilEachTurnEndEffects.Add((_timing) => changeCostClass);
  76. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  77. }
  78. }
  79. }
  80. }
  81. if (timing == EffectTiming.OnEndTurn)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("This Digimon attacks", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  86. activateClass.SetIsInheritedEffect(true);
  87. activateClass.SetHashString("Attack_BT14_013");
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[End of Your Turn][Once Per Turn] If this Digimon has [Tyrannomon] in its name, or the [Dinosaur] or [Ceratopsian] trait, it may attack.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. if (CardEffectCommons.IsOwnerTurn(card))
  98. {
  99. return true;
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanActivateCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. if (card.PermanentOfThisCard().CanAttack(activateClass))
  109. {
  110. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Tyrannomon"))
  111. {
  112. return true;
  113. }
  114. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Dinosaur"))
  115. {
  116. return true;
  117. }
  118. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Ceratopsian"))
  119. {
  120. return true;
  121. }
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. if (card.PermanentOfThisCard().CanAttack(activateClass))
  131. {
  132. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  133. selectAttackEffect.SetUp(
  134. attacker: card.PermanentOfThisCard(),
  135. canAttackPlayerCondition: () => true,
  136. defenderCondition: (permanent) => true,
  137. cardEffect: activateClass);
  138. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  139. }
  140. }
  141. }
  142. }
  143. return cardEffects;
  144. }
  145. }
  146. }