BT25_023.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Gaogamon
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_023 : 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("DATA SQUAD");
  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 [Thomas H. Norstein] 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 [Thomas H. Norstein] 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 cardSource)
  46. {
  47. return cardSource.EqualsCardName("Thomas H. Norstein")
  48. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  49. }
  50. List<CardSource> selectedCards = new List<CardSource>();
  51. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, HasTamerInHand));
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  53. canTargetCondition: HasTamerInHand,
  54. SelectCardEffect.Root.Hand,
  55. activateClass,
  56. payCost: false,
  57. maxCount: maxCount
  58. ));
  59. }
  60. #endregion
  61. #region WA - Inherited
  62. if (timing == EffectTiming.OnAllyAttack)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect("Both players <Draw 1>", CanUseCondition, card);
  66. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  67. activateClass.SetIsInheritedEffect(true);
  68. activateClass.SetHashString("BT25_023_Inherited");
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[When Attacking][Once Per Turn] Both players <Draw 1>.";
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.IsExistOnBattleArea(card)
  77. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleArea(card);
  82. }
  83. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  84. {
  85. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(new DrawClass(player, 1, activateClass).Draw());
  88. }
  89. }
  90. }
  91. #endregion
  92. return cardEffects;
  93. }
  94. }
  95. }