Zephagamon_ST18_12.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class Zephagamon_ST18_12 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Vortex
  11. if (timing == EffectTiming.OnEndTurn)
  12. {
  13. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card,
  14. condition: null));
  15. }
  16. #endregion
  17. #region When Digivolving
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Suspend 1 Digimon, unsuspend 1 Digimon", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  23. cardEffects.Add(activateClass);
  24. string EffectDescription()
  25. {
  26. return
  27. "[When Digivolving] Suspend 1 Digimon. Then, unsuspend 1 Digimon.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  40. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  45. selectPermanentEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: permanent => CanSelectPermanentCondition(permanent) && permanent.CanSuspend,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: 1,
  51. canNoSelect: false,
  52. canEndNotMax: false,
  53. selectPermanentCoroutine: null,
  54. afterSelectPermanentCoroutine: null,
  55. mode: SelectPermanentEffect.Mode.Tap,
  56. cardEffect: activateClass);
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: permanent => CanSelectPermanentCondition(permanent) && permanent.CanUnsuspend,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: 1,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: null,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.UnTap,
  69. cardEffect: activateClass);
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. }
  72. }
  73. #endregion
  74. #region All Turns
  75. if (timing == EffectTiming.OnUnTappedAnyone)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("Become unaffected by Digimon's effects, gain DP.", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  80. activateClass.SetHashString("Immunity_ST18_12");
  81. cardEffects.Add(activateClass);
  82. string EffectDescription()
  83. {
  84. return
  85. "[All Turns] (Once Per Turn) When a Digimon is unsuspended, this Digimon is unaffected by your opponent's Digimon's effects, and gets +3000 DP for the turn.";
  86. }
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.IsExistOnBattleArea(card) &&
  90. CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, permanent => permanent.IsDigimon);
  91. }
  92. bool CanActivateCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  95. }
  96. IEnumerator ActivateCoroutine(Hashtable hashtable)
  97. {
  98. Permanent permanentOfThisCard = card.PermanentOfThisCard();
  99. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  100. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects",
  101. CanUseConditionImmunity, card);
  102. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition,
  103. SkillCondition: SkillCondition);
  104. permanentOfThisCard.UntilOpponentTurnEndEffects.Add(GetCardEffect);
  105. bool CanUseConditionImmunity(Hashtable hashtableImmunity)
  106. {
  107. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanentOfThisCard, card);
  108. }
  109. bool CardCondition(CardSource cardSource)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanentOfThisCard) &&
  112. cardSource == permanentOfThisCard.TopCard;
  113. }
  114. bool SkillCondition(ICardEffect cardEffect)
  115. {
  116. return CardEffectCommons.IsOpponentEffect(cardEffect, card) &&
  117. cardEffect.IsDigimonEffect;
  118. }
  119. ICardEffect GetCardEffect(EffectTiming timingImmunity)
  120. {
  121. return timingImmunity == EffectTiming.None ? canNotAffectedClass : null;
  122. }
  123. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  124. targetPermanent: permanentOfThisCard,
  125. changeValue: 3000,
  126. effectDuration: EffectDuration.UntilEachTurnEnd,
  127. activateClass: activateClass));
  128. }
  129. }
  130. #endregion
  131. return cardEffects;
  132. }
  133. }
  134. }