EX12_051.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Lamortmon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_051 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alt Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent permanent)
  15. {
  16. return permanent.TopCard.HasText("Angoramon")
  17. || permanent.TopCard.EqualsTraits("NSp");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 4));
  20. }
  21. #endregion
  22. #region Reboot
  23. if (timing == EffectTiming.None)
  24. {
  25. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region Blocker
  29. if (timing == EffectTiming.None)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  32. }
  33. #endregion
  34. #region Shared OP / WD
  35. string SharedEffectName = "Suspend 1 enemy Digimon/Tamer, then <De-Digivolve 1> 1 enemy Digimon";
  36. CardEffectFactory.ActivateClassesForSharedEffects
  37. (ref cardEffects, timing, card,
  38. SharedEffectName,
  39. SharedActivateCoroutine,
  40. SharedEffectDescription,
  41. optional: false,
  42. onPlay: true,
  43. whenDigivolving: true);
  44. string SharedEffectDescription(string tag) => $"[{tag}] Suspend 1 of your opponent's Digimon or Tamers. Then, <De-Digivolve 1> 1 of their Digimon.";
  45. bool CanSelectSuspendPermanentCondition(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  48. && (permanent.IsDigimon
  49. || permanent.IsTamer);
  50. }
  51. bool CanSelectDeDigiPermanentCondition(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  54. }
  55. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendPermanentCondition))
  58. {
  59. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectSuspendPermanentCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: 1,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: null,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Tap,
  71. cardEffect: activateClass);
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. }
  74. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigiPermanentCondition))
  75. {
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectDeDigiPermanentCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: 1,
  83. canNoSelect: false,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: null,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Degenerate,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. }
  92. }
  93. #endregion
  94. #region Inherited AT
  95. if (timing == EffectTiming.OnEndBattle)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Trash opponent's top security", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  100. activateClass.SetIsInheritedEffect(true);
  101. activateClass.SetHashString("EX12_051_Inherited");
  102. cardEffects.Add(activateClass);
  103. string EffectDescription()
  104. {
  105. return "[All Turns] [Once Per Turn] When this Digimon with [Angoramon] in its text or the [NSp] trait wins a battle, trash your opponent's top security card.";
  106. }
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  110. && (card.PermanentOfThisCard().TopCard.HasText("Angoramon")
  111. || card.PermanentOfThisCard().TopCard.EqualsTraits("NSp")))
  112. {
  113. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  114. if (CardEffectCommons.CanTriggerWhenWinBattle(
  115. hashtable: hashtable,
  116. winnerCondition: WinnerCondition))
  117. {
  118. return true;
  119. }
  120. }
  121. return false;
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  128. {
  129. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  130. player: card.Owner.Enemy,
  131. destroySecurityCount: 1,
  132. cardEffect: activateClass,
  133. fromTop: true).DestroySecurity());
  134. }
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }
  140. }