BT23_003.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Motimon
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_003 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  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, EffectDiscription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("BT23_003_YT");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] [Once Per Turn] When any of your [CS] trait Option cards are placed in the battle area, this Digimon may attack.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  26. && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  31. && CardEffectCommons.IsOwnerTurn(card);
  32. }
  33. bool PermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  36. && permanent.IsOption
  37. && permanent.TopCard.HasCSTraits;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. if (card.PermanentOfThisCard().CanAttack(activateClass))
  42. {
  43. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  44. selectAttackEffect.SetUp(
  45. attacker: card.PermanentOfThisCard(),
  46. canAttackPlayerCondition: () => true,
  47. defenderCondition: (permanent) => true,
  48. cardEffect: activateClass);
  49. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  50. }
  51. }
  52. }
  53. return cardEffects;
  54. }
  55. }
  56. }