BT16_070.cs 12 KB

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