BT18_047.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Arbormon
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_047 : 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 Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Petaldramon");
  17. }
  18. static bool TamerCondition(Permanent targetPermanent)
  19. {
  20. return targetPermanent.TopCard.CardColors.Contains(CardColor.Green) &&
  21. targetPermanent.IsTamer;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: true, card: card, condition: null));
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: TamerCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: true, card: card, condition: null));
  25. }
  26. #endregion
  27. #region On Play/When Digivolving Shared
  28. bool YourGreenDigimon(Permanent permanent)
  29. {
  30. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  31. return !permanent.IsSuspended &&
  32. permanent.TopCard.CardColors.Contains(CardColor.Green) &&
  33. permanent.CanSuspend;
  34. return false;
  35. }
  36. bool OpponentsDigimonOrTamer(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  39. return permanent.TopCard.IsDigimon || permanent.TopCard.IsTamer;
  40. return false;
  41. }
  42. #endregion
  43. #region On Play
  44. if (timing == EffectTiming.OnEnterFieldAnyone)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("By suspending 1 of your digimon, suspend 1 of your opponents digimon/tamers", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[On Play] By suspending 1 of your green Digimon, suspend 1 of your opponent's Digimon or Tamers.";
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  57. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  58. return false;
  59. }
  60. bool CanActivateCondition(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  63. return CardEffectCommons.HasMatchConditionPermanent(YourGreenDigimon);
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable hashtable)
  67. {
  68. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  69. selectPermanentEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: YourGreenDigimon,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: 1,
  75. canNoSelect: false,
  76. canEndNotMax: false,
  77. selectPermanentCoroutine: null,
  78. afterSelectPermanentCoroutine: null,
  79. mode: SelectPermanentEffect.Mode.Tap,
  80. cardEffect: activateClass);
  81. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  82. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  83. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimonOrTamer))
  84. {
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: OpponentsDigimonOrTamer,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: 1,
  91. canNoSelect: false,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: null,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.Tap,
  96. cardEffect: activateClass);
  97. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer to suspend.", "The opponent is selecting 1 Digimon/Tamer to suspend.");
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. }
  100. }
  101. }
  102. #endregion
  103. #region When Digivolving
  104. if (timing == EffectTiming.OnEnterFieldAnyone)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("By suspending 1 of your digimon, suspend 1 of your opponents digimon/tamers", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  109. cardEffects.Add(activateClass);
  110. string EffectDiscription()
  111. {
  112. return "[When Digivolving] By suspending 1 of your green Digimon, suspend 1 of your opponent's Digimon or Tamers.";
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  117. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  118. return false;
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  123. return CardEffectCommons.HasMatchConditionPermanent(YourGreenDigimon);
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable hashtable)
  127. {
  128. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  129. selectPermanentEffect.SetUp(
  130. selectPlayer: card.Owner,
  131. canTargetCondition: YourGreenDigimon,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. maxCount: 1,
  135. canNoSelect: false,
  136. canEndNotMax: false,
  137. selectPermanentCoroutine: null,
  138. afterSelectPermanentCoroutine: null,
  139. mode: SelectPermanentEffect.Mode.Tap,
  140. cardEffect: activateClass);
  141. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  142. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  143. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimonOrTamer))
  144. {
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: OpponentsDigimonOrTamer,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: 1,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: null,
  154. afterSelectPermanentCoroutine: null,
  155. mode: SelectPermanentEffect.Mode.Tap,
  156. cardEffect: activateClass);
  157. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer to suspend.", "The opponent is selecting 1 Digimon/Tamer to suspend.");
  158. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  159. }
  160. }
  161. }
  162. #endregion
  163. #region When Attacking - ESS
  164. if (timing == EffectTiming.OnAllyAttack)
  165. {
  166. ActivateClass activateClass = new ActivateClass();
  167. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon", CanUseCondition, card);
  168. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  169. activateClass.SetHashString("Suspend_BT18_047");
  170. activateClass.SetIsInheritedEffect(true);
  171. cardEffects.Add(activateClass);
  172. string EffectDiscription()
  173. {
  174. return "[When Attacking] [Once Per Turn] Suspend 1 of your opponent's Digimon.";
  175. }
  176. bool IsOpponentDigimon(Permanent permanent)
  177. {
  178. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  179. }
  180. bool CanUseCondition(Hashtable hashtable)
  181. {
  182. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  183. }
  184. bool CanActivateCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  187. }
  188. IEnumerator ActivateCoroutine(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon))
  191. {
  192. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  193. selectPermanentEffect.SetUp(
  194. selectPlayer: card.Owner,
  195. canTargetCondition: IsOpponentDigimon,
  196. canTargetCondition_ByPreSelecetedList: null,
  197. canEndSelectCondition: null,
  198. maxCount: 1,
  199. canNoSelect: false,
  200. canEndNotMax: false,
  201. selectPermanentCoroutine: null,
  202. afterSelectPermanentCoroutine: null,
  203. mode: SelectPermanentEffect.Mode.Tap,
  204. cardEffect: activateClass);
  205. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  206. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  207. }
  208. }
  209. }
  210. #endregion
  211. return cardEffects;
  212. }
  213. }
  214. }