BT11_040.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT11
  4. {
  5. public class BT11_040 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnDestroyedAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Deletion] Reveal the top 3 cards of your deck. Add 1 card with [Chuumon], [Sukamon], or [Etemon] in its name among them to your hand. Trash the rest.";
  19. }
  20. bool CanSelectCardCondition(CardSource cardSource)
  21. {
  22. if (cardSource.ContainsCardName("Chuumon"))
  23. {
  24. return true;
  25. }
  26. if (cardSource.ContainsCardName("Sukamon"))
  27. {
  28. return true;
  29. }
  30. if (cardSource.ContainsCardName("Etemon"))
  31. {
  32. return true;
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  43. {
  44. if (card.Owner.LibraryCards.Count >= 1)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  54. revealCount: 3,
  55. simplifiedSelectCardConditions:
  56. new SimplifiedSelectCardConditionClass[]
  57. {
  58. new SimplifiedSelectCardConditionClass(
  59. canTargetCondition:CanSelectCardCondition,
  60. message: "Select 1 card with [Chuumon], [Sukamon], or [Etemon] in its name.",
  61. mode: SelectCardEffect.Mode.AddHand,
  62. maxCount: 1,
  63. selectCardCoroutine: null),
  64. },
  65. remainingCardsPlace: RemainingCardsPlace.Trash,
  66. activateClass: activateClass
  67. ));
  68. }
  69. }
  70. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Prevent this Digimon from being deleted", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  75. activateClass.SetIsInheritedEffect(true);
  76. activateClass.SetHashString("Substitute_BT11_040");
  77. cardEffects.Add(activateClass);
  78. string EffectDiscription()
  79. {
  80. return "[All Turns] When this Digimon would be deleted, by deleting 1 other Digimon with [Sukamon] in its name, prevent that deletion.";
  81. }
  82. bool CanSelectPermanentCondition(Permanent permanent)
  83. {
  84. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  85. {
  86. if (permanent != card.PermanentOfThisCard())
  87. {
  88. if (permanent.TopCard.ContainsCardName("Sukamon"))
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  101. {
  102. return true;
  103. }
  104. }
  105. return false;
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. {
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  112. {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
  118. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  119. {
  120. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  121. {
  122. int maxCount = 1;
  123. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  124. selectPermanentEffect.SetUp(
  125. selectPlayer: card.Owner,
  126. canTargetCondition: CanSelectPermanentCondition,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. maxCount: maxCount,
  130. canNoSelect: true,
  131. canEndNotMax: false,
  132. selectPermanentCoroutine: SelectPermanentCoroutine,
  133. afterSelectPermanentCoroutine: null,
  134. mode: SelectPermanentEffect.Mode.Custom,
  135. cardEffect: activateClass);
  136. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  137. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  138. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  139. {
  140. Permanent thisCardPermanent = card.PermanentOfThisCard();
  141. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  142. IEnumerator SuccessProcess()
  143. {
  144. if (thisCardPermanent.TopCard != null)
  145. {
  146. thisCardPermanent.willBeRemoveField = false;
  147. thisCardPermanent.HideDeleteEffect();
  148. }
  149. yield return null;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. return cardEffects;
  156. }
  157. }
  158. }