BT22_055.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Recomon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_055 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasAppmonTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Link Condition
  29. if (timing == EffectTiming.None)
  30. {
  31. static bool PermanentCondition(Permanent targetPermanent)
  32. {
  33. return targetPermanent.TopCard.HasAppmonTraits;
  34. }
  35. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 1, card: card));
  36. }
  37. #endregion
  38. #region Link
  39. if (timing == EffectTiming.OnDeclaration)
  40. {
  41. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  42. }
  43. #endregion
  44. #region On Play
  45. if (timing == EffectTiming.OnEnterFieldAnyone)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect("Trash 1 [Appmon] trait digimon, Draw 2", CanUseCondition, card);
  49. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  50. cardEffects.Add(activateClass);
  51. string EffectDiscription()
  52. {
  53. return "[On Play] By trashing 1 Digimon card with the [Appmon] trait from your hand, <Draw 2> (Draw 2 cards from your deck).";
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  62. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsAppmon);
  63. }
  64. bool IsAppmon(CardSource card)
  65. {
  66. return card.IsDigimon && card.HasAppmonTraits;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsAppmon))
  71. {
  72. bool discarded = false;
  73. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsAppmon));
  74. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  75. selectHandEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: IsAppmon,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: true,
  82. canEndNotMax: false,
  83. isShowOpponent: true,
  84. selectCardCoroutine: null,
  85. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  86. mode: SelectHandEffect.Mode.Discard,
  87. cardEffect: activateClass);
  88. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  89. {
  90. if (cardSources.Count > 0) discarded = true;
  91. yield return null;
  92. }
  93. selectHandEffect.SetUpCustomMessage("Select 1 Digimon with the [Appmon] trait to trash.", "The opponent is selecting 1 Digimon to trash.");
  94. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  95. yield return StartCoroutine(selectHandEffect.Activate());
  96. if (discarded && card.Owner.LibraryCards.Count >= 2) yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  97. }
  98. }
  99. }
  100. #endregion
  101. #region Link ESS
  102. #region Blocker
  103. if (timing == EffectTiming.None)
  104. {
  105. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null, isLinkedEffect: true));
  106. }
  107. #endregion
  108. #endregion
  109. return cardEffects;
  110. }
  111. }
  112. }