ST24_05.cs 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // GeoGreymon
  5. namespace DCGO.CardEffects.ST24
  6. {
  7. public class ST24_05 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alt Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return (targetPermanent.TopCard.ContainsCardName("Agumon")
  18. && targetPermanent.TopCard.EqualsTraits("Dinosaur"))
  19. || targetPermanent.TopCard.EqualsTraits("DATA SQUAD");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Shared OP/WD
  25. string SharedEffectName = "May play 1 [DATA SQUAD] Tamer from hand for free";
  26. CardEffectFactory.ActivateClassesForSharedEffects
  27. (ref cardEffects, timing, card,
  28. SharedEffectName,
  29. SharedActivateCoroutine,
  30. SharedEffectDescription,
  31. additionalActivateCondition: AdditionalActivateCondition,
  32. optional: false,
  33. onPlay: true,
  34. whenDigivolving: true);
  35. string SharedEffectDescription(string tag) => $"[{tag}] If you have 1 or fewer Tamers, you may play 1 Tamer card with the [DATA SQUAD] trait from your hand without paying the cost.";
  36. bool AdditionalActivateCondition(Hashtable hashtable, ActivateClass activateClass)
  37. {
  38. return CardEffectCommons.MatchConditionOwnersPermanentCount(card, HasTamersInBattleArea) <= 1;
  39. }
  40. bool HasTamersInBattleArea(Permanent permanent)
  41. {
  42. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  43. && permanent.IsTamer;
  44. }
  45. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  46. {
  47. bool HasTamerInHand(CardSource source)
  48. {
  49. return source.EqualsTraits("DATA SQUAD")
  50. && source.IsTamer
  51. && CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  52. }
  53. if (CardEffectCommons.HasMatchConditionOwnersHand(card, HasTamerInHand))
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  56. canTargetCondition: HasTamerInHand,
  57. SelectCardEffect.Root.Hand,
  58. activateClass,
  59. payCost: false
  60. ));
  61. }
  62. }
  63. #endregion
  64. #region Inherited
  65. if (timing == EffectTiming.None)
  66. {
  67. bool Condition()
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  70. && CardEffectCommons.IsOwnerTurn(card);
  71. }
  72. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  73. changeValue: 2000,
  74. isInheritedEffect: true,
  75. card: card,
  76. condition: Condition));
  77. }
  78. #endregion
  79. return cardEffects;
  80. }
  81. }
  82. }