BT17_019.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using System;
  6. using Photon.Pun;
  7. namespace DCGO.CardEffects.BT17
  8. {
  9. public class BT17_019 : 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
  15. if (timing == EffectTiming.None)
  16. {
  17. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.EqualsCardName("Tsunomon");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false,
  23. card: card, condition: null));
  24. }
  25. #endregion
  26. #region Start of Your Main Phase
  27. if (timing == EffectTiming.OnStartMainPhase)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  32. EffectDescription());
  33. cardEffects.Add(activateClass);
  34. string EffectDescription()
  35. {
  36. return
  37. "[Start of Your Main Phase] If you have a Tamer with [Matt Ishida] in its name, [Draw 1].";
  38. }
  39. bool OwnTamerPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  42. {
  43. if (permanent.IsTamer)
  44. {
  45. if (permanent.TopCard.ContainsCardName("Matt Ishida") || permanent.TopCard.ContainsCardName("MattIshida"))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. if (CardEffectCommons.IsOwnerTurn(card))
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, OwnTamerPermanentCondition))
  69. {
  70. if (card.Owner.LibraryCards.Count >= 1)
  71. {
  72. return true;
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable hashtable)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(
  81. new DrawClass(card.Owner, 1, activateClass).Draw());
  82. }
  83. }
  84. #endregion
  85. #region End of Your Turn - ESS
  86. if (timing == EffectTiming.OnEndTurn)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
  91. EffectDescription());
  92. activateClass.SetIsInheritedEffect(true);
  93. cardEffects.Add(activateClass);
  94. string EffectDescription()
  95. {
  96. return
  97. "[End of Your Turn] This Digimon and another of your Digimon may DNA digivolve into a Digimon card in the hand.";
  98. }
  99. bool CanSelectCardCondition(CardSource cardSource)
  100. {
  101. if (cardSource != null)
  102. {
  103. if (cardSource.IsDigimon)
  104. {
  105. if (cardSource.Owner == card.Owner)
  106. {
  107. if (cardSource.CanPlayJogress(true))
  108. {
  109. if (isExistOnField(card))
  110. {
  111. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  112. {
  113. return true;
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }
  120. return false;
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. if (isExistOnField(card))
  125. {
  126. return true;
  127. }
  128. return false;
  129. }
  130. bool CanActivateCondition(Hashtable hashtable)
  131. {
  132. if (CardEffectCommons.IsExistOnBattleArea(card))
  133. {
  134. if (CardEffectCommons.IsOwnerTurn(card))
  135. {
  136. if (card.Owner.HandCards.Count >= 1)
  137. {
  138. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card,
  139. (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  140. {
  141. return true;
  142. }
  143. }
  144. }
  145. }
  146. return false;
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable hashtable)
  149. {
  150. if (isExistOnField(card))
  151. {
  152. yield return ContinuousController.instance.StartCoroutine(
  153. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  154. CanSelectCardCondition,
  155. payCost: true,
  156. isHand: true,
  157. activateClass,
  158. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  159. ));
  160. }
  161. }
  162. }
  163. #endregion
  164. return cardEffects;
  165. }
  166. }
  167. }