ST13_04.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class ST13_04 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. bool Condition()
  16. {
  17. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  18. }
  19. bool PermanentCondition(Permanent targetPermanent)
  20. {
  21. return targetPermanent == card.PermanentOfThisCard();
  22. }
  23. bool CardSourceCondition(CardSource cardSource)
  24. {
  25. if (cardSource.Owner.HandCards.Contains(cardSource))
  26. {
  27. if (cardSource.CardTraits.Contains("Legend-Arms"))
  28. {
  29. return true;
  30. }
  31. if (cardSource.HasCardColor(CardColor.Black))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool RootCondition(SelectCardEffect.Root root)
  39. {
  40. return root == SelectCardEffect.Root.Hand;
  41. }
  42. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  43. changeValue: -1,
  44. permanentCondition: PermanentCondition,
  45. cardCondition: CardSourceCondition,
  46. rootCondition: RootCondition,
  47. isInheritedEffect: false,
  48. card: card,
  49. condition: Condition,
  50. setFixedCost: false));
  51. }
  52. if (timing == EffectTiming.OnEndTurn)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  57. activateClass.SetIsInheritedEffect(true);
  58. cardEffects.Add(activateClass);
  59. string EffectDiscription()
  60. {
  61. return "[End of Your Turn] You may DNA digivolve this Digimon and one of your other Digimon in play into a Digimon card in your hand by paying its DNA digivolve cost.";
  62. }
  63. bool CanSelectCardCondition(CardSource cardSource)
  64. {
  65. if (cardSource != null)
  66. {
  67. if (cardSource.IsDigimon)
  68. {
  69. if (cardSource.Owner == card.Owner)
  70. {
  71. if (cardSource.CanPlayJogress(true))
  72. {
  73. if (isExistOnField(card))
  74. {
  75. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  76. {
  77. return true;
  78. }
  79. }
  80. }
  81. }
  82. }
  83. }
  84. return false;
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. if (isExistOnField(card))
  89. {
  90. return true;
  91. }
  92. return false;
  93. }
  94. bool CanActivateCondition(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.IsExistOnBattleArea(card))
  97. {
  98. if (CardEffectCommons.IsOwnerTurn(card))
  99. {
  100. if (card.Owner.HandCards.Count >= 1)
  101. {
  102. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  103. {
  104. return true;
  105. }
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  112. {
  113. if (isExistOnField(card))
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(
  116. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  117. CanSelectCardCondition,
  118. payCost: true,
  119. isHand: true,
  120. activateClass,
  121. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  122. ));
  123. }
  124. }
  125. }
  126. return cardEffects;
  127. }
  128. }