EX1_005.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX1
  5. {
  6. public class EX1_005 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Play 1 [Taiga] from hand", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] If you don't have a [Taiga] in play, you may play one from your hand without paying its memory cost.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.CardNames.Contains("Taiga"))
  24. {
  25. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (card.Owner.HandCards.Count >= 1)
  41. {
  42. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardNames.Contains("Taiga")) == 0)
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  53. {
  54. List<CardSource> selectedCards = new List<CardSource>();
  55. int maxCount = 1;
  56. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  57. selectHandEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectCardCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: true,
  64. canEndNotMax: false,
  65. isShowOpponent: true,
  66. selectCardCoroutine: SelectCardCoroutine,
  67. afterSelectCardCoroutine: null,
  68. mode: SelectHandEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  71. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  72. yield return StartCoroutine(selectHandEffect.Activate());
  73. IEnumerator SelectCardCoroutine(CardSource cardSource)
  74. {
  75. selectedCards.Add(cardSource);
  76. yield return null;
  77. }
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  79. cardSources: selectedCards,
  80. activateClass: activateClass,
  81. payCost: false,
  82. isTapped: false,
  83. root: SelectCardEffect.Root.Hand,
  84. activateETB: true));
  85. }
  86. }
  87. }
  88. if (timing == EffectTiming.None)
  89. {
  90. ChangeCardColorClass changeCardColorClass = new ChangeCardColorClass();
  91. changeCardColorClass.SetUpICardEffect($"Also treated as green", CanUseCondition, card);
  92. changeCardColorClass.SetUpChangeCardColorClass(ChangeCardColors: ChangeCardColors);
  93. cardEffects.Add(changeCardColorClass);
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.IsExistOnBattleArea(card))
  97. {
  98. if (CardEffectCommons.IsOwnerTurn(card))
  99. {
  100. return true;
  101. }
  102. }
  103. return false;
  104. }
  105. List<CardColor> ChangeCardColors(CardSource cardSource, List<CardColor> CardColors)
  106. {
  107. if (cardSource == card)
  108. {
  109. CardColors.Add(CardColor.Green);
  110. }
  111. return CardColors;
  112. }
  113. }
  114. if (timing == EffectTiming.None)
  115. {
  116. bool Condition()
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (CardEffectCommons.IsOwnerTurn(card))
  121. {
  122. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Tyrannomon"))
  123. {
  124. return true;
  125. }
  126. }
  127. }
  128. return false;
  129. }
  130. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  131. changeValue: 2000,
  132. isInheritedEffect: true,
  133. card: card,
  134. condition: Condition));
  135. }
  136. return cardEffects;
  137. }
  138. }
  139. }