BT5_112.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 BT5_112 : 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. DontBattleSecurityDigimonClass dontBattleSecurityDigimonClass = new DontBattleSecurityDigimonClass();
  16. dontBattleSecurityDigimonClass.SetUpICardEffect("Ignore Battle", CanUseCondition, card);
  17. dontBattleSecurityDigimonClass.SetUpDontBattleSecurityDigimonClass(CardSourceCondition: CardSourceCondition);
  18. dontBattleSecurityDigimonClass.SetIsSecurityEffect(true);
  19. dontBattleSecurityDigimonClass.SetNotShowUI(true);
  20. cardEffects.Add(dontBattleSecurityDigimonClass);
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanUseIgnoreBattle(hashtable, card);
  24. }
  25. bool CardSourceCondition(CardSource cardSource)
  26. {
  27. return cardSource == card;
  28. }
  29. }
  30. if (timing == EffectTiming.SecuritySkill)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Play this card without battling", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. activateClass.SetIsSecurityEffect(true);
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[Security] Play this card without battling and without paying its memory cost.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (card.Owner.ExecutingCards.Contains(card))
  48. {
  49. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: activateClass))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { card }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Execution, activateETB: true));
  59. }
  60. }
  61. if (timing == EffectTiming.OnEnterFieldAnyone)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("Delete 1 Tamer", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. return "[When Digivolving] Delete 1 of your opponent's Tamers.";
  70. }
  71. bool CanSelectPermanentCondition(Permanent permanent)
  72. {
  73. if (permanent != null)
  74. {
  75. if (permanent.TopCard != null)
  76. {
  77. if (permanent.IsTamer)
  78. {
  79. if (permanent.TopCard.Owner == card.Owner.Enemy)
  80. {
  81. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. }
  88. }
  89. return false;
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  94. }
  95. bool CanActivateCondition(Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.IsExistOnBattleArea(card))
  98. {
  99. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  100. {
  101. return true;
  102. }
  103. }
  104. return false;
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  107. {
  108. if (isExistOnField(card))
  109. {
  110. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  111. {
  112. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  113. {
  114. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. selectPermanentEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: CanSelectPermanentCondition,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: maxCount,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. selectPermanentCoroutine: null,
  125. afterSelectPermanentCoroutine: null,
  126. mode: SelectPermanentEffect.Mode.Destroy,
  127. cardEffect: activateClass);
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. }
  130. }
  131. }
  132. }
  133. }
  134. if (timing == EffectTiming.OnDestroyedAnyone)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  138. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  139. cardEffects.Add(activateClass);
  140. string EffectDiscription()
  141. {
  142. return "[On Deletion] Delete 1 of your opponent's Digimon.";
  143. }
  144. bool CanSelectPermanentCondition(Permanent permanent)
  145. {
  146. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  147. }
  148. bool CanUseCondition(Hashtable hashtable)
  149. {
  150. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.IsExistOnTrash(card))
  155. {
  156. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  157. {
  158. return true;
  159. }
  160. }
  161. return false;
  162. }
  163. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  164. {
  165. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  166. {
  167. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  168. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  169. selectPermanentEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: CanSelectPermanentCondition,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: maxCount,
  175. canNoSelect: false,
  176. canEndNotMax: false,
  177. selectPermanentCoroutine: null,
  178. afterSelectPermanentCoroutine: null,
  179. mode: SelectPermanentEffect.Mode.Destroy,
  180. cardEffect: activateClass);
  181. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  182. }
  183. }
  184. }
  185. return cardEffects;
  186. }
  187. }