BT17_016.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_016 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(
  16. "Delete 1 Digimon with 8000 DP or less, or get +3000 DP and [Blocker] until the end of your opponent's turn",
  17. CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  19. EffectDescription());
  20. cardEffects.Add(activateClass);
  21. string EffectDescription()
  22. {
  23. return
  24. "[When Digivolving] Delete 1 of your opponent's Digimon with 8000 DP or less. If this effect didn't delete, this Digimon gets +3000 DP and gains [Blocker] until the end of your opponent's turn.";
  25. }
  26. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  27. {
  28. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  29. {
  30. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  49. {
  50. int maxCount = Math.Min(1,
  51. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  52. SelectPermanentEffect selectPermanentEffect =
  53. GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectOpponentPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: null,
  63. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  64. mode: SelectPermanentEffect.Mode.Custom,
  65. cardEffect: activateClass);
  66. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  67. "The opponent is selecting 1 Digimon to delete.");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  70. {
  71. deleteTargetPermanents = permanents.Clone();
  72. yield return null;
  73. }
  74. }
  75. yield return ContinuousController.instance.StartCoroutine(
  76. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  77. targetPermanents: deleteTargetPermanents, activateClass: activateClass,
  78. successProcess: null, failureProcess: FailureProcess));
  79. IEnumerator FailureProcess()
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  82. targetPermanent: card.PermanentOfThisCard(),
  83. changeValue: 3000,
  84. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  85. activateClass: activateClass));
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  87. targetPermanent: card.PermanentOfThisCard(),
  88. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  89. activateClass: activateClass));
  90. }
  91. }
  92. }
  93. #endregion
  94. #region When Attacking
  95. if (timing == EffectTiming.OnAllyAttack)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect(
  99. "Delete 1 Digimon with 8000 DP or less, or get +3000 DP and [Blocker] until the end of your opponent's turn",
  100. CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  102. EffectDescription());
  103. cardEffects.Add(activateClass);
  104. string EffectDescription()
  105. {
  106. return
  107. "[When Attacking] Delete 1 of your opponent's Digimon with 8000 DP or less. If this effect didn't delete, this Digimon gets +3000 DP and gains [Blocker] until the end of your opponent's turn.";
  108. }
  109. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  110. {
  111. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  112. {
  113. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  114. {
  115. return true;
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanUseCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  123. }
  124. bool CanActivateCondition(Hashtable hashtable)
  125. {
  126. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable hashtable)
  129. {
  130. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  131. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  132. {
  133. int maxCount = Math.Min(1,
  134. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  135. SelectPermanentEffect selectPermanentEffect =
  136. GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: CanSelectOpponentPermanentCondition,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: maxCount,
  143. canNoSelect: false,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: null,
  146. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  147. mode: SelectPermanentEffect.Mode.Custom,
  148. cardEffect: activateClass);
  149. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  150. "The opponent is selecting 1 Digimon to delete.");
  151. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  152. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  153. {
  154. deleteTargetPermanents = permanents.Clone();
  155. yield return null;
  156. }
  157. }
  158. yield return ContinuousController.instance.StartCoroutine(
  159. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  160. targetPermanents: deleteTargetPermanents, activateClass: activateClass,
  161. successProcess: null, failureProcess: FailureProcess));
  162. IEnumerator FailureProcess()
  163. {
  164. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  165. targetPermanent: card.PermanentOfThisCard(),
  166. changeValue: 3000,
  167. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  168. activateClass: activateClass));
  169. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  170. targetPermanent: card.PermanentOfThisCard(),
  171. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  172. activateClass: activateClass));
  173. }
  174. }
  175. }
  176. #endregion
  177. #region Your Turn
  178. if (timing == EffectTiming.None)
  179. {
  180. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  181. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects", CanUseCondition, card);
  182. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  183. cardEffects.Add(canNotAffectedClass);
  184. bool CanUseCondition(Hashtable hashtable)
  185. {
  186. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  187. {
  188. if (CardEffectCommons.IsOwnerTurn(card))
  189. {
  190. if (card.Owner.MemoryForPlayer <= 0)
  191. {
  192. return true;
  193. }
  194. }
  195. }
  196. return false;
  197. }
  198. bool CardCondition(CardSource cardSource)
  199. {
  200. if (card == card.PermanentOfThisCard().TopCard)
  201. {
  202. if (cardSource == card)
  203. {
  204. return true;
  205. }
  206. }
  207. return false;
  208. }
  209. bool SkillCondition(ICardEffect cardEffect)
  210. {
  211. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  212. }
  213. }
  214. #endregion
  215. return cardEffects;
  216. }
  217. }
  218. }