BT13_101.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT13
  4. {
  5. public class BT13_101 : 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.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Play 1 Digimon card with [PawnChessmon] in its name from hand", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] You may play 1 Digimon card with [PawnChessmon] in its name from your hand without paying the cost.";
  19. }
  20. bool CanSelectCardCondition(CardSource cardSource)
  21. {
  22. if (cardSource.ContainsCardName("PawnChessmon"))
  23. {
  24. if (cardSource.IsDigimon)
  25. {
  26. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  27. {
  28. return true;
  29. }
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (card.Owner.HandCards.Count >= 1)
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. List<CardSource> selectedCards = new List<CardSource>();
  52. int maxCount = 1;
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectCardCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: true,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. selectCardCoroutine: SelectCardCoroutine,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  68. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  69. yield return StartCoroutine(selectHandEffect.Activate());
  70. IEnumerator SelectCardCoroutine(CardSource cardSource)
  71. {
  72. selectedCards.Add(cardSource);
  73. yield return null;
  74. }
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  76. }
  77. }
  78. if (timing == EffectTiming.OnEnterFieldAnyone)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("Draw 1 and Memory +1", CanUseCondition, card);
  82. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  83. cardEffects.Add(activateClass);
  84. string EffectDiscription()
  85. {
  86. return "[All Turns] When you play a 2-color black and yellow Digimon, by suspending this Tamer, <Draw 1> and gain 1 memory.";
  87. }
  88. bool PermanentCondition(Permanent permanent)
  89. {
  90. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  91. {
  92. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  93. {
  94. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  95. {
  96. if (permanent.TopCard.CardColors.Count == 2)
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  128. {
  129. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  130. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  131. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  132. }
  133. }
  134. if (timing == EffectTiming.SecuritySkill)
  135. {
  136. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  137. }
  138. return cardEffects;
  139. }
  140. }
  141. }