BT12_016.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_016 : 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("Delete 1 Digimon with 4000 DP or less, or this Digimon digivolves", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] Delete 1 of your opponent's Digimon with 4000 DP or less. If an opponent's Digimon isn't deleted by this effect, you may digivolve this Digimon into a level 6 Digimon card with [Gallantmon] in its name in your hand for its digivolution cost. When this Digimon would digivolve with this effect, reduce the digivolution cost by 1.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanSelectCardCondition(CardSource cardSource)
  33. {
  34. if (cardSource.ContainsCardName("Gallantmon"))
  35. {
  36. if (cardSource.Level == 6)
  37. {
  38. if (cardSource.HasLevel)
  39. {
  40. if (cardSource.IsDigimon)
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. return true;
  60. }
  61. if (card.Owner.HandCards.Count >= 1)
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. if (CardEffectCommons.IsExistOnBattleArea(card))
  71. {
  72. Permanent thisPermanent = card.PermanentOfThisCard();
  73. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  74. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  75. {
  76. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  77. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectPermanentCondition,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: maxCount,
  84. canNoSelect: false,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: null,
  87. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  88. mode: SelectPermanentEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  91. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  92. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  93. {
  94. foreach (Permanent permanent in permanents)
  95. {
  96. deleteTargetPermanents.Add(permanent);
  97. }
  98. yield return null;
  99. }
  100. }
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  102. IEnumerator FailureProcess()
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  105. targetPermanent: thisPermanent,
  106. cardCondition: CanSelectCardCondition,
  107. payCost: true,
  108. reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
  109. fixedCostTuple: null,
  110. ignoreDigivolutionRequirementFixedCost: -1,
  111. isHand: true,
  112. activateClass: activateClass,
  113. successProcess: null));
  114. }
  115. }
  116. }
  117. }
  118. if (timing == EffectTiming.OnEndAttack)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  123. activateClass.SetIsInheritedEffect(true);
  124. activateClass.SetHashString("Memory+2_BT12_016");
  125. cardEffects.Add(activateClass);
  126. string EffectDiscription()
  127. {
  128. return "[End of Attack][Once Per Turn] When your opponent has no Digimon in play, if this Digimon has [Growlmon] or [Gallantmon] in its name, gain 2 memory.";
  129. }
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.IsExistOnBattleArea(card))
  137. {
  138. if (card.Owner.Enemy.GetBattleAreaDigimons().Count == 0)
  139. {
  140. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Growlmon"))
  141. {
  142. return true;
  143. }
  144. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Gallantmon"))
  145. {
  146. return true;
  147. }
  148. }
  149. }
  150. return false;
  151. }
  152. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  153. {
  154. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  155. }
  156. }
  157. return cardEffects;
  158. }
  159. }
  160. }