BT17_044.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT17
  4. {
  5. public class BT17_044 : 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
  11. if (timing == EffectTiming.None)
  12. {
  13. bool Condition()
  14. {
  15. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  16. }
  17. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent == card.PermanentOfThisCard();
  20. }
  21. bool CardSourceCondition(CardSource cardSource)
  22. {
  23. return cardSource.CardNames.Contains("Eosmon");
  24. }
  25. bool RootCondition(SelectCardEffect.Root root)
  26. {
  27. return true;
  28. }
  29. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  30. changeValue: -1,
  31. permanentCondition: PermanentCondition,
  32. cardCondition: CardSourceCondition,
  33. rootCondition: RootCondition,
  34. isInheritedEffect: false,
  35. card: card,
  36. condition: Condition,
  37. setFixedCost: false));
  38. }
  39. #endregion
  40. #region Your Turn - Once Per Turn - Inherit
  41. if (timing == EffectTiming.OnEnterFieldAnyone)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Digivolve for reduced cost", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  46. activateClass.SetHashString("DigivolveEosmonBT17_044");
  47. activateClass.SetIsInheritedEffect(true);
  48. cardEffects.Add(activateClass);
  49. string EffectDiscription()
  50. {
  51. return "[Your Turn] [Once Per Turn] When one of your other [Eosmon] is played, this Digimon may digivolve into [Eosmon] in your hand with the digivolution cost reduced by 3.";
  52. }
  53. bool PermanentCondition(Permanent permanent)
  54. {
  55. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  56. {
  57. if (permanent.TopCard.EqualsCardName("Eosmon"))
  58. {
  59. if (permanent != card.PermanentOfThisCard())
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanSelectEosmonInHand(CardSource cardSource)
  66. {
  67. if (cardSource.EqualsCardName("Eosmon"))
  68. {
  69. if (cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, true, activateClass))
  70. {
  71. return true;
  72. }
  73. }
  74. return false;
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  79. {
  80. if (CardEffectCommons.IsOwnerTurn(card))
  81. {
  82. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. return false;
  89. }
  90. bool CanActivateCondition(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  93. {
  94. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectEosmonInHand))
  95. return true;
  96. }
  97. return false;
  98. }
  99. IEnumerator ActivateCoroutine(Hashtable hashtable)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  102. targetPermanent: card.PermanentOfThisCard(),
  103. cardCondition: CanSelectEosmonInHand,
  104. payCost: true,
  105. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  106. fixedCostTuple: null,
  107. ignoreDigivolutionRequirementFixedCost: -1,
  108. isHand: true,
  109. activateClass: activateClass,
  110. successProcess: null));
  111. }
  112. }
  113. #endregion
  114. return cardEffects;
  115. }
  116. }
  117. }