EX6_034.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6. namespace DCGO.CardEffects.EX6
  7. {
  8. public class EX6_034 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. if ((targetPermanent.TopCard.ContainsCardName("Turuiemon")) || (targetPermanent.TopCard.ContainsCardName("Wendigomon")))
  19. {
  20. return true;
  21. }
  22. return false;
  23. }
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region Alliance
  28. if (timing == EffectTiming.OnAllyAttack)
  29. {
  30. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  31. }
  32. #endregion
  33. #region When Digivolving
  34. if (timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Play 1 Digimon from hand", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  39. activateClass.SetHashString("Play1Digimon_EX6_034");
  40. cardEffects.Add(activateClass);
  41. string EffectDiscription()
  42. {
  43. return "[When Digivolving] You may play 1 level 3 green or yellow Digimon card from your hand without paying the cost.";
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.IsExistOnBattleArea(card))
  52. {
  53. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanSelectCardCondition(CardSource cardSource)
  61. {
  62. if (CardEffectCommons.IsExistOnHand(cardSource))
  63. {
  64. if (cardSource.IsDigimon && cardSource.Level == 3 && cardSource.HasCardColor(CardColor.Green))
  65. {
  66. return true;
  67. }
  68. if (cardSource.IsDigimon && cardSource.Level == 3 && cardSource.HasCardColor(CardColor.Yellow))
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable hashtable)
  76. {
  77. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  78. {
  79. List<CardSource> selectedCards = new List<CardSource>();
  80. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  81. selectHandEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectCardCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: 1,
  87. canNoSelect: true,
  88. canEndNotMax: false,
  89. isShowOpponent: true,
  90. selectCardCoroutine: SelectCardCoroutine,
  91. afterSelectCardCoroutine: null,
  92. mode: SelectHandEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  95. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  96. yield return StartCoroutine(selectHandEffect.Activate());
  97. IEnumerator SelectCardCoroutine(CardSource cardSource)
  98. {
  99. selectedCards.Add(cardSource);
  100. yield return null;
  101. }
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  103. }
  104. }
  105. }
  106. #endregion
  107. #region Inherit
  108. if (timing == EffectTiming.OnEndAttack)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect("Return 1 of your suspend Digimon to play 1 Digimon from hand", CanUseCondition, card);
  112. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  113. activateClass.SetIsInheritedEffect(true);
  114. activateClass.SetHashString("EndofAttack_EX6_034");
  115. cardEffects.Add(activateClass);
  116. string EffectDiscription()
  117. {
  118. return "[End of Attack][Once Per Turn] By returning 1 of your other suspended Digimon to the hand, you may play 1 level 3 card with the [Beast] trait from your hand without paying the cost.";
  119. }
  120. bool CanSelectPermanentCondition(Permanent permanent)
  121. {
  122. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  123. {
  124. if (permanent.IsDigimon && permanent.IsSuspended)
  125. {
  126. if(permanent != card.PermanentOfThisCard())
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. if (CardEffectCommons.IsExistOnBattleArea(card))
  139. {
  140. return true;
  141. }
  142. return false;
  143. }
  144. bool CanSelectCardCondition(CardSource cardSource)
  145. {
  146. if (CardEffectCommons.IsExistOnHand(cardSource))
  147. {
  148. if (cardSource.IsDigimon && cardSource.Level == 3 && cardSource.CardTraits.Contains("Beast"))
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  156. {
  157. Permanent bounceTargetPermanent = null;
  158. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  159. selectPermanentEffect.SetUp(
  160. selectPlayer: card.Owner,
  161. canTargetCondition: CanSelectPermanentCondition,
  162. canTargetCondition_ByPreSelecetedList: null,
  163. canEndSelectCondition: null,
  164. maxCount: 1,
  165. canNoSelect: true,
  166. canEndNotMax: false,
  167. selectPermanentCoroutine: SelectPermanentCoroutine,
  168. afterSelectPermanentCoroutine: null,
  169. mode: SelectPermanentEffect.Mode.Custom,
  170. cardEffect: activateClass);
  171. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to return to hand.", "The opponent is selecting 1 Digimon to return to hand.");
  172. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  173. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  174. {
  175. bounceTargetPermanent = permanent;
  176. yield return null;
  177. }
  178. if (bounceTargetPermanent != null)
  179. {
  180. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  181. targetPermanents: new List<Permanent>() { bounceTargetPermanent },
  182. activateClass: activateClass,
  183. successProcess: SuccessProcess(),
  184. failureProcess: null));
  185. IEnumerator SuccessProcess()
  186. {
  187. List<CardSource> selectedCards = new List<CardSource>();
  188. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  189. selectHandEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectCardCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: 1,
  195. canNoSelect: true,
  196. canEndNotMax: false,
  197. isShowOpponent: true,
  198. selectCardCoroutine: SelectCardCoroutine,
  199. afterSelectCardCoroutine: null,
  200. mode: SelectHandEffect.Mode.Custom,
  201. cardEffect: activateClass);
  202. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  203. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  204. yield return StartCoroutine(selectHandEffect.Activate());
  205. IEnumerator SelectCardCoroutine(CardSource cardSource)
  206. {
  207. selectedCards.Add(cardSource);
  208. yield return null;
  209. }
  210. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  211. }
  212. }
  213. }
  214. }
  215. #endregion
  216. return cardEffects;
  217. }
  218. }
  219. }