BT18_056.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT18
  6. {
  7. public class BT18_056 : 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. return targetPermanent.TopCard.IsLevel5 &&
  18. targetPermanent.TopCard.EqualsTraits("Royal Base");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  22. card: card, condition: null));
  23. }
  24. #endregion
  25. #region Piercing/Reboot
  26. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  27. {
  28. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  29. }
  30. if (timing == EffectTiming.None)
  31. {
  32. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  33. }
  34. #endregion
  35. #region On Play/When Digivolving Shared
  36. bool IsOpponenetsDigimon(Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  39. }
  40. #endregion
  41. #region On Play
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Suspend 1 for each face up security, Then opponents Digimon can't unsuspend", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  47. cardEffects.Add(activateClass);
  48. string EffectDiscription()
  49. {
  50. return "[On Play] For each of your face up security cards, suspend 1 of your opponent's Digimon. Then, none of their Digimon can unsuspend until the end of their turn.";
  51. }
  52. bool PermanentCondition(Permanent permanent)
  53. {
  54. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  55. {
  56. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. bool CanUseCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable hashtable)
  72. {
  73. int maxCount = card.Owner.SecurityCards.Count(cardSource => !cardSource.IsFlipped);
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: IsOpponenetsDigimon,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: null,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Tap,
  86. cardEffect: activateClass);
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  89. permanentCondition: PermanentCondition,
  90. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  91. activateClass: activateClass,
  92. isOnlyActivePhase: false,
  93. effectName: "Your Digimon can't unsuspend"));
  94. }
  95. }
  96. #endregion
  97. #region When Digivolving
  98. if (timing == EffectTiming.OnEnterFieldAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect("Suspend 1 for each face up security, Then opponents Digimon can't unsuspend", CanUseCondition, card);
  102. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  103. cardEffects.Add(activateClass);
  104. string EffectDiscription()
  105. {
  106. return "[When Digivolving] For each of your face up security cards, suspend 1 of your opponent's Digimon. Then, none of their Digimon can unsuspend until the end of their turn.";
  107. }
  108. bool PermanentCondition(Permanent permanent)
  109. {
  110. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  111. {
  112. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. int maxCount = card.Owner.SecurityCards.Count(cardSource => !cardSource.IsFlipped);
  130. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  131. selectPermanentEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: IsOpponenetsDigimon,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. selectPermanentCoroutine: null,
  140. afterSelectPermanentCoroutine: null,
  141. mode: SelectPermanentEffect.Mode.Tap,
  142. cardEffect: activateClass);
  143. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  144. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  145. permanentCondition: PermanentCondition,
  146. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  147. activateClass: activateClass,
  148. isOnlyActivePhase: false,
  149. effectName: "Your Digimon can't unsuspend"));
  150. }
  151. }
  152. #endregion
  153. #region All Turns
  154. if (timing == EffectTiming.OnDestroyedAnyone)
  155. {
  156. ActivateClass activateClass = new ActivateClass();
  157. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  158. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  159. activateClass.SetHashString("BT18_056_Unsuspend");
  160. cardEffects.Add(activateClass);
  161. string EffectDescription()
  162. {
  163. return "[All Turns] [Once Per Turn] When other Digimon are deleted in battle, this Digimon may unsuspend.";
  164. }
  165. bool PermanentCondition(Permanent permanent)
  166. {
  167. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) &&
  168. permanent.IsDigimon &&
  169. permanent != card.PermanentOfThisCard();
  170. }
  171. bool CanUseCondition(Hashtable hashtable)
  172. {
  173. return CardEffectCommons.IsExistOnBattleArea(card) &&
  174. CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition) &&
  175. CardEffectCommons.IsByBattle(hashtable);
  176. }
  177. bool CanActivateCondition(Hashtable hashtable)
  178. {
  179. return CardEffectCommons.IsExistOnBattleArea(card) &&
  180. CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()) &&
  181. CardEffectCommons.GetHashtablesFromHashtable(hashtable) is { Count: >= 1 };
  182. }
  183. IEnumerator ActivateCoroutine(Hashtable hashtable)
  184. {
  185. yield return ContinuousController.instance.StartCoroutine(
  186. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }