EX6_057.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Lilithmon
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_057 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Shared OP / WD
  12. string SharedEffectName = "Give 1 opponent Digimon [End of Your Turn] Delete this Digimon";
  13. CardEffectFactory.ActivateClassesForSharedEffects
  14. (ref cardEffects, timing, card,
  15. SharedEffectName,
  16. SharedActivateCoroutine,
  17. SharedEffectDescription,
  18. optional: false,
  19. onPlay: true,
  20. whenDigivolving: true);
  21. string SharedEffectDescription(string tag) => $"[{tag}] Until the end of your opponent's turn, 1 of your opponent's Digimon gains [End of Your Turn] Delete this Digimon.";
  22. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  23. {
  24. bool CanSelectPermanentCondition(Permanent permanent)
  25. {
  26. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  27. }
  28. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  29. {
  30. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  31. selectPermanentEffect.SetUp(
  32. selectPlayer: card.Owner,
  33. canTargetCondition: CanSelectPermanentCondition,
  34. canTargetCondition_ByPreSelecetedList: null,
  35. canEndSelectCondition: null,
  36. maxCount: 1,
  37. canNoSelect: false,
  38. canEndNotMax: false,
  39. selectPermanentCoroutine: SelectPermanentCoroutine,
  40. afterSelectPermanentCoroutine: null,
  41. mode: SelectPermanentEffect.Mode.Custom,
  42. cardEffect: activateClass);
  43. selectPermanentEffect.SetUpCustomMessage(
  44. "Select 1 Digimon that will get [End of Your Turn] Delete this Digimon.",
  45. "The opponent is selecting 1 Digimon that will get [End of Your Turn] Delete this Digimon.");
  46. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  47. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  48. {
  49. Permanent selectedPermanent = permanent;
  50. if (selectedPermanent != null)
  51. {
  52. ActivateClass activateClass1 = new ActivateClass();
  53. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, selectedPermanent.TopCard);
  54. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDescription1());
  55. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  56. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: PermanentEffectFactory.AddDetailClass(selectedPermanent, "[End of Your Turn] Delete this Digimon.", true, activateClass), timing: EffectTiming.None);
  57. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnEndTurn);
  58. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  61. }
  62. string EffectDescription1()
  63. {
  64. return "[End of Your Turn] Delete this Digimon.";
  65. }
  66. bool CanUseCondition1(Hashtable hashtable1)
  67. {
  68. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent)
  69. && selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent)
  70. && GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner
  71. && !permanent.TopCard.CanNotBeAffected(activateClass);
  72. }
  73. bool CanActivateCondition1(Hashtable hashtable1)
  74. {
  75. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent)
  76. && !permanent.TopCard.CanNotBeAffected(activateClass);
  77. }
  78. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  79. {
  80. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  83. new List<Permanent>() { selectedPermanent },
  84. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. #endregion
  92. #region All Turns
  93. if (timing == EffectTiming.WhenRemoveField)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("Delete 1 level 5 or lower Digimon to prevent leaving the battle area", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  98. activateClass.SetHashString("Protection_EX6_057");
  99. cardEffects.Add(activateClass);
  100. string EffectDescription()
  101. {
  102. return "[All Turns] [Once Per Turn] When this Digimon would leave the battle area other than in battle, by deleting 1 level 5 or lower Digimon, prevent it from leaving.";
  103. }
  104. bool CanSelectPermanentCondition(Permanent permanent)
  105. {
  106. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
  107. && permanent.TopCard.HasLevel
  108. && permanent.Level <= 5;
  109. }
  110. bool CanUseCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  113. && CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card)
  114. && !CardEffectCommons.IsByBattle(hashtable);
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  119. && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable hashtable)
  122. {
  123. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  124. {
  125. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  126. selectPermanentEffect.SetUp(
  127. selectPlayer: card.Owner,
  128. canTargetCondition: CanSelectPermanentCondition,
  129. canTargetCondition_ByPreSelecetedList: null,
  130. canEndSelectCondition: null,
  131. maxCount: 1,
  132. canNoSelect: true,
  133. canEndNotMax: false,
  134. selectPermanentCoroutine: SelectPermanentCoroutine,
  135. afterSelectPermanentCoroutine: null,
  136. mode: SelectPermanentEffect.Mode.Custom,
  137. cardEffect: activateClass);
  138. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  139. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  140. IEnumerator SelectPermanentCoroutine(Permanent _permanent)
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { _permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  143. IEnumerator SuccessProcess()
  144. {
  145. card.PermanentOfThisCard().willBeRemoveField = false;
  146. card.PermanentOfThisCard().HideDeleteEffect();
  147. yield return null;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. #endregion
  154. #region Opponent's Turn
  155. if (timing == EffectTiming.OnDestroyedAnyone)
  156. {
  157. ActivateClass activateClass = new ActivateClass();
  158. activateClass.SetUpICardEffect("Trash the top card of your opponent's security", CanUseCondition, card);
  159. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  160. cardEffects.Add(activateClass);
  161. string EffectDescription()
  162. {
  163. return "[Opponent's Turn] [Once Per Turn] When another Digimon is deleted, trash the top card of your opponent's security stack.";
  164. }
  165. bool PermanentCondition(Permanent permanent)
  166. {
  167. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
  168. && permanent != card.PermanentOfThisCard();
  169. }
  170. bool CanUseCondition(Hashtable hashtable)
  171. {
  172. return CardEffectCommons.IsOpponentTurn(card)
  173. && CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  174. && CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass);
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  179. }
  180. IEnumerator ActivateCoroutine(Hashtable hashtable)
  181. {
  182. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  183. player: card.Owner.Enemy,
  184. destroySecurityCount: 1,
  185. cardEffect: activateClass,
  186. fromTop: true).DestroySecurity());
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }