EX7_022.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_022 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.HasLevel && targetPermanent.Level == 4)
  18. return targetPermanent.TopCard.CardTraits.Contains("NSp");
  19. return false;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition,
  23. digivolutionCost: 3,
  24. ignoreDigivolutionRequirement: false,
  25. card: card,
  26. condition: null)
  27. );
  28. }
  29. #endregion
  30. #region On Play
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Opponent's 1 Digimon or Tamer can't suspend", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  36. cardEffects.Add(activateClass);
  37. string EffectDescription()
  38. {
  39. return "[On Play] 1 of your opponent's Digimon or Tamers can't suspend until the end of their turn.";
  40. }
  41. bool CanSelectPermanentCondition(Permanent permanent)
  42. {
  43. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  44. {
  45. if(permanent.IsDigimon || permanent.IsTamer)
  46. return true;
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  53. {
  54. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  55. }
  56. return false;
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable hashtable)
  70. {
  71. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  72. {
  73. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will be unable to suspend.",
  88. "The opponent is selecting 1 Digimon that will get unable to suspend.");
  89. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  90. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  91. {
  92. Permanent selectedPermanent = permanent;
  93. if (selectedPermanent != null)
  94. {
  95. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  96. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  97. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  98. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  99. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
  102. .CreateDebuffEffect(selectedPermanent));
  103. }
  104. bool CanUseCondition1(Hashtable hashtableDebuff)
  105. {
  106. if (selectedPermanent.TopCard != null)
  107. {
  108. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. bool PermanentCondition(Permanent permanentDebuff)
  116. {
  117. if (permanentDebuff == selectedPermanent)
  118. {
  119. return true;
  120. }
  121. return false;
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. #endregion
  129. #region Owner's Turn Effect
  130. if (timing == EffectTiming.None)
  131. {
  132. CanNotSwitchAttackTargetClass canNotSwitchAttackTargetClass = new CanNotSwitchAttackTargetClass();
  133. canNotSwitchAttackTargetClass.SetUpICardEffect(
  134. "All of your Digimon with the [NSp] trait can't have their attack targets switched.", CanUseCondition, card);
  135. canNotSwitchAttackTargetClass.SetUpCanNotSwitchAttackTargetClass(PermanentCondition: PermanentCondition);
  136. cardEffects.Add(canNotSwitchAttackTargetClass);
  137. bool CanUseCondition(Hashtable hashtable)
  138. {
  139. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  140. CardEffectCommons.IsOwnerTurn(card);
  141. }
  142. bool PermanentCondition(Permanent permanent)
  143. {
  144. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  145. permanent.TopCard.ContainsTraits("NSp");
  146. }
  147. }
  148. #endregion
  149. return cardEffects;
  150. }
  151. }
  152. }