EX12_024.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Garurumon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_024 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Gabumon")
  17. || targetPermanent.TopCard.EqualsTraits("NSo")
  18. || targetPermanent.TopCard.EqualsTraits("VB");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 2,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null,
  26. level: 3)
  27. );
  28. }
  29. #endregion
  30. #region Jamming
  31. if (timing == EffectTiming.None)
  32. {
  33. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. #endregion
  36. #region Shared OP/WA
  37. string SharedEffectName = "Bounce 1 level 4 or lower enemy Digimon";
  38. string SharedEffectHash = "EX12_024_OP_WA";
  39. CardEffectFactory.ActivateClassesForSharedEffects
  40. (ref cardEffects, timing, card,
  41. SharedEffectName,
  42. SharedActivateCoroutine,
  43. SharedEffectDescription,
  44. optional: false,
  45. maxCountPerTurn: 1,
  46. hashValue: SharedEffectHash,
  47. onPlay: true,
  48. whenAttacking: true);
  49. string SharedEffectDescription(string tag)
  50. {
  51. return $"[{tag}] [Once Per Turn] Return 1 of your opponent's level 4 or lower Digimon to the hand.";
  52. }
  53. bool CanSelectPermanentCondition(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  56. && permanent.TopCard.HasLevel
  57. && permanent.TopCard.Level <= 4;
  58. }
  59. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  60. {
  61. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  62. {
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: 1,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Bounce,
  75. cardEffect: activateClass);
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  77. }
  78. }
  79. #endregion
  80. #region Inherited
  81. if (timing == EffectTiming.OnAllyAttack)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("<Draw 1> and trash 1>", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  86. activateClass.SetHashString("EX12_024_Inherited");
  87. activateClass.SetIsInheritedEffect(true);
  88. cardEffects.Add(activateClass);
  89. string EffectDescription()
  90. {
  91. return "[When Attacking] [Once Per Turn] <Draw 1> and trash 1 card in your hand.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  96. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  97. }
  98. bool CanActivateCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass);
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable hashtable)
  103. {
  104. if (card.Owner.LibraryCards.Count >= 1)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  107. }
  108. if (card.Owner.HandCards.Count >= 1)
  109. {
  110. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  111. selectHandEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition: (cardSource) => true,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: 1,
  117. canNoSelect: false,
  118. canEndNotMax: false,
  119. isShowOpponent: true,
  120. selectCardCoroutine: null,
  121. afterSelectCardCoroutine: null,
  122. mode: SelectHandEffect.Mode.Discard,
  123. cardEffect: activateClass);
  124. yield return StartCoroutine(selectHandEffect.Activate());
  125. }
  126. }
  127. }
  128. #endregion
  129. return cardEffects;
  130. }
  131. }
  132. }