GrandisScissor_BT9_100.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 GrandisScissor_BT9_100 : 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] Suspend 1 of your opponent's Digimon. Then, you may unsuspend 1 of your Digimon with [Insectoid] in its traits, and it attacks your opponent�fs Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanSelectPermanentCondition1(Permanent permanent)
  28. {
  29. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  30. {
  31. if (permanent.TopCard.CardTraits.Contains("Insectoid"))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  47. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  48. selectPermanentEffect.SetUp(
  49. selectPlayer: card.Owner,
  50. canTargetCondition: CanSelectPermanentCondition,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canEndSelectCondition: null,
  53. maxCount: maxCount,
  54. canNoSelect: false,
  55. canEndNotMax: false,
  56. selectPermanentCoroutine: null,
  57. afterSelectPermanentCoroutine: null,
  58. mode: SelectPermanentEffect.Mode.Tap,
  59. cardEffect: activateClass);
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. }
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  63. {
  64. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  65. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  66. selectPermanentEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: CanSelectPermanentCondition1,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: maxCount,
  72. canNoSelect: true,
  73. canEndNotMax: false,
  74. selectPermanentCoroutine: null,
  75. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  76. mode: SelectPermanentEffect.Mode.UnTap,
  77. cardEffect: activateClass);
  78. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  79. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  80. {
  81. foreach (Permanent permanent in permanents)
  82. {
  83. Permanent selectedPermanent = permanent;
  84. if (selectedPermanent != null)
  85. {
  86. if (selectedPermanent.CanAttack(activateClass))
  87. {
  88. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && selectedPermanent.CanAttackTargetDigimon(permanent, activateClass)))
  89. {
  90. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  91. selectAttackEffect.SetUp(
  92. attacker: selectedPermanent,
  93. canAttackPlayerCondition: () => false,
  94. defenderCondition: (permanent) => true,
  95. cardEffect: activateClass);
  96. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  97. }
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. }
  105. if (timing == EffectTiming.SecuritySkill)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect($"Suspend 1 Digimon or a Tamer", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  110. activateClass.SetIsSecurityEffect(true);
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[Security] Suspend 1 of your opponent's Digimon or Tamers.";
  115. }
  116. bool CanSelectPermanentCondition(Permanent permanent)
  117. {
  118. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  119. {
  120. if (permanent.IsDigimon)
  121. {
  122. return true;
  123. }
  124. if (permanent.IsTamer)
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  134. }
  135. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  136. {
  137. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  138. {
  139. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  140. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  141. selectPermanentEffect.SetUp(
  142. selectPlayer: card.Owner,
  143. canTargetCondition: CanSelectPermanentCondition,
  144. canTargetCondition_ByPreSelecetedList: null,
  145. canEndSelectCondition: null,
  146. maxCount: maxCount,
  147. canNoSelect: false,
  148. canEndNotMax: false,
  149. selectPermanentCoroutine: null,
  150. afterSelectPermanentCoroutine: null,
  151. mode: SelectPermanentEffect.Mode.Tap,
  152. cardEffect: activateClass);
  153. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  154. }
  155. }
  156. }
  157. return cardEffects;
  158. }
  159. }