EX3_049.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX3
  4. {
  5. public class EX3_049 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.None)
  11. {
  12. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  13. }
  14. if (timing == EffectTiming.OnEnterFieldAnyone)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("The played Digimon gains Rush", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  19. activateClass.SetIsInheritedEffect(true);
  20. activateClass.SetHashString("GainRush_EX3_049");
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[Your Turn][Once Per Turn] When you play another Digimon with [D-Brigade] in its traits, it gains <Rush> for the turn. (This Digimon may attack the turn it was played.)";
  25. }
  26. bool PermanentCondition(Permanent permanent)
  27. {
  28. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  29. {
  30. if (permanent != card.PermanentOfThisCard())
  31. {
  32. if (permanent.TopCard.CardTraits.Contains("D-Brigade"))
  33. {
  34. return true;
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.IsOwnerTurn(card))
  45. {
  46. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. return true;
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  65. hashtable: _hashtable,
  66. rootCondition: null);
  67. if (permanents != null)
  68. {
  69. foreach (Permanent permanent in permanents.Filter(PermanentCondition).Clone())
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  72. targetPermanent: permanent,
  73. effectDuration: EffectDuration.UntilEachTurnEnd,
  74. activateClass: activateClass));
  75. }
  76. }
  77. }
  78. }
  79. return cardEffects;
  80. }
  81. }
  82. }