BT17_013.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_013 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(
  16. "Delete 1 Digimon with 6000 DP or less, or get [Security Attack +1] for the turn",
  17. CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  19. EffectDescription());
  20. cardEffects.Add(activateClass);
  21. string EffectDescription()
  22. {
  23. return
  24. "[When Digivolving] Delete 1 of your opponent's Digimon with 6000 DP or less. If this effect didn't delete, this Digimon gains [Security Attack +1] for the turn.";
  25. }
  26. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  27. {
  28. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  29. {
  30. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleArea(card);
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  49. {
  50. int maxCount = Math.Min(1,
  51. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  52. SelectPermanentEffect selectPermanentEffect =
  53. GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectOpponentPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: null,
  63. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  64. mode: SelectPermanentEffect.Mode.Custom,
  65. cardEffect: activateClass);
  66. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  67. "The opponent is selecting 1 Digimon to delete.");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  70. {
  71. deleteTargetPermanents = permanents.Clone();
  72. yield return null;
  73. }
  74. }
  75. yield return ContinuousController.instance.StartCoroutine(
  76. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  77. targetPermanents: deleteTargetPermanents, activateClass: activateClass,
  78. successProcess: null, failureProcess: FailureProcess));
  79. IEnumerator FailureProcess()
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(
  82. CardEffectCommons.ChangeDigimonSAttack(
  83. targetPermanent: card.PermanentOfThisCard(),
  84. changeValue: 1,
  85. effectDuration: EffectDuration.UntilEachTurnEnd,
  86. activateClass: activateClass));
  87. }
  88. }
  89. }
  90. #endregion
  91. #region Your Turn - ESS
  92. if (timing == EffectTiming.OnDestroyedAnyone)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect(
  96. "Unsuspend this Digimon with [Gallantmon] in its name.", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  98. activateClass.SetIsInheritedEffect(true);
  99. activateClass.SetHashString("Unsuspend_BT17_010");
  100. cardEffects.Add(activateClass);
  101. string EffectDescription()
  102. {
  103. return
  104. "[All Turns] [Once Per Turn] When an effect deletes an opponent's Digimon, you may unsuspend this Digimon with [Gallantmon] in its name.";
  105. }
  106. bool OpponentPermanentCondition(Permanent permanent)
  107. {
  108. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  109. {
  110. if (permanent.IsDigimon)
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. bool CanUseCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, OpponentPermanentCondition, activateClass))
  122. {
  123. if (CardEffectCommons.IsByEffect(hashtable, null))
  124. {
  125. return true;
  126. }
  127. }
  128. }
  129. return false;
  130. }
  131. bool CanActivateCondition(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.IsExistOnBattleArea(card))
  134. {
  135. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Gallantmon"))
  136. {
  137. if (card.PermanentOfThisCard().IsSuspended)
  138. {
  139. return true;
  140. }
  141. }
  142. }
  143. return false;
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable hashtable)
  146. {
  147. if (CardEffectCommons.IsExistOnBattleArea(card))
  148. {
  149. yield return ContinuousController.instance.StartCoroutine(
  150. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() },
  151. activateClass).Unsuspend());
  152. }
  153. }
  154. }
  155. #endregion
  156. return cardEffects;
  157. }
  158. }
  159. }