BT22_020.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //BT22 Kausgammamon
  4. namespace DCGO.CardEffects.BT22
  5. {
  6. public class BT22_020 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alt digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Gammamon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 2,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null)
  24. );
  25. }
  26. #endregion
  27. #region When Attacking
  28. if (timing == EffectTiming.OnAllyAttack)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Tuck Gammamon name to draw", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  33. activateClass.SetHashString("BT22_020-atk");
  34. cardEffects.Add(activateClass);
  35. string EffectDescription() => "[When Attacking][Once Per Turn] By placing 1 Digimon card with [Gammamon] in its name from your hand as this Digimon's bottom digivolution card, <Draw 1>.";
  36. bool HasGammamonNameDigimon(CardSource card)
  37. {
  38. return card.IsDigimon && card.ContainsCardName("Gammamon");
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  43. {
  44. return CardEffectCommons.HasMatchConditionOwnersHand(card, HasGammamonNameDigimon);
  45. }
  46. return false;
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionOwnersHand(card, HasGammamonNameDigimon))
  55. {
  56. CardSource selectedCard = null;
  57. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  58. selectHandEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: HasGammamonNameDigimon,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: 1,
  64. canNoSelect: true,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. selectCardCoroutine: SelectCardCoroutine,
  68. afterSelectCardCoroutine: null,
  69. mode: SelectHandEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "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. selectedCard = cardSource;
  77. yield return null;
  78. }
  79. if (selectedCard != null)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource> { selectedCard }, activateClass));
  82. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  83. }
  84. }
  85. }
  86. }
  87. #endregion
  88. #region ESS
  89. if (timing == EffectTiming.None)
  90. {
  91. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  92. isInheritedEffect: true,
  93. card: card,
  94. condition: null));
  95. }
  96. #endregion
  97. return cardEffects;
  98. }
  99. }
  100. }