BT18_071.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT18
  6. {
  7. public class BT18_071 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.CardNames.Contains("Sephirothmon") && targetPermanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Mercurymon")) >= 1)
  18. {
  19. return true;
  20. }
  21. return false;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  24. permanentCondition: PermanentCondition,
  25. digivolutionCost: 4,
  26. ignoreDigivolutionRequirement: true,
  27. card: card,
  28. condition: null));
  29. }
  30. if (timing == EffectTiming.None)
  31. {
  32. bool PermanentCondition(Permanent targetPermanent)
  33. {
  34. if (targetPermanent.TopCard.CardNames.Contains("Seraphimon"))
  35. {
  36. return true;
  37. }
  38. return false;
  39. }
  40. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  41. permanentCondition: PermanentCondition,
  42. digivolutionCost: 1,
  43. ignoreDigivolutionRequirement: true,
  44. card: card,
  45. condition: null));
  46. }
  47. #endregion
  48. #region Blocker
  49. if (timing == EffectTiming.None)
  50. {
  51. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  52. }
  53. #endregion
  54. #region Counter Timing
  55. if (timing == EffectTiming.OnCounterTiming)
  56. {
  57. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  58. }
  59. #endregion
  60. #region On Play
  61. if (timing == EffectTiming.OnEnterFieldAnyone)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("De-Digivolve 3 on 1 Digimon", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. return "[On Play] Trigger <De-Digivolve 3> on 1 of your opponent's Digimon. (Trash up to 2 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.)";
  70. }
  71. bool CanSelectPermanentCondition(Permanent permanent)
  72. {
  73. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  91. {
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  93. {
  94. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectPermanentCondition,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCount,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: SelectPermanentCoroutine,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Custom,
  107. cardEffect: activateClass);
  108. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  111. {
  112. Permanent selectedPermanent = permanent;
  113. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 3, activateClass).Degeneration());
  114. }
  115. }
  116. }
  117. }
  118. #endregion
  119. #region When Digivolving
  120. if (timing == EffectTiming.OnEnterFieldAnyone)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect("De-Digivolve 3 on 1 Digimon", CanUseCondition, card);
  124. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  125. cardEffects.Add(activateClass);
  126. string EffectDiscription()
  127. {
  128. return "[When Digivolving] Trigger <De-Digivolve 3> on 1 of your opponent's Digimon. (Trash up to 2 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.)";
  129. }
  130. bool CanSelectPermanentCondition(Permanent permanent)
  131. {
  132. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  133. }
  134. bool CanUseCondition(Hashtable hashtable)
  135. {
  136. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  137. }
  138. bool CanActivateCondition(Hashtable hashtable)
  139. {
  140. if (CardEffectCommons.IsExistOnBattleArea(card))
  141. {
  142. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  143. {
  144. return true;
  145. }
  146. }
  147. return false;
  148. }
  149. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  150. {
  151. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  152. {
  153. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  154. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  155. selectPermanentEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectPermanentCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: SelectPermanentCoroutine,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.Custom,
  166. cardEffect: activateClass);
  167. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  168. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  169. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  170. {
  171. Permanent selectedPermanent = permanent;
  172. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 3, activateClass).Degeneration());
  173. }
  174. }
  175. }
  176. }
  177. #endregion
  178. #region All Turns
  179. if (timing == EffectTiming.OnAttackTargetChanged)
  180. {
  181. ActivateClass activateClass = new ActivateClass();
  182. activateClass.SetUpICardEffect("1 of your opponent's Digimon gets -5000 DP", CanUseCondition, card);
  183. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  184. activateClass.SetHashString("AllTurnDP_BT18-071");
  185. cardEffects.Add(activateClass);
  186. string EffectDiscription()
  187. {
  188. return "[All Turns][Once Per Turn] When an attack target is switched, 1 of your opponent's Digimon gets -5000 DP until the end of the turn.";
  189. }
  190. bool CanSelectPermanentCondition(Permanent permanent)
  191. {
  192. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  193. }
  194. bool CanUseCondition(Hashtable hashtable)
  195. {
  196. if (CardEffectCommons.IsExistOnBattleArea(card))
  197. {
  198. if (CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => true))
  199. {
  200. return true;
  201. }
  202. }
  203. return false;
  204. }
  205. bool CanActivateCondition(Hashtable hashtable)
  206. {
  207. if (CardEffectCommons.IsExistOnBattleArea(card))
  208. {
  209. return true;
  210. }
  211. return false;
  212. }
  213. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  214. {
  215. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  216. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  217. selectPermanentEffect.SetUp(
  218. selectPlayer: card.Owner,
  219. canTargetCondition: CanSelectPermanentCondition,
  220. canTargetCondition_ByPreSelecetedList: null,
  221. canEndSelectCondition: null,
  222. maxCount: maxCount,
  223. canNoSelect: false,
  224. canEndNotMax: false,
  225. selectPermanentCoroutine: SelectPermanentCoroutine,
  226. afterSelectPermanentCoroutine: null,
  227. mode: SelectPermanentEffect.Mode.Custom,
  228. cardEffect: activateClass);
  229. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeDP(changeValue: -5000, maxCount: maxCount));
  230. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  231. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  232. {
  233. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -5000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  234. }
  235. }
  236. }
  237. #endregion
  238. return cardEffects;
  239. }
  240. }
  241. }