ST23_07.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Armalizamon
  5. namespace DCGO.CardEffects.ST23
  6. {
  7. public class ST23_07 : 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.EqualsTraits("Glowing Dawn");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Shared OP/WD
  23. string SharedEffectName = "May play 1 [Glowing Dawn] Tamer from hand for free";
  24. CardEffectFactory.ActivateClassesForSharedEffects
  25. (ref cardEffects, timing, card,
  26. SharedEffectName,
  27. SharedActivateCoroutine,
  28. SharedEffectDescription,
  29. additionalActivateCondition: AdditionalActivateCondition,
  30. optional: false,
  31. onPlay: true,
  32. whenDigivolving: true);
  33. string SharedEffectDescription(string tag) => $"[{tag}] If you have 1 or fewer Tamers, you may play 1 Tamer card with the [Glowing Dawn] trait from your hand without paying the cost.";
  34. bool AdditionalActivateCondition(Hashtable hashtable, ActivateClass activateClass)
  35. {
  36. return CardEffectCommons.MatchConditionOwnersPermanentCount(card, HasTamersInBattleArea) <= 1;
  37. }
  38. bool HasTamersInBattleArea(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  41. && permanent.IsTamer;
  42. }
  43. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  44. {
  45. bool HasTamerInHand(CardSource source)
  46. {
  47. return source.EqualsTraits("Glowing Dawn")
  48. && source.IsTamer
  49. && CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  50. }
  51. List<CardSource> selectedCards = new List<CardSource>();
  52. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, HasTamerInHand));
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: HasTamerInHand,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: true,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. selectCardCoroutine: null,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.PlayForFree,
  66. cardEffect: activateClass);
  67. yield return StartCoroutine(selectHandEffect.Activate());
  68. }
  69. #endregion
  70. #region ESS - Piercing
  71. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  72. {
  73. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: true, card: card, condition: null));
  74. }
  75. #endregion
  76. return cardEffects;
  77. }
  78. }
  79. }