BT9_095.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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 BT9_095 : 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.None)
  14. {
  15. ChangeCostClass changeCostClass = new ChangeCostClass();
  16. changeCostClass.SetUpICardEffect($"Play Cost -2", CanUseCondition, card);
  17. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  18. cardEffects.Add(changeCostClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("XAntibody") || cardSource.CardNames.Contains("X Antibody")) >= 1))
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  28. {
  29. if (CardSourceCondition(cardSource))
  30. {
  31. if (RootCondition(root))
  32. {
  33. if (PermanentsCondition(targetPermanents))
  34. {
  35. Cost -= 2;
  36. }
  37. }
  38. }
  39. return Cost;
  40. }
  41. bool PermanentsCondition(List<Permanent> targetPermanents)
  42. {
  43. return true;
  44. }
  45. bool CardSourceCondition(CardSource cardSource)
  46. {
  47. return cardSource == card;
  48. }
  49. bool RootCondition(SelectCardEffect.Root root)
  50. {
  51. return true;
  52. }
  53. bool isUpDown()
  54. {
  55. return true;
  56. }
  57. }
  58. if (timing == EffectTiming.OptionSkill)
  59. {
  60. ActivateClass activateClass = new ActivateClass();
  61. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  62. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[Main] Delete 1 of your opponent's Digimon with 13000 DP or less. Then, 1 of your Digimon with [Greymon] in its name may attack your opponent.";
  67. }
  68. bool CanSelectPermanentCondition(Permanent permanent)
  69. {
  70. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  71. {
  72. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(13000, activateClass))
  73. {
  74. return true;
  75. }
  76. }
  77. return false;
  78. }
  79. bool CanSelectPermanentCondition1(Permanent permanent)
  80. {
  81. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  82. {
  83. if (permanent.TopCard.HasGreymonName)
  84. {
  85. if (permanent.CanAttack(activateClass))
  86. {
  87. if (permanent.CanAttackTargetDigimon(null, activateClass))
  88. {
  89. return true;
  90. }
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. Permanent selectedPermanent = null;
  103. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  104. {
  105. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. selectPermanentEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: CanSelectPermanentCondition,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: maxCount,
  113. canNoSelect: false,
  114. canEndNotMax: false,
  115. selectPermanentCoroutine: null,
  116. afterSelectPermanentCoroutine: null,
  117. mode: SelectPermanentEffect.Mode.Destroy,
  118. cardEffect: activateClass);
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. }
  121. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  122. {
  123. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  124. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  125. selectPermanentEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: CanSelectPermanentCondition1,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: maxCount,
  131. canNoSelect: true,
  132. canEndNotMax: false,
  133. selectPermanentCoroutine: SelectPermanentCoroutine,
  134. afterSelectPermanentCoroutine: null,
  135. mode: SelectPermanentEffect.Mode.Custom,
  136. cardEffect: activateClass);
  137. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "The opponent is selecting 1 Digimon that will attack.");
  138. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  139. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  140. {
  141. selectedPermanent = permanent;
  142. yield return null;
  143. }
  144. if (selectedPermanent != null)
  145. {
  146. if (selectedPermanent.CanAttack(activateClass))
  147. {
  148. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  149. selectAttackEffect.SetUp(
  150. attacker: selectedPermanent,
  151. canAttackPlayerCondition: () => true,
  152. defenderCondition: (permanent) => false,
  153. cardEffect: activateClass);
  154. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  155. }
  156. }
  157. }
  158. }
  159. }
  160. if (timing == EffectTiming.SecuritySkill)
  161. {
  162. ActivateClass activateClass = new ActivateClass();
  163. activateClass.SetUpICardEffect($"Delete 1 Digimon", CanUseCondition, card);
  164. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  165. activateClass.SetIsSecurityEffect(true);
  166. cardEffects.Add(activateClass);
  167. string EffectDiscription()
  168. {
  169. return "[Security] Delete 1 of your opponent's Digimon.";
  170. }
  171. bool CanSelectPermanentCondition(Permanent permanent)
  172. {
  173. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  174. }
  175. bool CanUseCondition(Hashtable hashtable)
  176. {
  177. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  178. }
  179. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  180. {
  181. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  182. {
  183. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  184. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  185. selectPermanentEffect.SetUp(
  186. selectPlayer: card.Owner,
  187. canTargetCondition: CanSelectPermanentCondition,
  188. canTargetCondition_ByPreSelecetedList: null,
  189. canEndSelectCondition: null,
  190. maxCount: maxCount,
  191. canNoSelect: false,
  192. canEndNotMax: false,
  193. selectPermanentCoroutine: null,
  194. afterSelectPermanentCoroutine: null,
  195. mode: SelectPermanentEffect.Mode.Destroy,
  196. cardEffect: activateClass);
  197. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  198. }
  199. }
  200. }
  201. return cardEffects;
  202. }
  203. }