BT17_021.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT17
  6. {
  7. public class BT17_021 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to Draw 1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "[On Play] By placing 1 [Seasarmon] or 1 level 3 blue Digimon card from your hand as this Digimon's bottom digivolution card, <Draw 1>.";
  23. }
  24. bool CanSelectHandCardCondition(CardSource cardSource)
  25. {
  26. if (cardSource.IsDigimon)
  27. {
  28. return cardSource.EqualsCardName("Seasarmon") ||
  29. (cardSource.IsLevel3 && cardSource.HasCardColor(CardColor.Blue));
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (card.Owner.HandCards.Count(CanSelectHandCardCondition) >= 1)
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (card.Owner.HandCards.Count(CanSelectHandCardCondition) >= 1)
  53. {
  54. List<CardSource> selectedCards = new List<CardSource>();
  55. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectHandCardCondition));
  56. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  57. selectHandEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectHandCardCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: true,
  64. canEndNotMax: false,
  65. isShowOpponent: true,
  66. selectCardCoroutine: SelectCardCoroutine,
  67. afterSelectCardCoroutine: null,
  68. mode: SelectHandEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  71. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  72. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  73. yield return StartCoroutine(selectHandEffect.Activate());
  74. IEnumerator SelectCardCoroutine(CardSource cardSource)
  75. {
  76. selectedCards.Add(cardSource);
  77. yield return null;
  78. }
  79. if (selectedCards.Count >= 1)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  82. .AddDigivolutionCardsBottom(
  83. selectedCards,
  84. activateClass));
  85. yield return ContinuousController.instance.StartCoroutine(
  86. new DrawClass(card.Owner, 1, activateClass).Draw());
  87. }
  88. }
  89. }
  90. }
  91. }
  92. #endregion
  93. #region When Attacking - ESS
  94. if (timing == EffectTiming.OnAllyAttack)
  95. {
  96. ActivateClass activateClass = new ActivateClass();
  97. activateClass.SetUpICardEffect("Gain 1 Memory", CanUseCondition, card);
  98. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  99. activateClass.SetIsInheritedEffect(true);
  100. cardEffects.Add(activateClass);
  101. string EffectDescription()
  102. {
  103. return "[When Attacking] [Once Per Turn] If this Digimon has <Jamming>, gain 1 memory.";
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  108. }
  109. bool CanActivateCondition(Hashtable hashtable)
  110. {
  111. if (CardEffectCommons.IsExistOnBattleArea(card))
  112. {
  113. if (card.PermanentOfThisCard().HasJamming)
  114. {
  115. return true;
  116. }
  117. }
  118. return false;
  119. }
  120. IEnumerator ActivateCoroutine(Hashtable hashtable)
  121. {
  122. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  123. }
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }