BT20_009.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_009 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Your Turn
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Digivolve into [Free] digimon", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Your Turn] When any of your purple Digimon are played, this Digimon may digivolve into a Digimon card with the [Free] trait in the hand with the digivolution cost reduced by 1.";
  21. }
  22. bool PermanentCondition(Permanent permanent)
  23. {
  24. if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  25. {
  26. if(permanent.TopCard.CardColors.Contains(CardColor.Purple))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  36. {
  37. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  38. {
  39. if (CardEffectCommons.IsOwnerTurn(card))
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  50. {
  51. return true;
  52. }
  53. return false;
  54. }
  55. bool CanSelectCardCondition(CardSource source)
  56. {
  57. if (source.EqualsTraits("Free"))
  58. {
  59. if (source.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  71. targetPermanent: card.PermanentOfThisCard(),
  72. cardCondition: CanSelectCardCondition,
  73. payCost: true,
  74. reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
  75. fixedCostTuple: null,
  76. ignoreDigivolutionRequirementFixedCost: -1,
  77. isHand: true,
  78. activateClass: activateClass,
  79. successProcess: null)
  80. );
  81. }
  82. }
  83. }
  84. #endregion
  85. #region InheritedEffect
  86. if (timing == EffectTiming.None)
  87. {
  88. bool InheritedEffectCondition()
  89. {
  90. return CardEffectCommons.IsOwnerTurn(card);
  91. }
  92. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  93. changeValue: 2000,
  94. isInheritedEffect: true,
  95. card: card,
  96. condition: InheritedEffectCondition));
  97. }
  98. #endregion
  99. return cardEffects;
  100. }
  101. }
  102. }