BT19_022.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_022 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Blocker
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  14. isInheritedEffect: false,
  15. card: card, condition: null));
  16. }
  17. #endregion
  18. #region On Deletion
  19. if (timing == EffectTiming.OnDestroyedAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Place 1 [Blue Flare] card from trash under 1 of your Tamers, then <Save>", CanUseCondition,
  23. card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  25. cardEffects.Add(activateClass);
  26. string EffectDescription()
  27. {
  28. return
  29. "[On Deletion] You may place 1 Digimon card with the [Blue Flare] from your trash under any of your Tamers. Then, <Save>.";
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  34. }
  35. bool CanSelectSaveTamerPermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  38. && permanent.IsTamer;
  39. }
  40. bool HasBlueFlareTraitCondition(CardSource cardSource)
  41. {
  42. return cardSource.IsDigimon && cardSource.EqualsTraits("Blue Flare");
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  47. (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, HasBlueFlareTraitCondition) ||
  48. CardEffectCommons.CanActivateSave(hashtable, CanSelectSaveTamerPermanentCondition));
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, HasBlueFlareTraitCondition))
  53. {
  54. List<CardSource> selectedCards = new List<CardSource>();
  55. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  56. selectCardEffect.SetUp(
  57. canTargetCondition: HasBlueFlareTraitCondition,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. canNoSelect: () => true,
  61. selectCardCoroutine: SelectCardCoroutine,
  62. afterSelectCardCoroutine: null,
  63. message: "Select 1 card to place under a tamer.",
  64. maxCount: 1,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. mode: SelectCardEffect.Mode.Custom,
  68. root: SelectCardEffect.Root.Trash,
  69. customRootCardList: null,
  70. canLookReverseCard: true,
  71. selectPlayer: card.Owner,
  72. cardEffect: activateClass);
  73. selectCardEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  74. "The opponent is selecting 1 card to place under a tamer.");
  75. yield return StartCoroutine(selectCardEffect.Activate());
  76. IEnumerator SelectCardCoroutine(CardSource cardSource)
  77. {
  78. selectedCards.Add(cardSource);
  79. yield return null;
  80. }
  81. if (selectedCards.Count >= 1)
  82. {
  83. Permanent selectedPermanent = null;
  84. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectSaveTamerPermanentCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: 1,
  91. canNoSelect: true,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: SelectPermanentCoroutine,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.Custom,
  96. cardEffect: activateClass);
  97. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  98. "The opponent is selecting 1 Tamer to place the chosen card under.");
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  101. {
  102. selectedPermanent = permanent;
  103. yield return null;
  104. }
  105. if (selectedPermanent != null)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(
  108. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  109. }
  110. }
  111. }
  112. if (CardEffectCommons.CanActivateSave(hashtable, CanSelectSaveTamerPermanentCondition))
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(
  115. CardEffectCommons.SaveProcess(hashtable, activateClass, card, CanSelectSaveTamerPermanentCondition));
  116. }
  117. }
  118. }
  119. #endregion
  120. #region Blocker - ESS
  121. if (timing == EffectTiming.None)
  122. {
  123. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  124. isInheritedEffect: true,
  125. card: card, condition: null));
  126. }
  127. #endregion
  128. return cardEffects;
  129. }
  130. }
  131. }