BT18_100.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_100 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Main Effect
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Your breeding area digimon may digivolve into [Lucemon]", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return
  21. "[Main] Your Digimon in the breeding area may digivolve into [Lucemon] from your trash without paying the cost. Then, place this card in the battle area.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  26. }
  27. bool CanSelectBreedingAreaDigimon(Permanent permanent)
  28. {
  29. return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) &&
  30. permanent.IsDigimon;
  31. }
  32. bool CanSelectCardCondition(CardSource cardSource)
  33. {
  34. return cardSource.IsDigimon && cardSource.EqualsCardName("Lucemon") &&
  35. cardSource.CanPlayCardTargetFrame(
  36. frame: card.Owner.GetBreedingAreaPermanents()[0].PermanentFrame,
  37. PayCost: false,
  38. cardEffect: activateClass,
  39. root: SelectCardEffect.Root.Trash,
  40. isBreedingArea: true);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectBreedingAreaDigimon) >= 1)
  45. {
  46. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  47. {
  48. new(message: "Digivolve in the breeding area", value: true, spriteIndex: 0),
  49. new(message: "Do not digivolve", value: false, spriteIndex: 1),
  50. };
  51. string selectPlayerMessage = "Digivolve into Lucemon in the breeding area?";
  52. string notSelectPlayerMessage = "The opponent is choosing whether to digivolve in the breeding area or not.";
  53. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
  54. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  55. notSelectPlayerMessage: notSelectPlayerMessage);
  56. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  57. .WaitForEndSelect());
  58. if (GManager.instance.userSelectionManager.SelectedBoolValue)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  61. targetPermanent: card.Owner.GetBreedingAreaPermanents()[0],
  62. cardCondition: CanSelectCardCondition,
  63. payCost: false,
  64. reduceCostTuple: null,
  65. fixedCostTuple: null,
  66. ignoreDigivolutionRequirementFixedCost: -1,
  67. isHand: false,
  68. activateClass: activateClass,
  69. successProcess: null));
  70. }
  71. }
  72. yield return ContinuousController.instance.StartCoroutine(
  73. CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  74. }
  75. }
  76. #endregion
  77. #region Delay Effect
  78. if (timing == EffectTiming.OnDeclaration)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("1 of your Digimon digivolves to trash 1 Option card from the opponent's battle area",
  82. CanUseCondition, card);
  83. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  84. cardEffects.Add(activateClass);
  85. string EffectDescription()
  86. {
  87. return
  88. "[Main] <Delay> ・ By digivolving 1 of your Digimon with [Lucemon] in its name into a Digimon card with [Lucemon] in its name from your trash with the digivolution cost reduced by 3, trash 1 Option card in your opponent's battle area.";
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  93. }
  94. bool CanSelectPermanentCondition(Permanent permanent)
  95. {
  96. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  97. permanent.TopCard.ContainsCardName("Lucemon") &&
  98. card.Owner.TrashCards.Where(CanSelectCardCondition).Any(cardSource =>
  99. cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
  100. }
  101. bool CanSelectOptionPermanentCondition(Permanent permanent)
  102. {
  103. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  104. permanent.IsOption;
  105. }
  106. bool CanSelectCardCondition(CardSource cardSource)
  107. {
  108. return cardSource.IsDigimon && cardSource.ContainsCardName("Lucemon");
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable hashtable)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  113. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass,
  114. successProcess: _ => SuccessProcess(), failureProcess: null));
  115. IEnumerator SuccessProcess()
  116. {
  117. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  118. {
  119. Permanent selectedPermanent = null;
  120. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  121. selectPermanentEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectPermanentCondition,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: 1,
  127. canNoSelect: true,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: SelectPermanentCoroutine,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.Custom,
  132. cardEffect: activateClass);
  133. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.",
  134. "The opponent is selecting 1 Digimon that will digivolve.");
  135. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  136. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  137. {
  138. selectedPermanent = permanent;
  139. yield return null;
  140. }
  141. if (selectedPermanent != null)
  142. {
  143. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  144. targetPermanent: selectedPermanent,
  145. cardCondition: CanSelectCardCondition,
  146. payCost: true,
  147. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  148. fixedCostTuple: null,
  149. ignoreDigivolutionRequirementFixedCost: -1,
  150. isHand: false,
  151. activateClass: activateClass,
  152. successProcess: null));
  153. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOptionPermanentCondition))
  154. {
  155. selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  156. selectPermanentEffect.SetUp(
  157. selectPlayer: card.Owner,
  158. canTargetCondition: CanSelectOptionPermanentCondition,
  159. canTargetCondition_ByPreSelecetedList: null,
  160. canEndSelectCondition: null,
  161. maxCount: 1,
  162. canNoSelect: false,
  163. canEndNotMax: false,
  164. selectPermanentCoroutine: null,
  165. afterSelectPermanentCoroutine: null,
  166. mode: SelectPermanentEffect.Mode.Destroy,
  167. cardEffect: activateClass);
  168. selectPermanentEffect.SetUpCustomMessage("Select 1 Option to delete.",
  169. "The opponent is selecting 1 Option to delete.");
  170. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. #endregion
  178. #region Security Effect
  179. if (timing == EffectTiming.SecuritySkill)
  180. {
  181. cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
  182. }
  183. #endregion
  184. return cardEffects;
  185. }
  186. }
  187. }