BT15_101.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_101 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. //Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasGarurumonName && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #region Alternate Digivolution Condition
  22. if (timing == EffectTiming.None)
  23. {
  24. bool Condition()
  25. {
  26. bool PermanentCondition(Permanent permanent)
  27. {
  28. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  29. {
  30. if (permanent.IsTamer)
  31. {
  32. if (permanent.TopCard.ContainsCardName("Matt Ishida"))
  33. {
  34. return true;
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool PermanentCondition1(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  43. {
  44. if (permanent.DP >= 10000)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. if (card.Owner.HandCards.Contains(card))
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  54. {
  55. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition1))
  56. {
  57. return true;
  58. }
  59. }
  60. }
  61. return false;
  62. }
  63. bool PermanentCondition(Permanent targetPermanent)
  64. {
  65. if (CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent))
  66. {
  67. if (targetPermanent.TopCard.CardNames.Contains("Gabumon"))
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: true, card: card, condition: Condition));
  75. }
  76. #endregion
  77. //Evade
  78. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  79. {
  80. cardEffects.Add(CardEffectFactory.EvadeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  81. }
  82. #region When Digivolving
  83. if (timing == EffectTiming.OnEnterFieldAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("Opponent's 3 Digimon or Tamers can't suspend", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[When Digivolving] 3 of your opponent's Digimon and Tamers can't suspend until the end of their turn.";
  92. }
  93. bool CanSelectPermanentCondition(Permanent permanent)
  94. {
  95. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  96. {
  97. if (permanent.IsDigimon || permanent.IsTamer)
  98. {
  99. return true;
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  107. }
  108. bool CanActivateCondition(Hashtable hashtable)
  109. {
  110. if (CardEffectCommons.IsExistOnBattleArea(card))
  111. {
  112. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  120. {
  121. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  122. {
  123. int maxCount = Math.Min(3, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  124. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  125. selectPermanentEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: CanSelectPermanentCondition,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: maxCount,
  131. canNoSelect: false,
  132. canEndNotMax: false,
  133. selectPermanentCoroutine: SelectPermanentCoroutine,
  134. afterSelectPermanentCoroutine: null,
  135. mode: SelectPermanentEffect.Mode.Custom,
  136. cardEffect: activateClass);
  137. selectPermanentEffect.SetUpCustomMessage("Select Digimon or Tamers that will get unable to suspend.",
  138. "The opponent is selecting Digimon or Tamers that will get unable to suspend.");
  139. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  140. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  141. {
  142. Permanent selectedPermanent = permanent;
  143. if (selectedPermanent != null)
  144. {
  145. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  146. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  147. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  148. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  149. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  150. {
  151. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  152. }
  153. bool CanUseCondition1(Hashtable hashtable)
  154. {
  155. if (selectedPermanent.TopCard != null)
  156. {
  157. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  158. {
  159. return true;
  160. }
  161. }
  162. return false;
  163. }
  164. bool PermanentCondition(Permanent permanent)
  165. {
  166. if (permanent == selectedPermanent)
  167. {
  168. return true;
  169. }
  170. return false;
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. #endregion
  178. #region All Turns
  179. if (timing == EffectTiming.OnTappedAnyone)
  180. {
  181. ActivateClass activateClass = new ActivateClass();
  182. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  183. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  184. activateClass.SetHashString("Unsuspen_BT15_101");
  185. cardEffects.Add(activateClass);
  186. string EffectDiscription()
  187. {
  188. return "[All Turns] [Once Per Turn] When this Digimon becomes suspended, you may unsuspend it.";
  189. }
  190. bool CanUseCondition(Hashtable hashtable)
  191. {
  192. if (CardEffectCommons.IsExistOnBattleArea(card))
  193. {
  194. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  195. {
  196. return true;
  197. }
  198. }
  199. return false;
  200. }
  201. bool CanActivateCondition(Hashtable hashtable)
  202. {
  203. if (CardEffectCommons.IsExistOnBattleArea(card))
  204. {
  205. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  206. {
  207. return true;
  208. }
  209. }
  210. return false;
  211. }
  212. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  213. {
  214. Permanent selectedPermanent = card.PermanentOfThisCard();
  215. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  216. }
  217. }
  218. #endregion
  219. return cardEffects;
  220. }
  221. }
  222. }