EX8_004.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_004 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Your Turn - ESS
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("This Digimon may attack", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("Attack_EX8_004");
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "[Your Turn] (Once Per Turn) When any of your other [NSp] trait Digimon are played, if this Digimon has the [NSp] trait, this Digimon may attack.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  27. CardEffectCommons.IsOwnerTurn(card) &&
  28. CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition);
  29. }
  30. bool PlayedPermanentCondition(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  33. permanent.TopCard.EqualsTraits("NSp") &&
  34. permanent != card.PermanentOfThisCard();
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  39. card.PermanentOfThisCard().TopCard.EqualsTraits("NSp") &&
  40. card.PermanentOfThisCard().CanAttack(activateClass);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  45. selectAttackEffect.SetUp(
  46. attacker: card.PermanentOfThisCard(),
  47. canAttackPlayerCondition: () => true,
  48. defenderCondition: _ => true,
  49. cardEffect: activateClass);
  50. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  51. }
  52. }
  53. #endregion
  54. return cardEffects;
  55. }
  56. }
  57. }