TigerVespamon_BT18_056.cs 10 KB

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