BT21_046.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using Photon.Pun;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using UnityEngine;
  7. namespace DCGO.CardEffects.BT21
  8. {
  9. public class BT21_046 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. #region Alternate Digivolution Condition
  15. if (timing == EffectTiming.None)
  16. {
  17. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.EqualsCardName("Dracomon");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Start of Your Main Phase
  25. if (timing == EffectTiming.OnStartMainPhase)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("This Digimon may digivolve in the hand without paying the cost.", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[Start of Your Main Phase] This Digimon may digivolve into [Coredramon] in the hand without paying the cost.";
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  42. }
  43. bool CanDigivolveIntoCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.IsDigimon && cardSource.EqualsCardName("Coredramon") &&
  46. cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, true, activateClass);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(
  51. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  52. targetPermanent: card.PermanentOfThisCard(),
  53. cardCondition: CanDigivolveIntoCardCondition,
  54. payCost: false,
  55. reduceCostTuple: null,
  56. fixedCostTuple: null,
  57. ignoreDigivolutionRequirementFixedCost: -1,
  58. isHand: true,
  59. activateClass: activateClass,
  60. successProcess: null));
  61. }
  62. }
  63. #endregion
  64. #region When Digivolving
  65. if (timing == EffectTiming.OnEnterFieldAnyone)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("This Digimon may digivolve in the hand without paying the cost.", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[When Digivolving] This Digimon may digivolve into [Coredramon] in the hand without paying the cost.";
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  82. }
  83. bool CanDigivolveIntoCardCondition(CardSource cardSource)
  84. {
  85. return cardSource.IsDigimon && cardSource.EqualsCardName("Coredramon") &&
  86. cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, true, activateClass);
  87. }
  88. IEnumerator ActivateCoroutine(Hashtable hashtable)
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(
  91. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  92. targetPermanent: card.PermanentOfThisCard(),
  93. cardCondition: CanDigivolveIntoCardCondition,
  94. payCost: false,
  95. reduceCostTuple: null,
  96. fixedCostTuple: null,
  97. ignoreDigivolutionRequirementFixedCost: -1,
  98. isHand: true,
  99. activateClass: activateClass,
  100. successProcess: null));
  101. }
  102. }
  103. #endregion
  104. #region Inherit
  105. if (timing == EffectTiming.OnEndTurn)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  110. activateClass.SetIsInheritedEffect(true);
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[End of Your Turn] This Digimon and any of your other Digimon may DNA digivolve into a Digimon card in the hand.";
  115. }
  116. bool CanSelectCardCondition(CardSource cardSource)
  117. {
  118. if (cardSource != null)
  119. {
  120. if (cardSource.IsDigimon)
  121. {
  122. if (cardSource.Owner == card.Owner)
  123. {
  124. if (cardSource.CanPlayJogress(true))
  125. {
  126. if (isExistOnField(card))
  127. {
  128. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  129. {
  130. return true;
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137. return false;
  138. }
  139. bool CanUseCondition(Hashtable hashtable)
  140. {
  141. if (isExistOnField(card))
  142. {
  143. return true;
  144. }
  145. return false;
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  150. {
  151. if (CardEffectCommons.IsOwnerTurn(card))
  152. {
  153. if (card.Owner.HandCards.Count >= 1)
  154. {
  155. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  156. {
  157. return true;
  158. }
  159. }
  160. }
  161. }
  162. return false;
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  165. {
  166. if (isExistOnField(card))
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(
  169. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  170. CanSelectCardCondition,
  171. payCost: true,
  172. isHand: true,
  173. activateClass,
  174. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  175. ));
  176. }
  177. }
  178. }
  179. #endregion
  180. return cardEffects;
  181. }
  182. }
  183. }