BT25_001.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Tokomon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_001 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Inherited
  12. if (timing == EffectTiming.OnAllyAttack)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("If [TS] trait, <Draw 1>", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  17. activateClass.SetHashString("BT25_001_Inherited");
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDescription()
  21. {
  22. return "[When Attacking] [Once Per Turn] If this Digimon has the [TS] trait, <Draw 1>.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  27. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  32. }
  33. IEnumerator ActivateCoroutine(Hashtable hashtable)
  34. {
  35. bool hasUsed = false;
  36. if (card.PermanentOfThisCard().TopCard.EqualsTraits("TS"))
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(new DrawClass(
  39. player: card.Owner,
  40. drawCount: 1,
  41. cardEffect: activateClass).Draw()
  42. );
  43. hasUsed = true;
  44. }
  45. if (!hasUsed) activateClass.RemoveUse();
  46. }
  47. }
  48. #endregion
  49. return cardEffects;
  50. }
  51. }
  52. }