BT20_017.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT20
  6. {
  7. //Regular Jesmon
  8. public class BT20_017 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. #region <OnPlay>
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Play a token", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] Play 1 [Atho, René & Por] Token. (Digimon/White/6000 DP/<Reboot>/<Blocker>/<Decoy Red/Black>)";
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return (CardEffectCommons.CanTriggerOnPlay(hashtable, card));
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  32. {
  33. if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable hashtable)
  41. {
  42. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayAthoRenePorToken(activateClass));
  43. }
  44. }
  45. #endregion
  46. #region <WhenDigivovling>
  47. {
  48. ActivateClass activateClass = new ActivateClass();
  49. activateClass.SetUpICardEffect("Play token", CanUseCondition, card);
  50. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  51. cardEffects.Add(activateClass);
  52. string EffectDiscription()
  53. {
  54. return "[When Digivolving] Play 1 [Atho, René & Por] Token. (Digimon/White/6000 DP/<Reboot> <Blocker> <Decoy Red/Black>)";
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card));
  59. }
  60. bool CanActivateCondition(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  63. {
  64. if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable hashtable)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayAthoRenePorToken(activateClass));
  74. }
  75. }
  76. #endregion
  77. }
  78. if (timing == EffectTiming.OnEnterFieldAnyone)
  79. {
  80. #region Your Turn
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("Delete 8k DP or less, Then 1 Digimon may attack.", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  84. activateClass.SetHashString("PlayLevel6_BT20_017");
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription ()
  87. {
  88. return "[Your Turn] [Once Per Turn] When any of your other Digimon are played, delete 1 of your opponent's Digimon with 8000 DP or less. Then, 1 of you Digimon may attack.";
  89. }
  90. bool PermanentCondition (Permanent permanent)
  91. {
  92. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  93. permanent != card.PermanentOfThisCard();
  94. }
  95. bool CanUseCondition (Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.IsExistOnBattleArea(card))
  98. {
  99. if (CardEffectCommons.IsOwnerTurn(card))
  100. {
  101. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. return false;
  108. }
  109. bool CanActivateCondition (Hashtable hashtable)
  110. {
  111. if (CardEffectCommons.IsExistOnBattleArea(card))
  112. {
  113. return true;
  114. }
  115. return false;
  116. }
  117. bool CanSelectDeletePermanentCondition (Permanent permanent)
  118. {
  119. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  120. {
  121. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. bool CanSelectAttackPermanentCondition (Permanent permanent)
  129. {
  130. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  131. {
  132. if (permanent.CanAttack(activateClass))
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. IEnumerator ActivateCoroutine (Hashtable hashtable)
  140. {
  141. List<Permanent> selectedPermanents = new List<Permanent>();
  142. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeletePermanentCondition))
  143. {
  144. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDeletePermanentCondition));
  145. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  146. selectPermanentEffect.SetUp(
  147. selectPlayer: card.Owner,
  148. canTargetCondition: CanSelectDeletePermanentCondition,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. maxCount: maxCount,
  152. canNoSelect: false,
  153. canEndNotMax: false,
  154. selectPermanentCoroutine: null,
  155. afterSelectPermanentCoroutine: null,
  156. mode: SelectPermanentEffect.Mode.Destroy,
  157. cardEffect: activateClass);
  158. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "Opponent is selecting one Digimon to delete.");
  159. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  160. }
  161. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectAttackPermanentCondition))
  162. {
  163. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectAttackPermanentCondition));
  164. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  165. selectPermanentEffect.SetUp(
  166. selectPlayer: card.Owner,
  167. canTargetCondition: CanSelectAttackPermanentCondition,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: maxCount,
  171. canNoSelect: true,
  172. canEndNotMax: false,
  173. selectPermanentCoroutine: null,
  174. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  175. mode: SelectPermanentEffect.Mode.Custom,
  176. cardEffect: activateClass);
  177. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "Opponent is selecting on Digimon that will attack.");
  178. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  179. IEnumerator AfterSelectPermanentCoroutine (List<Permanent> permanents)
  180. {
  181. selectedPermanents = permanents;
  182. yield return null;
  183. }
  184. foreach (Permanent permanent in selectedPermanents)
  185. {
  186. Permanent selectedPermanent = permanent;
  187. if (selectedPermanent != null)
  188. {
  189. if (selectedPermanent.CanAttack(activateClass))
  190. {
  191. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  192. selectAttackEffect.SetUp(
  193. attacker: selectedPermanent,
  194. canAttackPlayerCondition: () => true,
  195. defenderCondition: (permanent) => true,
  196. cardEffect: activateClass);
  197. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  198. }
  199. }
  200. }
  201. }
  202. }
  203. #endregion
  204. }
  205. return cardEffects;
  206. }
  207. }
  208. }