ST24_05.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.CardNames.Contains("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. List<CardSource> selectedCards = new List<CardSource>();
  54. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, HasTamerInHand));
  55. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  56. selectHandEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: HasTamerInHand,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: maxCount,
  62. canNoSelect: true,
  63. canEndNotMax: false,
  64. isShowOpponent: true,
  65. selectCardCoroutine: null,
  66. afterSelectCardCoroutine: null,
  67. mode: SelectHandEffect.Mode.PlayForFree,
  68. cardEffect: activateClass);
  69. yield return StartCoroutine(selectHandEffect.Activate());
  70. }
  71. #endregion
  72. #region Inherited
  73. if (timing == EffectTiming.None)
  74. {
  75. bool Condition()
  76. {
  77. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  78. && CardEffectCommons.IsOwnerTurn(card);
  79. }
  80. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  81. changeValue: 2000,
  82. isInheritedEffect: true,
  83. card: card,
  84. condition: Condition));
  85. }
  86. #endregion
  87. return cardEffects;
  88. }
  89. }
  90. }