EX4_037.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_037 : 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. if (targetPermanent.TopCard.ContainsCardName("Rapidmon") && targetPermanent.TopCard.HasLevel && targetPermanent.Level == 5)
  16. {
  17. return true;
  18. }
  19. if (targetPermanent.TopCard.CardColors.Contains(CardColor.Green) &&
  20. targetPermanent.TopCard.CardColors.Count == 2 && targetPermanent.TopCard.HasLevel &&
  21. targetPermanent.Level == 5)
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  28. }
  29. if (timing == EffectTiming.OnEndTurn)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Your Digimon gain Blocker and Reboot", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[End of Your Turn][Once Per Turn] Until the end of your opponent's turn, 2 of your green and black Digimon gain <Blocker> and <Reboot>.";
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  42. {
  43. if (permanent.CanSelectBySkill(activateClass))
  44. {
  45. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  46. {
  47. return true;
  48. }
  49. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  50. {
  51. return true;
  52. }
  53. }
  54. }
  55. return false;
  56. }
  57. bool CanUseCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleArea(card))
  60. {
  61. if (CardEffectCommons.IsOwnerTurn(card))
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. bool CanActivateCondition(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.IsExistOnBattleArea(card))
  71. {
  72. return true;
  73. }
  74. return false;
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  77. {
  78. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  79. {
  80. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectPermanentCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: maxCount,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectPermanentCoroutine,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon to gain Blocker and Reboot.", "The opponent is selecting 2 Digimon to gain Blocker and Reboot.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  99. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  100. }
  101. }
  102. }
  103. }
  104. if (timing == EffectTiming.OnTappedAnyone)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  109. activateClass.SetHashString("Unsuspend_EX4_037");
  110. cardEffects.Add(activateClass);
  111. string EffectDiscription()
  112. {
  113. return "[All Turns][Once Per Turn] When another Digimon becomes suspended, you may unsuspend this Digimon.";
  114. }
  115. bool PermanentCondition(Permanent permanent)
  116. {
  117. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  118. {
  119. if (permanent.IsDigimon)
  120. {
  121. if (permanent != card.PermanentOfThisCard())
  122. {
  123. return true;
  124. }
  125. }
  126. }
  127. return false;
  128. }
  129. bool CanUseCondition(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.IsExistOnBattleArea(card))
  132. {
  133. if (CardEffectCommons.IsOwnerTurn(card))
  134. {
  135. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  136. {
  137. return true;
  138. }
  139. }
  140. }
  141. return false;
  142. }
  143. bool CanActivateCondition(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.IsExistOnBattleArea(card))
  146. {
  147. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  148. {
  149. return true;
  150. }
  151. }
  152. return false;
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  155. {
  156. Permanent selectedPermanent = card.PermanentOfThisCard();
  157. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  158. }
  159. }
  160. return cardEffects;
  161. }
  162. }
  163. }