P_232.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //Unique Emblem: Melting Recital
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_232 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Main
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal 3, add 1 [Evil]/[Dark Dragon]/[Evil Dragon] trait and 1 [Liberator] trait, bot deck the rest, place in battle area.", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Reveal the top 3 cards of your deck. Add 1 [Evil], [Dark Dragon] or [Evil Dragon] trait Digimon card and 1 [LIBERATOR] trait card among them to the hand. Return the rest to the bottom of the deck. Then, place this card in the battle area.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  26. }
  27. bool CanSelectCardCondition(CardSource cardSource)
  28. {
  29. return cardSource.EqualsTraits("Evil")
  30. || cardSource.EqualsTraits("Dark Dragon")
  31. || cardSource.EqualsTraits("Evil Dragon");
  32. }
  33. bool CanSelectCardCondition1(CardSource cardSource)
  34. {
  35. return cardSource.EqualsTraits("LIBERATOR");
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  40. revealCount: 3,
  41. simplifiedSelectCardConditions:
  42. new SimplifiedSelectCardConditionClass[]
  43. {
  44. new SimplifiedSelectCardConditionClass(
  45. canTargetCondition:CanSelectCardCondition,
  46. message: "Select 1 [Evil]/[Dark Dragon]/[Evil Dragon] trait card.",
  47. mode: SelectCardEffect.Mode.AddHand,
  48. maxCount: 1,
  49. selectCardCoroutine: null),
  50. new SimplifiedSelectCardConditionClass(
  51. canTargetCondition:CanSelectCardCondition1,
  52. message: "Select 1 [LIBERATOR] trait card.",
  53. mode: SelectCardEffect.Mode.AddHand,
  54. maxCount: 1,
  55. selectCardCoroutine: null),
  56. },
  57. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  58. activateClass: activateClass));
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  60. }
  61. }
  62. #endregion
  63. #region Your turn - Delay
  64. if (timing == EffectTiming.OnEnterFieldAnyone)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Digivolve into a level 6 or lower [LIBERATOR] Digimon for 3 less.", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[Your Turn] When any of your [Yuuki]s are played, <Delay>.\r\n 1 of your Digimon may digivolve into a level 6 or lower [LIBERATOR] trait card in the hand with the digivolution cost reduced by 3.";
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.IsExistOnBattleArea(card)
  77. && CardEffectCommons.CanDeclareOptionDelayEffect(card)
  78. && CardEffectCommons.IsOwnerTurn(card)
  79. && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition);
  80. }
  81. bool CanActivateCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.IsExistOnBattleArea(card);
  84. }
  85. bool PlayedPermanentCondition(Permanent permanent)
  86. {
  87. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  88. && permanent.TopCard.EqualsCardName("Yuuki");
  89. }
  90. bool PermanentCondition(Permanent permanent)
  91. {
  92. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  93. }
  94. bool CanSelectCardCondition(CardSource cardSource)
  95. {
  96. return cardSource.IsDigimon
  97. && cardSource.HasLevel
  98. && cardSource.Level <= 6
  99. && cardSource.HasLiberatorTraits;
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable hashtable)
  102. {
  103. bool delaySuccessful = false;
  104. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  105. IEnumerator SuccessProcess()
  106. {
  107. delaySuccessful = true;
  108. yield return null;
  109. }
  110. if (delaySuccessful)
  111. {
  112. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  113. {
  114. Permanent selectedDigimon = null;
  115. #region Select Permanent
  116. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, PermanentCondition));
  117. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  118. selectPermanentEffect.SetUp(
  119. selectPlayer: card.Owner,
  120. canTargetCondition: PermanentCondition,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. maxCount: maxCount,
  124. canNoSelect: true,
  125. canEndNotMax: false,
  126. selectPermanentCoroutine: SelectPermanentCoroutine,
  127. afterSelectPermanentCoroutine: null,
  128. mode: SelectPermanentEffect.Mode.Custom,
  129. cardEffect: activateClass);
  130. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  131. {
  132. selectedDigimon = permanent;
  133. yield return null;
  134. }
  135. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve", "The opponent is selecting 1 Digimon to digivolve");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. #endregion
  138. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  139. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  140. if (canSelectHand || canSelectTrash)
  141. {
  142. if (canSelectHand && canSelectTrash)
  143. {
  144. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  145. {
  146. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  147. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  148. };
  149. string selectPlayerMessage = "From which area do you digivolve a card?";
  150. string notSelectPlayerMessage = "The opponent is choosing from which area to digivolve a card.";
  151. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  152. }
  153. else
  154. {
  155. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  156. }
  157. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  158. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  160. targetPermanent: selectedDigimon,
  161. cardCondition: CanSelectCardCondition,
  162. payCost: true,
  163. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  164. fixedCostTuple: null,
  165. ignoreDigivolutionRequirementFixedCost: -1,
  166. isHand: fromHand,
  167. activateClass: activateClass,
  168. successProcess: null));
  169. }
  170. }
  171. }
  172. }
  173. }
  174. #endregion
  175. #region Security Effect
  176. if (timing == EffectTiming.SecuritySkill)
  177. {
  178. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  179. card: card,
  180. cardEffects: ref cardEffects,
  181. effectName: "Reveal 3, add 1 [Evil]/[Dark Dragon]/[Evil Dragon] trait and 1 [Liberator] trait, bot deck the rest, place in battle area.");
  182. }
  183. #endregion
  184. return cardEffects;
  185. }
  186. }
  187. }