BT12_100.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_100 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] Delete 1 of your opponent's Digimon. Then, unsuspend 1 of your [Shoutmon X7: Superior Mode] cards, and you may attack a player with that Digimon.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanSelectPermanentCondition1(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  28. {
  29. if (permanent.TopCard.CardNames.Contains("ShoutmonX7:SuperiorMode"))
  30. {
  31. return true;
  32. }
  33. if (permanent.TopCard.CardNames.Contains("Shoutmon X7: Superior Mode"))
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. List<Permanent> selectedPermanents = new List<Permanent>();
  47. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  48. {
  49. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: CanSelectPermanentCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: maxCount,
  57. canNoSelect: false,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: null,
  60. afterSelectPermanentCoroutine: null,
  61. mode: SelectPermanentEffect.Mode.Destroy,
  62. cardEffect: activateClass);
  63. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  64. }
  65. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  66. {
  67. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  68. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  69. selectPermanentEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: CanSelectPermanentCondition1,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: maxCount,
  75. canNoSelect: false,
  76. canEndNotMax: false,
  77. selectPermanentCoroutine: null,
  78. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  79. mode: SelectPermanentEffect.Mode.UnTap,
  80. cardEffect: activateClass);
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  83. {
  84. selectedPermanents = permanents;
  85. yield return null;
  86. }
  87. foreach (Permanent permanent in selectedPermanents)
  88. {
  89. Permanent selectedPermanent = permanent;
  90. if (selectedPermanent != null)
  91. {
  92. if (selectedPermanent.CanAttack(activateClass))
  93. {
  94. if (selectedPermanent.CanAttackTargetDigimon(null, activateClass))
  95. {
  96. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  97. selectAttackEffect.SetUp(
  98. attacker: selectedPermanent,
  99. canAttackPlayerCondition: () => true,
  100. defenderCondition: (permanent) => false,
  101. cardEffect: activateClass);
  102. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
  109. }
  110. if (timing == EffectTiming.SecuritySkill)
  111. {
  112. ActivateClass activateClass = new ActivateClass();
  113. activateClass.SetUpICardEffect($"Delete 1 Digimon", CanUseCondition, card);
  114. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  115. activateClass.SetIsSecurityEffect(true);
  116. cardEffects.Add(activateClass);
  117. string EffectDiscription()
  118. {
  119. return "[Security] Delete 1 of your opponent's Digimon.";
  120. }
  121. bool CanSelectPermanentCondition(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  132. {
  133. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  134. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: CanSelectPermanentCondition,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: maxCount,
  141. canNoSelect: false,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: null,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Destroy,
  146. cardEffect: activateClass);
  147. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  148. }
  149. }
  150. }
  151. return cardEffects;
  152. }
  153. }
  154. }