EX6_068.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_068 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Main Effect
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "[Main] You may place 1 Digimon card with the [Angel]/[Archangel]/[Three Great Angels] trait from your hand at the bottom of your security stack. Then, place this card in your battle area.";
  23. }
  24. bool CanSelectCardCondition(CardSource cardSource)
  25. {
  26. if (cardSource.IsDigimon)
  27. {
  28. if (cardSource.CardTraits.Contains("Angel") ||
  29. cardSource.CardTraits.Contains("Archangel") ||
  30. cardSource.CardTraits.Contains("Three Great Angels") ||
  31. cardSource.CardTraits.Contains("ThreeGreatAngels"))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  45. {
  46. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  47. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  48. selectHandEffect.SetUp(
  49. selectPlayer: card.Owner,
  50. canTargetCondition: CanSelectCardCondition,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canEndSelectCondition: null,
  53. maxCount: maxCount,
  54. canNoSelect: true,
  55. canEndNotMax: false,
  56. isShowOpponent: true,
  57. selectCardCoroutine: SelectCardCoroutine,
  58. afterSelectCardCoroutine: null,
  59. mode: SelectHandEffect.Mode.Custom,
  60. cardEffect: activateClass);
  61. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of security.",
  62. "The opponent is selecting 1 card to place at the bottom of security.");
  63. selectHandEffect.SetUpCustomMessage_ShowCard("Security Bottom Card");
  64. yield return StartCoroutine(selectHandEffect.Activate());
  65. IEnumerator SelectCardCoroutine(CardSource cardSource)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(
  68. CardObjectController.AddSecurityCard(cardSource, toTop: false));
  69. }
  70. }
  71. yield return ContinuousController.instance.StartCoroutine(
  72. CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  73. }
  74. }
  75. #endregion
  76. #region Delay Effect
  77. if (timing == EffectTiming.OnDestroyedAnyone)
  78. {
  79. ActivateClass activateClass = new ActivateClass();
  80. activateClass.SetUpICardEffect(
  81. "Play 1 card with the [Three Great Angels] trait from your security stack without paying the cost",
  82. CanUseCondition, card);
  83. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDescription());
  84. activateClass.SetHashString("PlaySecurityCard_EX6_068");
  85. cardEffects.Add(activateClass);
  86. string EffectDescription()
  87. {
  88. return
  89. "[All Turns] When one of your Digimon with the [Angel] or [Archangel] trait is deleted, <Delay>.\r\n• Search your security stack. You may play 1 Digimon card with the [Three Great Angels] trait among it without paying the cost. Shuffle your security stack.";
  90. }
  91. bool DeletedPermanentCondition(Permanent permanent)
  92. {
  93. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  94. {
  95. if (permanent.TopCard.CardTraits.Contains("Angel") ||
  96. permanent.TopCard.CardTraits.Contains("Archangel"))
  97. {
  98. return true;
  99. }
  100. }
  101. return false;
  102. }
  103. bool IsThreeGreatAngelsDigimonCard(CardSource cardSource)
  104. {
  105. if (cardSource.IsDigimon)
  106. {
  107. if (cardSource.ContainsTraits("Three Great Angels") ||
  108. cardSource.ContainsTraits("ThreeGreatAngels"))
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.CanDeclareOptionDelayEffect(card))
  118. {
  119. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, DeletedPermanentCondition, activateClass))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable hashtable)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(
  129. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  130. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  131. activateClass: activateClass, successProcess: permanents => SuccessProcess(),
  132. failureProcess: null));
  133. }
  134. IEnumerator SuccessProcess()
  135. {
  136. if (card.Owner.SecurityCards.Count() >= 1)
  137. {
  138. int maxCount = Math.Min(1, card.Owner.SecurityCards.Count(IsThreeGreatAngelsDigimonCard));
  139. List<CardSource> selectedCards = new List<CardSource>();
  140. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  141. selectCardEffect.SetUp(
  142. canTargetCondition: IsThreeGreatAngelsDigimonCard,
  143. canTargetCondition_ByPreSelecetedList: null,
  144. canEndSelectCondition: null,
  145. canNoSelect: () => true,
  146. selectCardCoroutine: SelectCardCoroutine,
  147. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  148. message: "Select 1 Digimon to play.",
  149. maxCount: maxCount,
  150. canEndNotMax: false,
  151. isShowOpponent: true,
  152. mode: SelectCardEffect.Mode.Custom,
  153. root: SelectCardEffect.Root.Security,
  154. customRootCardList: null,
  155. canLookReverseCard: true,
  156. selectPlayer: card.Owner,
  157. cardEffect: activateClass);
  158. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  159. IEnumerator SelectCardCoroutine(CardSource cardSource)
  160. {
  161. selectedCards.Add(cardSource);
  162. yield return null;
  163. }
  164. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  165. {
  166. if (cardSources.Count >= 1)
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  169. player: card.Owner,
  170. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  171. activateClass).ReduceSecurity());
  172. }
  173. yield return null;
  174. }
  175. yield return ContinuousController.instance.StartCoroutine(
  176. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards,
  177. activateClass: activateClass, payCost: false, isTapped: false,
  178. root: SelectCardEffect.Root.Security, activateETB: true));
  179. if (card.Owner.SecurityCards.Count >= 1)
  180. {
  181. ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
  182. card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards);
  183. }
  184. }
  185. }
  186. }
  187. #endregion
  188. #region Security Effect
  189. if (timing == EffectTiming.SecuritySkill)
  190. {
  191. cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
  192. }
  193. #endregion
  194. return cardEffects;
  195. }
  196. }
  197. }