EX5_053.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX5
  5. {
  6. public class EX5_053 : 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.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardTraits.Contains("Deva") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnCounterTiming)
  20. {
  21. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  22. }
  23. if (timing == EffectTiming.OnSecurityCheck)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Play the security Digimon without battle", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  28. activateClass.SetHashString("PlaySecurity_EX5_053");
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[Opponent's Turn] [Once Per Turn] When your security is checked, if that card is a Digimon card with the [Deva] trait, play it without battling and without paying the cost.";
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (CardEffectCommons.IsOpponentTurn(card))
  39. {
  40. CardSource securityCard = CardEffectCommons.GetCardFromHashtable(hashtable);
  41. if (securityCard != null)
  42. {
  43. if (securityCard.Owner == card.Owner)
  44. {
  45. if (securityCard.IsDigimon)
  46. {
  47. if (securityCard.CardTraits.Contains("Deva"))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. return true;
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. CardSource securityCard = CardEffectCommons.GetCardFromHashtable(_hashtable);
  69. if (securityCard != null)
  70. {
  71. DontBattleSecurityDigimonClass dontBattleSecurityDigimonClass = new DontBattleSecurityDigimonClass();
  72. dontBattleSecurityDigimonClass.SetUpICardEffect("Ignore Battle", CanUseCondition, card);
  73. dontBattleSecurityDigimonClass.SetUpDontBattleSecurityDigimonClass(CardSourceCondition: CardSourceCondition);
  74. card.Owner.UntilSecurityCheckEndEffects.Add(_timing => dontBattleSecurityDigimonClass);
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanUseIgnoreBattle(hashtable, securityCard);
  78. }
  79. bool CardSourceCondition(CardSource cardSource)
  80. {
  81. return cardSource == securityCard;
  82. }
  83. }
  84. if (securityCard != null)
  85. {
  86. if (CardEffectCommons.CanPlayAsNewPermanent(
  87. cardSource: securityCard,
  88. payCost: false,
  89. cardEffect: activateClass,
  90. root: SelectCardEffect.Root.Security))
  91. {
  92. GManager.instance.attackProcess.SecurityDigimon = null;
  93. yield return ContinuousController.instance.StartCoroutine(securityCard.Owner.brainStormObject.CloseBrainstrorm(securityCard));
  94. if (GManager.instance.GetComponent<Effects>().ShowUseHandCard.gameObject.activeSelf)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShrinkUpUseHandCard(GManager.instance.GetComponent<Effects>().ShowUseHandCard));
  97. }
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  99. cardSources: new List<CardSource>() { securityCard },
  100. activateClass: activateClass,
  101. payCost: false,
  102. isTapped: false,
  103. root: SelectCardEffect.Root.Security,
  104. activateETB: true));
  105. }
  106. }
  107. }
  108. }
  109. if (timing == EffectTiming.OnDestroyedAnyone)
  110. {
  111. ActivateClass activateClass = new ActivateClass();
  112. activateClass.SetUpICardEffect("Delete opponent's all Digimon with the highest DP", CanUseCondition, card);
  113. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  114. cardEffects.Add(activateClass);
  115. string EffectDiscription()
  116. {
  117. return "[On Deletion] Delete 1 of your opponent's highest play cost Digimon.";
  118. }
  119. bool CanSelectPermanentCondition(Permanent permanent)
  120. {
  121. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  122. {
  123. if (CardEffectCommons.IsMaxCost(permanent, card.Owner.Enemy, true))
  124. {
  125. return true;
  126. }
  127. }
  128. return false;
  129. }
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  137. {
  138. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  139. {
  140. return true;
  141. }
  142. }
  143. return false;
  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. }
  170. }