BT20_004.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_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("Digivolve, for reduced cost of 2", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("Digivolve_BT20-004");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] [Once Per Turn] When any of your Digimon with the [ACCEL] trait are played, this Digimon may digivolve into a Digimon card with the [ACCEL] trait in the hand with the digivolution cost reduced by 2.";
  22. }
  23. bool IsYourAccelDigimon(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  26. permanent.TopCard.EqualsTraits("ACCEL");
  27. }
  28. bool IsYourAccelDigivolve(CardSource source)
  29. {
  30. return source.EqualsTraits("ACCEL") &&
  31. source.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, true,activateClass);
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsOwnerTurn(card))
  36. {
  37. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  38. CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsYourAccelDigimon);
  39. }
  40. return false;
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  45. CardEffectCommons.HasMatchConditionOwnersHand(card, IsYourAccelDigivolve);
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  50. targetPermanent: card.PermanentOfThisCard(),
  51. cardCondition: IsYourAccelDigivolve,
  52. payCost: true,
  53. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  54. fixedCostTuple: null,
  55. ignoreDigivolutionRequirementFixedCost: -1,
  56. isHand: true,
  57. activateClass: activateClass,
  58. successProcess: null));
  59. }
  60. }
  61. #endregion
  62. return cardEffects;
  63. }
  64. }
  65. }