BT16_019.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT16
  6. {
  7. public class BT16_019 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. var cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement, Blocker
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Patamon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  27. }
  28. #endregion
  29. #region On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Unsuspend 1 level 4 or lower Digimon", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] Unsuspend 1 of your level 4 or lower Digimon.";
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  43. {
  44. if (permanent.Level <= 4)
  45. {
  46. if (permanent.TopCard.HasLevel)
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: null,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.UnTap,
  84. cardEffect: activateClass);
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. }
  87. }
  88. #endregion
  89. #region When Digivolving
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Unsuspend 1 level 4 or lower Digimon", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[When Digivolving] Unsuspend 1 of your level 4 or lower Digimon.";
  99. }
  100. bool CanSelectPermanentCondition(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  103. {
  104. if (permanent.Level <= 4)
  105. {
  106. if (permanent.TopCard.HasLevel)
  107. {
  108. return true;
  109. }
  110. }
  111. }
  112. return false;
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: maxCount,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.UnTap,
  144. cardEffect: activateClass);
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. }
  147. }
  148. #endregion
  149. #region Inherited Effect
  150. if (timing == EffectTiming.OnAllyAttack)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect("Trash 1 digivolution card", CanUseCondition, card);
  154. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  155. EffectDiscription());
  156. activateClass.SetIsInheritedEffect(true);
  157. cardEffects.Add(activateClass);
  158. string EffectDiscription()
  159. {
  160. return "[When Attacking] Trash the top digivolution card of 1 of your opponent's Digimon.";
  161. }
  162. bool CanSelectPermanentCondition(Permanent permanent)
  163. {
  164. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  165. && permanent.DigivolutionCards.Count(cardSource =>
  166. !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1;
  167. }
  168. bool CanUseCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  171. }
  172. bool CanActivateCondition(Hashtable hashtable)
  173. {
  174. return CardEffectCommons.IsExistOnBattleArea(card) &&
  175. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  176. }
  177. IEnumerator ActivateCoroutine(Hashtable hashtable)
  178. {
  179. var maxCount = Math.Min(1,
  180. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  181. var selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  182. selectPermanentEffect.SetUp(
  183. selectPlayer: card.Owner,
  184. canTargetCondition: CanSelectPermanentCondition,
  185. canTargetCondition_ByPreSelecetedList: null,
  186. canEndSelectCondition: null,
  187. maxCount: maxCount,
  188. canNoSelect: false,
  189. canEndNotMax: false,
  190. selectPermanentCoroutine: SelectPermanentCoroutine,
  191. afterSelectPermanentCoroutine: null,
  192. mode: SelectPermanentEffect.Mode.Custom,
  193. cardEffect: activateClass);
  194. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.",
  195. "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  196. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  197. yield break;
  198. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  199. {
  200. yield return ContinuousController.instance.StartCoroutine(
  201. CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanent,
  202. trashCount: 1, isFromTop: true, activateClass: activateClass));
  203. }
  204. }
  205. }
  206. #endregion
  207. return cardEffects;
  208. }
  209. }
  210. }