BT19_001.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_001 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region When Attacking
  11. if (timing == EffectTiming.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Place 1 [Xros Heart]/[Blue Flare] card under 1 of your Tamers to <Draw 1>", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  16. activateClass.SetIsInheritedEffect(true);
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return
  21. "[When Attacking] (Once Per Turn) By placing 1 Digimon card with the [Xros Heart]/[Blue Flare] trait from your hand under any of your Tamers.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  26. }
  27. bool IsOwnTamerCondition(Permanent permanent)
  28. {
  29. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  30. permanent.IsTamer;
  31. }
  32. bool HasTraitCondition(CardSource cardSource)
  33. {
  34. return cardSource.IsDigimon && (cardSource.EqualsTraits("Xros Heart") || cardSource.EqualsTraits("Blue Flare"));
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  39. CardEffectCommons.HasMatchConditionOwnersHand(card, HasTraitCondition) &&
  40. CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwnTamerCondition);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. List<CardSource> selectedCards = new List<CardSource>();
  45. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  46. selectHandEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: HasTraitCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: 1,
  52. canNoSelect: true,
  53. canEndNotMax: false,
  54. isShowOpponent: true,
  55. selectCardCoroutine: SelectCardCoroutine,
  56. afterSelectCardCoroutine: null,
  57. mode: SelectHandEffect.Mode.Custom,
  58. cardEffect: activateClass);
  59. selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  60. "The opponent is selecting 1 card to play.");
  61. selectHandEffect.SetUpCustomMessage_ShowCard("Placed card");
  62. yield return StartCoroutine(selectHandEffect.Activate());
  63. IEnumerator SelectCardCoroutine(CardSource cardSource)
  64. {
  65. selectedCards.Add(cardSource);
  66. yield return null;
  67. }
  68. if (selectedCards.Count >= 1)
  69. {
  70. Permanent selectedPermanent = null;
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: IsOwnTamerCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: 1,
  78. canNoSelect: true,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  85. "The opponent is selecting 1 Tamer to place the chosen card under.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  88. {
  89. selectedPermanent = permanent;
  90. yield return null;
  91. }
  92. if (selectedPermanent != null)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(
  95. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  96. yield return ContinuousController.instance.StartCoroutine(
  97. new DrawClass(card.Owner, 1, activateClass).Draw());
  98. }
  99. }
  100. }
  101. }
  102. #endregion
  103. return cardEffects;
  104. }
  105. }
  106. }