EX6_074.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using Photon.Pun;
  5. using System.Linq;
  6. using UnityEngine;
  7. namespace DCGO.CardEffects.EX6
  8. {
  9. public class EX6_074 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. #region Your Turn
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Memory +1, Digivolve from trash for 1 cost reduction", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[Your Turn] When one of your Digimon with the [Holy Beast], [Archangel] or [Fallen Angel] trait is played, by suspending this Tamer, gain 1 memory. Then, 1 of your Digimon may digivolve into [Angewomon] or [LadyDevimon] in your trash with the cost reduced by 1.";
  24. }
  25. bool PlayedPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.IsDigimon)
  30. {
  31. if(permanent.TopCard.ContainsTraits("Holy Beast") || permanent.TopCard.ContainsTraits("Archangel") || permanent.TopCard.ContainsTraits("Fallen Angel"))
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  42. {
  43. foreach (CardSource cardSource in card.Owner.TrashCards)
  44. {
  45. if (CanSelectCardCondition(cardSource))
  46. {
  47. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanSelectCardCondition(CardSource cardSource)
  57. {
  58. if (cardSource.IsDigimon)
  59. {
  60. if (cardSource.CardNames.Contains("Angewomon") || cardSource.CardNames.Contains("LadyDevimon"))
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. if (CardEffectCommons.IsExistOnBattleArea(card))
  70. {
  71. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition))
  72. {
  73. if (CardEffectCommons.IsOwnerTurn(card))
  74. {
  75. return true;
  76. }
  77. }
  78. }
  79. return false;
  80. }
  81. bool CanActivateCondition(Hashtable hashtable)
  82. {
  83. if (CardEffectCommons.IsExistOnBattleArea(card))
  84. {
  85. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  86. {
  87. return true;
  88. }
  89. }
  90. return false;
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable hashtable)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  95. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  96. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  97. {
  98. Permanent selectedPermanent = null;
  99. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  100. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  101. selectPermanentEffect.SetUp(
  102. selectPlayer: card.Owner,
  103. canTargetCondition: CanSelectPermanentCondition,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. maxCount: maxCount,
  107. canNoSelect: true,
  108. canEndNotMax: false,
  109. selectPermanentCoroutine: SelectPermanentCoroutine,
  110. afterSelectPermanentCoroutine: null,
  111. mode: SelectPermanentEffect.Mode.Custom,
  112. cardEffect: activateClass);
  113. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  114. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  115. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  116. {
  117. selectedPermanent = permanent;
  118. yield return null;
  119. }
  120. if (selectedPermanent != null)
  121. {
  122. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  123. targetPermanent: selectedPermanent,
  124. cardCondition: CanSelectCardCondition,
  125. payCost: true,
  126. reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
  127. fixedCostTuple: null,
  128. ignoreDigivolutionRequirementFixedCost: -1,
  129. isHand: false,
  130. activateClass: activateClass,
  131. successProcess: null));
  132. }
  133. }
  134. }
  135. }
  136. #endregion
  137. #region End of Your Turn
  138. if (timing == EffectTiming.OnEndTurn)
  139. {
  140. ActivateClass activateClass = new ActivateClass();
  141. activateClass.SetUpICardEffect("DNA digivolve 2 Digimon", CanUseCondition, card);
  142. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  143. activateClass.SetHashString("DNA_EX6_074");
  144. cardEffects.Add(activateClass);
  145. string EffectDiscription()
  146. {
  147. return "[End of Your Turn] [Once Per Turn] 2 of your Digimon may DNA digivolve into a Digimon card in your hand.";
  148. }
  149. bool CanSelectDNACardCondition(CardSource cardSource)
  150. {
  151. if (cardSource.IsDigimon)
  152. {
  153. if (cardSource.CanPlayJogress(true))
  154. {
  155. return true;
  156. }
  157. }
  158. return false;
  159. }
  160. bool CanUseCondition(Hashtable hashtable)
  161. {
  162. return isExistOnField(card);
  163. }
  164. bool CanActivateCondition(Hashtable hashtable)
  165. {
  166. if (CardEffectCommons.IsExistOnBattleArea(card))
  167. {
  168. if (CardEffectCommons.IsOwnerTurn(card))
  169. {
  170. if (card.Owner.HandCards.Count(CanSelectDNACardCondition) >= 1 && card.Owner.GetBattleAreaDigimons().Count >= 2)
  171. {
  172. return true;
  173. }
  174. }
  175. }
  176. return false;
  177. }
  178. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  179. {
  180. yield return ContinuousController.instance.StartCoroutine(
  181. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  182. CanSelectDNACardCondition,
  183. payCost: true,
  184. isHand: true,
  185. activateClass
  186. ));
  187. }
  188. }
  189. #endregion
  190. #region Security
  191. if (timing == EffectTiming.SecuritySkill)
  192. {
  193. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  194. }
  195. #endregion
  196. return cardEffects;
  197. }
  198. }
  199. }