EX3_053.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX3
  5. {
  6. public class EX3_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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("De-Digivolve 1 and delete 1 Digimon with 5 or less Cost or opponent's Digimon can't digivolve", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] <De-Digivolve 1> all of your opponent's Digimon. Then, delete 1 of your opponent's Digimon with a play cost of 5 or less. If no Digimon is deleted by this effect, none of your opponent's unsuspended Digimon can digivolve until the end of your opponent's turn.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanSelectPermanentCondition1(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.TopCard.GetCostItself <= 5)
  30. {
  31. if (permanent.TopCard.HasPlayCost)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. return true;
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  56. {
  57. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  58. {
  59. if (CanSelectPermanentCondition(permanent))
  60. {
  61. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  64. }
  65. }
  66. }
  67. }
  68. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  69. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  70. {
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition1,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: null,
  82. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  88. {
  89. foreach (Permanent permanent in permanents)
  90. {
  91. deleteTargetPermanents.Add(permanent);
  92. }
  93. yield return null;
  94. }
  95. }
  96. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  97. IEnumerator FailureProcess()
  98. {
  99. CanNotDigivolveClass canNotPutFieldClass = new CanNotDigivolveClass();
  100. canNotPutFieldClass.SetUpICardEffect("Can't Digivolve", CanUseCondition1, card);
  101. canNotPutFieldClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
  102. card.Owner.Enemy.UntilOwnerTurnEndEffects.Add((_timing) => canNotPutFieldClass);
  103. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().DebuffSE);
  104. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  105. {
  106. if (PermanentCondition(permanent))
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  109. }
  110. }
  111. bool CanUseCondition1(Hashtable hashtable)
  112. {
  113. return true;
  114. }
  115. bool PermanentCondition(Permanent permanent)
  116. {
  117. if (permanent != null)
  118. {
  119. if (permanent.TopCard != null)
  120. {
  121. if (permanent.TopCard.Owner == card.Owner.Enemy)
  122. {
  123. if (!permanent.IsSuspended)
  124. {
  125. if (permanent.TopCard.Owner.GetBattleAreaDigimons().Contains(permanent))
  126. {
  127. return true;
  128. }
  129. }
  130. }
  131. }
  132. }
  133. return false;
  134. }
  135. bool CardCondition(CardSource cardSource)
  136. {
  137. if (cardSource.Owner == card.Owner.Enemy)
  138. {
  139. return true;
  140. }
  141. return false;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. if (timing == EffectTiming.None)
  148. {
  149. bool Condition()
  150. {
  151. if (CardEffectCommons.IsExistOnBattleArea(card))
  152. {
  153. if (CardEffectCommons.IsOpponentTurn(card))
  154. {
  155. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  156. {
  157. return true;
  158. }
  159. }
  160. }
  161. return false;
  162. }
  163. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: Condition));
  164. }
  165. if (timing == EffectTiming.None)
  166. {
  167. bool Condition()
  168. {
  169. if (CardEffectCommons.IsExistOnBattleArea(card))
  170. {
  171. if (CardEffectCommons.IsOpponentTurn(card))
  172. {
  173. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  174. {
  175. return true;
  176. }
  177. }
  178. }
  179. return false;
  180. }
  181. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: Condition));
  182. }
  183. return cardEffects;
  184. }
  185. }
  186. }