BT17_089.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT17
  4. {
  5. public class BT17_089 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Your Turn - When Effect Suspends
  11. if (timing == EffectTiming.OnTappedAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Suspend this Tamer", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Your turn] When an effect suspends one of your Digimon, you may suspend this Tamer.";
  20. }
  21. bool SuspendedCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. if (isExistOnField(card))
  28. {
  29. if (CardEffectCommons.IsOwnerTurn(card))
  30. {
  31. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, SuspendedCondition))
  32. {
  33. if (CardEffectCommons.IsByEffect(hashtable, null))
  34. {
  35. return !card.PermanentOfThisCard().IsSuspended;
  36. }
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. return isExistOnField(card);
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable hashtable)
  47. {
  48. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  49. }
  50. }
  51. #endregion
  52. #region Your Turn - When becomes suspended
  53. if (timing == EffectTiming.OnTappedAnyone)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("Memory +1, Draw 1", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  58. activateClass.SetHashString("SuspendSelf_BT17_089");
  59. cardEffects.Add(activateClass);
  60. string EffectDiscription()
  61. {
  62. return "[Your Turn] When this Tamer becomes suspended, gain 1 memory. Then, if you have [Argomon] or a yellow Digimon with [Agumon] or [Greymon] in its name, <Draw 1>.";
  63. }
  64. bool SuspendedCondition(Permanent permanent)
  65. {
  66. return permanent == card.PermanentOfThisCard();
  67. }
  68. bool HasDigimonCondition(Permanent permanent)
  69. {
  70. if (permanent.IsDigimon)
  71. {
  72. if (permanent.TopCard.EqualsCardName("Argomon"))
  73. {
  74. return true;
  75. }
  76. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  77. {
  78. if(permanent.TopCard.ContainsCardName("Agumon") || permanent.TopCard.HasGreymonName)
  79. {
  80. return true;
  81. }
  82. }
  83. }
  84. return false;
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. if (isExistOnField(card))
  89. {
  90. if (CardEffectCommons.IsOwnerTurn(card))
  91. {
  92. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, SuspendedCondition))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. return isExistOnField(card);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  107. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasDigimonCondition))
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  110. }
  111. }
  112. }
  113. #endregion
  114. #region Security Effect
  115. if (timing == EffectTiming.SecuritySkill)
  116. {
  117. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  118. }
  119. #endregion
  120. return cardEffects;
  121. }
  122. }
  123. }