GospeloftheFallenAngel_BT18_100.cs 11 KB

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