ST13_03.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. public class ST13_03 : 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. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place this Digimon under your Digimon's digivolution cards to delete 1 Digimon with 5000 DP or less", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] By placing this Digimon under 1 of your other Digimon that's black or has [Legend-Arms] in its traits as its bottom digivolution card, delete 1 of your opponent's Digimon with 5000 DP or less.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent != card.PermanentOfThisCard())
  28. {
  29. if (!permanent.IsToken)
  30. {
  31. if (permanent.TopCard.CardTraits.Contains("Legend-Arms"))
  32. {
  33. return true;
  34. }
  35. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanSelectPermanentCondition1(Permanent permanent)
  45. {
  46. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  47. {
  48. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass))
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. if (CardEffectCommons.IsExistOnBattleArea(card))
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  64. {
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. bool added = false;
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectPermanentCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: SelectPermanentCoroutine,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  92. {
  93. Permanent selectedPermanent = permanent;
  94. if (selectedPermanent != null)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { card.PermanentOfThisCard(), selectedPermanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
  97. if (CardEffectCommons.IsExistOnBattleArea(card))
  98. {
  99. if (selectedPermanent.DigivolutionCards.Contains(card))
  100. {
  101. added = true;
  102. }
  103. }
  104. }
  105. }
  106. if (added)
  107. {
  108. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  109. selectPermanentEffect.SetUp(
  110. selectPlayer: card.Owner,
  111. canTargetCondition: CanSelectPermanentCondition1,
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. maxCount: maxCount,
  115. canNoSelect: false,
  116. canEndNotMax: false,
  117. selectPermanentCoroutine: null,
  118. afterSelectPermanentCoroutine: null,
  119. mode: SelectPermanentEffect.Mode.Destroy,
  120. cardEffect: activateClass);
  121. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  122. }
  123. }
  124. }
  125. }
  126. if (timing == EffectTiming.OnAllyAttack)
  127. {
  128. ActivateClass activateClass = new ActivateClass();
  129. activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  130. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  131. activateClass.SetIsInheritedEffect(true);
  132. cardEffects.Add(activateClass);
  133. string EffectDiscription()
  134. {
  135. return "[When Attacking] If you have a Digimon that's black or has [Legend-Arms] in its traits in play, delete 1 of your opponent's Digimon with 3000 DP or less.";
  136. }
  137. bool CanSelectPermanentCondition(Permanent permanent)
  138. {
  139. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  140. {
  141. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  142. {
  143. return true;
  144. }
  145. }
  146. return false;
  147. }
  148. bool CanUseCondition(Hashtable hashtable)
  149. {
  150. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.IsExistOnBattleArea(card))
  155. {
  156. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  157. {
  158. if (card.Owner.GetBattleAreaDigimons().Count(permanent => permanent.TopCard.CardTraits.Contains("Legend-Arms") || permanent.TopCard.CardColors.Contains(CardColor.Black)) >= 1)
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. return false;
  165. }
  166. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  167. {
  168. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  169. {
  170. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  171. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  172. selectPermanentEffect.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectPermanentCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: maxCount,
  178. canNoSelect: false,
  179. canEndNotMax: false,
  180. selectPermanentCoroutine: null,
  181. afterSelectPermanentCoroutine: null,
  182. mode: SelectPermanentEffect.Mode.Destroy,
  183. cardEffect: activateClass);
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. }
  186. }
  187. }
  188. return cardEffects;
  189. }
  190. }