EX6_049.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.EX6
  9. {
  10. public class EX6_049 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region On Play
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Delete 1 opponent level 3 Digimon / Opponent trashes 1 card in hand", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Play] If your opponent has 5 or fewer cards in their hand, delete 1 of your opponent's level 3 Digimon. If your opponent has 7 or more cards in their hand, your opponent trashes 1 card in their hand.";
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
  29. }
  30. bool CanSelectPermanentCondition(Permanent permanent)
  31. {
  32. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent,card))
  33. {
  34. if(permanent.Level <= 3)
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if(CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (card.Owner.Enemy.HandCards.Count <= 5)
  46. {
  47. return true;
  48. }
  49. if (card.Owner.Enemy.HandCards.Count >= 7)
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable hashtable)
  57. {
  58. if(card.Owner.Enemy.HandCards.Count <= 5)
  59. {
  60. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  61. {
  62. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Destroy,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. }
  80. if (card.Owner.Enemy.HandCards.Count >= 7)
  81. {
  82. int discardCount = 1;
  83. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  84. selectHandEffect.SetUp(
  85. selectPlayer: card.Owner.Enemy,
  86. canTargetCondition: (cardSource) => true,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: discardCount,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. isShowOpponent: true,
  93. selectCardCoroutine: null,
  94. afterSelectCardCoroutine: null,
  95. mode: SelectHandEffect.Mode.Discard,
  96. cardEffect: activateClass);
  97. yield return StartCoroutine(selectHandEffect.Activate());
  98. }
  99. }
  100. }
  101. #endregion
  102. #region When Digivolving
  103. if (timing == EffectTiming.OnEnterFieldAnyone)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect("Delete 1 opponent level 3 Digimon / Opponent trashes 1 card in hand", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  108. cardEffects.Add(activateClass);
  109. string EffectDiscription()
  110. {
  111. return "[When Digivolving] If your opponent has 5 or fewer cards in their hand, delete 1 of your opponent's level 3 Digimon. If your opponent has 7 or more cards in their hand, your opponent trashes 1 card in their hand.";
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  116. }
  117. bool CanSelectPermanentCondition(Permanent permanent)
  118. {
  119. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  120. {
  121. if (permanent.Level <= 3)
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleArea(card))
  131. {
  132. if (card.Owner.Enemy.HandCards.Count <= 5)
  133. {
  134. return true;
  135. }
  136. if (card.Owner.Enemy.HandCards.Count >= 7)
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. IEnumerator ActivateCoroutine(Hashtable hashtable)
  144. {
  145. if (card.Owner.Enemy.HandCards.Count <= 5)
  146. {
  147. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  148. {
  149. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  150. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  151. selectPermanentEffect.SetUp(
  152. selectPlayer: card.Owner,
  153. canTargetCondition: CanSelectPermanentCondition,
  154. canTargetCondition_ByPreSelecetedList: null,
  155. canEndSelectCondition: null,
  156. maxCount: maxCount,
  157. canNoSelect: false,
  158. canEndNotMax: false,
  159. selectPermanentCoroutine: null,
  160. afterSelectPermanentCoroutine: null,
  161. mode: SelectPermanentEffect.Mode.Destroy,
  162. cardEffect: activateClass);
  163. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  164. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  165. }
  166. }
  167. if (card.Owner.Enemy.HandCards.Count >= 7)
  168. {
  169. int discardCount = 1;
  170. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  171. selectHandEffect.SetUp(
  172. selectPlayer: card.Owner.Enemy,
  173. canTargetCondition: (cardSource) => true,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: discardCount,
  177. canNoSelect: false,
  178. canEndNotMax: false,
  179. isShowOpponent: true,
  180. selectCardCoroutine: null,
  181. afterSelectCardCoroutine: null,
  182. mode: SelectHandEffect.Mode.Discard,
  183. cardEffect: activateClass);
  184. yield return StartCoroutine(selectHandEffect.Activate());
  185. }
  186. }
  187. }
  188. #endregion
  189. #region Inherit
  190. if (timing == EffectTiming.None)
  191. {
  192. bool Condition()
  193. {
  194. if (CardEffectCommons.IsExistOnBattleArea(card))
  195. {
  196. if (card.Owner.Enemy.HandCards.Count <= 6)
  197. {
  198. return true;
  199. }
  200. }
  201. return false;
  202. }
  203. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  204. }
  205. #endregion
  206. return cardEffects;
  207. }
  208. }
  209. }