EX3_020.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.EX3
  8. {
  9. public class EX3_020 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.CardNames.Contains("Coredramon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  23. {
  24. cardEffects.Add(CardEffectFactory.EvadeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. if (timing == EffectTiming.None)
  27. {
  28. AddJogressLevelsClass addJogressLevelsClass = new AddJogressLevelsClass();
  29. addJogressLevelsClass.SetUpICardEffect("Also treated as level 6 for DNA Digivolution", CanUseCondition, card);
  30. addJogressLevelsClass.SetUpAddJogressLevelsClass(AddJogressLevels);
  31. cardEffects.Add(addJogressLevelsClass);
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (CardEffectCommons.IsOwnerTurn(card))
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. List<int> AddJogressLevels(CardSource cardSource, Permanent permanent)
  44. {
  45. List<int> levels = new List<int>();
  46. if (permanent == card.PermanentOfThisCard())
  47. {
  48. if (cardSource != null)
  49. {
  50. if (cardSource.Owner == card.Owner)
  51. {
  52. if (cardSource.Owner.HandCards.Contains(cardSource))
  53. {
  54. if (cardSource.CardNames.Contains("Examon"))
  55. {
  56. levels.Add(6);
  57. }
  58. }
  59. }
  60. }
  61. }
  62. return levels;
  63. }
  64. }
  65. if (timing == EffectTiming.OnEndTurn)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[End of Your Turn] This Digimon and 1 of your other Digimon with [Dramon] in its name may DNA digivolve into a Digimon card in your hand by paying its DNA digivolve cost.";
  74. }
  75. bool CanSelectCardCondition(CardSource cardSource)
  76. {
  77. if (cardSource != null)
  78. {
  79. if (cardSource.IsDigimon)
  80. {
  81. if (cardSource.Owner == card.Owner)
  82. {
  83. if (cardSource.CanPlayJogress(true))
  84. {
  85. if (isExistOnField(card))
  86. {
  87. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  88. {
  89. foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
  90. {
  91. if (permanent.TopCard.HasDramonName)
  92. {
  93. if (permanent != card.PermanentOfThisCard())
  94. {
  95. if (cardSource.CanJogressFromTargetPermanent(permanent, true))
  96. {
  97. if (cardSource.CanJogressFromTargetPermanents(new List<Permanent>() { card.PermanentOfThisCard(), permanent }, true))
  98. {
  99. return true;
  100. }
  101. }
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. if (isExistOnField(card))
  116. {
  117. return true;
  118. }
  119. return false;
  120. }
  121. bool CanActivateCondition(Hashtable hashtable)
  122. {
  123. if (CardEffectCommons.IsExistOnBattleArea(card))
  124. {
  125. if (CardEffectCommons.IsOwnerTurn(card))
  126. {
  127. if (card.Owner.HandCards.Count >= 1)
  128. {
  129. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard() && permanent.TopCard.HasDramonName))
  130. {
  131. return true;
  132. }
  133. }
  134. }
  135. }
  136. return false;
  137. }
  138. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  139. {
  140. if (isExistOnField(card))
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(
  143. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  144. CanSelectCardCondition,
  145. payCost: true,
  146. isHand: true,
  147. activateClass,
  148. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard(), (permanent) => permanent != card.PermanentOfThisCard() && permanent.TopCard.HasDramonName }
  149. ));
  150. }
  151. }
  152. }
  153. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  154. {
  155. bool Condition()
  156. {
  157. if (CardEffectCommons.IsExistOnBattleArea(card))
  158. {
  159. if (card.PermanentOfThisCard().TopCard.HasDramonName)
  160. {
  161. return true;
  162. }
  163. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Examon"))
  164. {
  165. return true;
  166. }
  167. }
  168. return false;
  169. }
  170. cardEffects.Add(CardEffectFactory.EvadeSelfEffect(isInheritedEffect: true, card: card, condition: Condition));
  171. }
  172. return cardEffects;
  173. }
  174. }
  175. }