EX6_063.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_063 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Main Phase/ On Play Shared
  12. bool IsOwnerYellowDigimonSharedCondition(Permanent permanent)
  13. {
  14. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  15. {
  16. return permanent.TopCard.CardColors.Contains(CardColor.Yellow);
  17. }
  18. return false;
  19. }
  20. bool CanActivateSharedCondition(Hashtable hashtable)
  21. {
  22. if (CardEffectCommons.IsExistOnBattleArea(card))
  23. {
  24. if (CardEffectCommons.HasMatchConditionPermanent(IsOwnerYellowDigimonSharedCondition))
  25. {
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. #endregion
  32. #region On Play
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect(
  37. "1 of your yellow Digimon gains [Barrier] until the end of your opponent's turn.", CanUseCondition,
  38. card);
  39. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false,
  40. EffectDescription());
  41. cardEffects.Add(activateClass);
  42. string EffectDescription()
  43. {
  44. return
  45. "[On Play] 1 of your yellow Digimon gains [Barrier] until the end of your opponent's turn.";
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (isExistOnField(card))
  54. {
  55. if (CardEffectCommons.HasMatchConditionPermanent(IsOwnerYellowDigimonSharedCondition))
  56. {
  57. Permanent selectedPermanent = null;
  58. int maxCount = Math.Min(1,
  59. CardEffectCommons.MatchConditionPermanentCount(IsOwnerYellowDigimonSharedCondition));
  60. SelectPermanentEffect selectPermanentEffect =
  61. GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: IsOwnerYellowDigimonSharedCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Barrier.",
  75. "The opponent is selecting 1 Digimon that will gain Barrier.");
  76. yield return ContinuousController.instance.StartCoroutine(
  77. selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  79. {
  80. selectedPermanent = permanent;
  81. yield return null;
  82. }
  83. if(selectedPermanent != null)
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBarrier(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  85. }
  86. }
  87. }
  88. }
  89. #endregion
  90. #region Start of Your Main Phase
  91. if (timing == EffectTiming.OnStartMainPhase)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect(
  95. "1 of your yellow Digimon gains [Barrier] until the end of your opponent's turn.", CanUseCondition,
  96. card);
  97. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false,
  98. EffectDescription());
  99. cardEffects.Add(activateClass);
  100. string EffectDescription()
  101. {
  102. return
  103. "[Start Of Your Main Phase] 1 of your yellow Digimon gains [Barrier] until the end of your opponent's turn.";
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (CardEffectCommons.IsOwnerTurn(card))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. IEnumerator ActivateCoroutine(Hashtable hashtable)
  117. {
  118. if (isExistOnField(card))
  119. {
  120. if (CardEffectCommons.HasMatchConditionPermanent(IsOwnerYellowDigimonSharedCondition))
  121. {
  122. Permanent selectedPermanent = null;
  123. int maxCount = Math.Min(1,
  124. CardEffectCommons.MatchConditionPermanentCount(IsOwnerYellowDigimonSharedCondition));
  125. SelectPermanentEffect selectPermanentEffect =
  126. GManager.instance.GetComponent<SelectPermanentEffect>();
  127. selectPermanentEffect.SetUp(
  128. selectPlayer: card.Owner,
  129. canTargetCondition: IsOwnerYellowDigimonSharedCondition,
  130. canTargetCondition_ByPreSelecetedList: null,
  131. canEndSelectCondition: null,
  132. maxCount: maxCount,
  133. canNoSelect: false,
  134. canEndNotMax: false,
  135. selectPermanentCoroutine: SelectPermanentCoroutine,
  136. afterSelectPermanentCoroutine: null,
  137. mode: SelectPermanentEffect.Mode.Custom,
  138. cardEffect: activateClass);
  139. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Barrier.",
  140. "The opponent is selecting 1 Digimon that will gain Barrier.");
  141. yield return ContinuousController.instance.StartCoroutine(
  142. selectPermanentEffect.Activate());
  143. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  144. {
  145. selectedPermanent = permanent;
  146. yield return null;
  147. }
  148. if (selectedPermanent != null)
  149. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBarrier(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  150. }
  151. }
  152. }
  153. }
  154. #endregion
  155. #region Your Turn
  156. if (timing == EffectTiming.OnEnterFieldAnyone)
  157. {
  158. ActivateClass activateClass = new ActivateClass();
  159. activateClass.SetUpICardEffect("Gain 1 Memory", CanUseCondition,
  160. card);
  161. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
  162. EffectDescription());
  163. cardEffects.Add(activateClass);
  164. string EffectDescription()
  165. {
  166. return "[Your Turn] When one of your Digimon is played or digivolves, if it has the [Angel]/[Archangel]/[Three Great Angels] trait, by suspending this Tamer, gain 1 memory.";
  167. }
  168. bool PermanentCondition(Permanent permanent)
  169. {
  170. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  171. {
  172. return permanent.TopCard.HasAngelTraitRestrictive;
  173. }
  174. return false;
  175. }
  176. bool CanUseCondition(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.IsExistOnBattleArea(card))
  179. {
  180. if (CardEffectCommons.IsOwnerTurn(card))
  181. {
  182. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition) ||
  183. CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  184. {
  185. return true;
  186. }
  187. }
  188. }
  189. return false;
  190. }
  191. bool CanActivateCondition(Hashtable hashtable)
  192. {
  193. if (CardEffectCommons.IsExistOnBattleArea(card))
  194. {
  195. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  196. {
  197. return true;
  198. }
  199. }
  200. return false;
  201. }
  202. IEnumerator ActivateCoroutine(Hashtable hashtable)
  203. {
  204. yield return ContinuousController.instance.StartCoroutine(
  205. new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() },
  206. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  207. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  208. }
  209. }
  210. #endregion
  211. #region Security Effect
  212. if (timing == EffectTiming.SecuritySkill)
  213. {
  214. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  215. }
  216. #endregion
  217. return cardEffects;
  218. }
  219. }
  220. }