BT12_062.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_062 : 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.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.ContainsCardName("Agumon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Play 1 Tamer with [Tai Kamiya] in its name from hand", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Digivolving] If you don't have a Tamer with [Tai Kamiya] in its name in play, you may play 1 Tamer card with [Tai Kamiya] in its name from your hand without paying its cost.";
  28. }
  29. bool CanSelectCardCondition(CardSource cardSource)
  30. {
  31. if (cardSource != null)
  32. {
  33. if (cardSource.ContainsCardName("Tai Kamiya"))
  34. {
  35. if (cardSource.Owner == card.Owner)
  36. {
  37. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (card.Owner.HandCards.Count >= 1)
  55. {
  56. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.ContainsCardName("Tai Kamiya")) == 0)
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  65. {
  66. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  67. {
  68. List<CardSource> selectedCards = new List<CardSource>();
  69. int maxCount = 1;
  70. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  71. selectHandEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectCardCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: true,
  78. canEndNotMax: false,
  79. isShowOpponent: true,
  80. selectCardCoroutine: SelectCardCoroutine,
  81. afterSelectCardCoroutine: null,
  82. mode: SelectHandEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  85. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  86. yield return StartCoroutine(selectHandEffect.Activate());
  87. IEnumerator SelectCardCoroutine(CardSource cardSource)
  88. {
  89. selectedCards.Add(cardSource);
  90. yield return null;
  91. }
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  93. }
  94. }
  95. }
  96. if (timing == EffectTiming.None)
  97. {
  98. bool Condition()
  99. {
  100. if (CardEffectCommons.IsExistOnBattleArea(card))
  101. {
  102. if (card.PermanentOfThisCard().TopCard.HasGreymonName)
  103. {
  104. return true;
  105. }
  106. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Omnimon"))
  107. {
  108. return true;
  109. }
  110. }
  111. return false;
  112. }
  113. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  114. }
  115. return cardEffects;
  116. }
  117. }
  118. }