BT22_066.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Raidenmon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_066 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5
  18. && targetPermanent.TopCard.HasDMTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Blast Digivolve
  30. if (timing == EffectTiming.OnCounterTiming)
  31. {
  32. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  33. }
  34. #endregion
  35. #region Blocker
  36. if (timing == EffectTiming.None)
  37. {
  38. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  39. }
  40. #endregion
  41. #region Collision
  42. if (timing == EffectTiming.OnCounterTiming)
  43. {
  44. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(false, card, null));
  45. }
  46. #endregion
  47. #region OP/WD Shared
  48. bool SharedDigimonCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  51. }
  52. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(SharedDigimonCondition))
  55. {
  56. #region Unsuspend Digimon
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(SharedDigimonCondition));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: SharedDigimonCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: null,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.UnTap,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend", "The opponent is selecting 1 Digimon to unsuspend");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. #endregion
  74. #region Suspend Digimon
  75. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect1.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: SharedDigimonCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: true,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: null,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Tap,
  87. cardEffect: activateClass);
  88. selectPermanentEffect1.SetUpCustomMessage("Select 1 digimon to suspend", "The opponent is selecting 1 Digimon to suspend");
  89. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  90. #endregion
  91. }
  92. }
  93. #endregion
  94. #region On Play
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Unsuspend 1 digimon, then suspend 1 digimon", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  100. cardEffects.Add(activateClass);
  101. string EffectDiscription()
  102. {
  103. return "[On Play] You may unsuspend 1 Digimon. Then, you may suspend 1 Digimon.";
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  108. }
  109. bool CanActivateCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  112. && CardEffectCommons.HasMatchConditionPermanent(SharedDigimonCondition);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable hashtable)
  115. {
  116. yield return SharedActivateCoroutine(hashtable, activateClass);
  117. }
  118. }
  119. #endregion
  120. #region When Digivolving
  121. if (timing == EffectTiming.OnEnterFieldAnyone)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Unsuspend 1 digimon, then suspend 1 digimon", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  126. cardEffects.Add(activateClass);
  127. string EffectDiscription()
  128. {
  129. return "[When Digivolving] You may unsuspend 1 Digimon. Then, you may suspend 1 Digimon.";
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  134. }
  135. bool CanActivateCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  138. && CardEffectCommons.HasMatchConditionPermanent(SharedDigimonCondition);
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable hashtable)
  141. {
  142. yield return SharedActivateCoroutine(hashtable, activateClass);
  143. }
  144. }
  145. #endregion
  146. #region All Turns
  147. if (timing == EffectTiming.OnTappedAnyone)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("De-Digivolve 1", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  152. activateClass.SetHashString("BT22_066_DeDigivolve");
  153. cardEffects.Add(activateClass);
  154. string EffectDiscription()
  155. {
  156. return "[All Turns] [Once Per Turn] When any of your [Ver.5] Digimon suspend, <De-Digivolve 1> 1 of your opponent's Digimon. (Trash the top card. You can't trash past level 3 cards.)";
  157. }
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. return CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsVer5);
  161. }
  162. bool CanActivateCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  165. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon);
  166. }
  167. bool IsVer5(Permanent permanent)
  168. {
  169. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  170. && permanent.TopCard.HasVer5Traits;
  171. }
  172. bool IsOpponentDigimon(Permanent permanent)
  173. {
  174. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  175. }
  176. IEnumerator ActivateCoroutine(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon))
  179. {
  180. Permanent selectedPermanent = null;
  181. #region Select Permanent
  182. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentDigimon));
  183. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  184. selectPermanentEffect.SetUp(
  185. selectPlayer: card.Owner,
  186. canTargetCondition: IsOpponentDigimon,
  187. canTargetCondition_ByPreSelecetedList: null,
  188. canEndSelectCondition: null,
  189. maxCount: maxCount,
  190. canNoSelect: false,
  191. canEndNotMax: false,
  192. selectPermanentCoroutine: SelectPermanentCoroutine,
  193. afterSelectPermanentCoroutine: null,
  194. mode: SelectPermanentEffect.Mode.Custom,
  195. cardEffect: activateClass);
  196. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  197. {
  198. selectedPermanent = permanent;
  199. yield return null;
  200. }
  201. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
  202. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  203. #endregion
  204. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(
  205. new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  206. }
  207. }
  208. }
  209. #endregion
  210. return cardEffects;
  211. }
  212. }
  213. }