BT19_087.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_087 : 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.OnStartTurn)
  11. {
  12. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  13. }
  14. #region All Turns
  15. if (timing == EffectTiming.BeforePayCost)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Can select DigiXros cards from Tamer's digivolution cards and from trash", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. activateClass.SetHashString("CanSelectDigiXrosFromTamer_EX4_062");
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[All Turns] When any of your [Composite] or [Twilight] trait Digimon with DigiXros requirements would be played, by suspending this Tamer, 1 card under your Tamers and 1 card in your trash can also be placed for their DigiXros.";
  25. }
  26. bool CardCondition(CardSource cardSource)
  27. {
  28. if (cardSource.Owner == card.Owner)
  29. {
  30. if (cardSource.IsDigimon)
  31. {
  32. if (cardSource.HasDigiXros)
  33. {
  34. if (cardSource.EqualsTraits("Composite"))
  35. {
  36. return true;
  37. }
  38. if (cardSource.CardTraits.Contains("Twilight"))
  39. {
  40. return true;
  41. }
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition))
  52. {
  53. if (CardEffectCommons.IsOnly1CardPlayed(hashtable))
  54. {
  55. return true;
  56. }
  57. }
  58. }
  59. return false;
  60. }
  61. bool CanActivateCondition(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.IsExistOnBattleArea(card))
  64. {
  65. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  66. {
  67. return true;
  68. }
  69. }
  70. return false;
  71. }
  72. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  73. {
  74. if (isExistOnField(card))
  75. {
  76. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  77. {
  78. Hashtable hashtable = new Hashtable();
  79. hashtable.Add("CardEffect", activateClass);
  80. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, hashtable).Tap());
  81. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  82. AddMaxUnderTamerCountDigiXrosClass addMaxTamerCountDigiXrosClass = new AddMaxUnderTamerCountDigiXrosClass();
  83. addMaxTamerCountDigiXrosClass.SetUpICardEffect("Can select DigiXros cards from Tamer's digivolution cards", CanUseCondition1, card);
  84. addMaxTamerCountDigiXrosClass.SetUpAddMaxUnderTamerCountDigiXrosClass(getMaxUnderTamerCount: GetCount);
  85. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => addMaxTamerCountDigiXrosClass);
  86. AddMaxTrashCountDigiXrosClass addMaxTrashCountDigiXrosClass = new AddMaxTrashCountDigiXrosClass();
  87. addMaxTrashCountDigiXrosClass.SetUpICardEffect("Can select DigiXros cards from trash", CanUseCondition1, card);
  88. addMaxTrashCountDigiXrosClass.SetUpAddMaxTrashCountDigiXrosClass(getMaxTrashCount: GetCount);
  89. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => addMaxTrashCountDigiXrosClass);
  90. bool CanUseCondition1(Hashtable hashtable)
  91. {
  92. return true;
  93. }
  94. int GetCount(CardSource cardSource)
  95. {
  96. if (CardSourceCondition(cardSource))
  97. {
  98. return 1;
  99. }
  100. return 0;
  101. }
  102. bool CardSourceCondition(CardSource cardSource)
  103. {
  104. if (cardSource != null)
  105. {
  106. if (cardSource.Owner == card.Owner)
  107. {
  108. if (cardSource.HasDigiXros)
  109. {
  110. return true;
  111. }
  112. }
  113. }
  114. return false;
  115. }
  116. }
  117. }
  118. }
  119. }
  120. #endregion
  121. if (timing == EffectTiming.SecuritySkill)
  122. {
  123. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  124. }
  125. return cardEffects;
  126. }
  127. }
  128. }