BT9_093.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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_093 : 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.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Delete 1 of your opponent's Digimon with 5000 DP or less. Then, you may digivolve 1 of your Digimon into a Digimon card with [Shoutmon] in its name in your hand for its digivolution cost.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanSelectPermanentCondition1(Permanent permanent)
  35. {
  36. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  37. {
  38. foreach (CardSource cardSource in card.Owner.HandCards)
  39. {
  40. if (CanSelectCardCondition(cardSource))
  41. {
  42. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. return cardSource.IsDigimon && cardSource.ContainsCardName("Shoutmon");
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  62. {
  63. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: CanSelectPermanentCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: null,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.Destroy,
  76. cardEffect: activateClass);
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  80. {
  81. Permanent selectedPermanent = null;
  82. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentCondition1,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: maxCount,
  90. canNoSelect: true,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. selectedPermanent = permanent;
  101. yield return null;
  102. }
  103. if (selectedPermanent != null)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  106. targetPermanent: selectedPermanent,
  107. cardCondition: CanSelectCardCondition,
  108. payCost: true,
  109. reduceCostTuple: null,
  110. fixedCostTuple: null,
  111. ignoreDigivolutionRequirementFixedCost: -1,
  112. isHand: true,
  113. activateClass: activateClass,
  114. successProcess: null));
  115. }
  116. }
  117. }
  118. }
  119. if (timing == EffectTiming.SecuritySkill)
  120. {
  121. ActivateClass activateClass = new ActivateClass();
  122. activateClass.SetUpICardEffect($"Delete 1 Digimon with 5000 DP or less", CanUseCondition, card);
  123. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  124. activateClass.SetIsSecurityEffect(true);
  125. cardEffects.Add(activateClass);
  126. string EffectDiscription()
  127. {
  128. return "[Security] Delete 1 of your opponent's Digimon with 5000 DP or less.";
  129. }
  130. bool CanSelectPermanentCondition(Permanent permanent)
  131. {
  132. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  133. {
  134. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass))
  135. {
  136. return true;
  137. }
  138. }
  139. return false;
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  146. {
  147. if (CardEffectCommons.HasMatchConditionPermanent(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. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  164. }
  165. }
  166. }
  167. return cardEffects;
  168. }
  169. }