ST19_14.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST19
  4. {
  5. public class ST19_14 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Start of Your Turn
  11. if (timing == EffectTiming.OnStartTurn)
  12. {
  13. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  14. }
  15. #endregion
  16. #region Your Turn
  17. if (timing == EffectTiming.OnEnterFieldAnyone)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Give played Digimon <Rush>", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  22. cardEffects.Add(activateClass);
  23. string EffectDescription()
  24. {
  25. return
  26. "[Your Turn] When an effects plays one of your Tokens or a Digimon with the [Puppet] trait, by suspending this Tamer, that Digimon gains <Rush> for the turn.";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card) &&
  31. CardEffectCommons.IsOwnerTurn(card) &&
  32. CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition) &&
  33. CardEffectCommons.IsByEffect(hashtable, null);
  34. }
  35. bool PermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  38. (permanent.IsToken ||
  39. permanent.IsDigimon && permanent.TopCard.ContainsTraits("Puppet"));
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleArea(card) &&
  44. CardEffectCommons.CanActivateSuspendCostEffect(card);
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable hashtable)
  47. {
  48. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  49. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  50. List<Permanent> playedPermanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  51. hashtable: hashtable,
  52. rootCondition: null)
  53. .Filter(PermanentCondition);
  54. if (playedPermanents.Count > 0)
  55. {
  56. if(playedPermanents.Count > 1)
  57. {
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: PermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. bool CanTargetCondition_ByPreSelecetedList(List<Permanent> permanents, Permanent permanent)
  73. {
  74. return playedPermanents.Contains(permanent);
  75. }
  76. }
  77. else
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(SelectPermanentCoroutine(playedPermanents[0]));
  80. }
  81. }
  82. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  85. targetPermanent: permanent,
  86. effectDuration: EffectDuration.UntilEachTurnEnd,
  87. activateClass: activateClass));
  88. }
  89. }
  90. }
  91. #endregion
  92. #region Security Effect
  93. if (timing == EffectTiming.SecuritySkill)
  94. {
  95. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  96. }
  97. #endregion
  98. return cardEffects;
  99. }
  100. }
  101. }