BT24_089.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //Unique Emblem: Blazing Conductor
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_089 : 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("Play 1 [Elizamon]/[Owen Dreadnought] from hand or trash, then place in battle area", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return "[Main] You may play 1 [Elizamon] or [Owen Dreadnought] from your hand or 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 CanSelectCardCondition(CardSource cardSource)
  28. {
  29. return (cardSource.EqualsCardName("Elizamon")
  30. || cardSource.EqualsCardName("Owen Dreadnought"))
  31. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  32. }
  33. IEnumerator ActivateCoroutine(Hashtable hashtable)
  34. {
  35. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  36. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  37. if (canSelectHand || canSelectTrash)
  38. {
  39. #region Setup Location Selection
  40. if (canSelectHand && canSelectTrash)
  41. {
  42. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  43. {
  44. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  45. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  46. };
  47. string selectPlayerMessage = "From which area do you select a card?";
  48. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  49. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  50. }
  51. else
  52. {
  53. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  54. }
  55. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  56. #endregion
  57. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  58. CardSource selectedCard = null;
  59. IEnumerator SelectCardCoroutine(CardSource cardSource)
  60. {
  61. selectedCard = cardSource;
  62. yield return null;
  63. }
  64. #region Hand/Trash Card Selection & Play
  65. if (fromHand)
  66. {
  67. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  68. selectHandEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectCardCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: 1,
  74. canNoSelect: true,
  75. canEndNotMax: false,
  76. isShowOpponent: true,
  77. selectCardCoroutine: SelectCardCoroutine,
  78. afterSelectCardCoroutine: null,
  79. mode: SelectHandEffect.Mode.Custom,
  80. cardEffect: activateClass);
  81. selectHandEffect.SetUpCustomMessage("Select 1 [Elizamon]/[Owen Dreadnought] to play.", "The opponent is selecting 1 [Elizamon]/[Owen Dreadnought] to play.");
  82. yield return StartCoroutine(selectHandEffect.Activate());
  83. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(
  84. CardEffectCommons.PlayPermanentCards(new List<CardSource>() { selectedCard }, activateClass, false, false, SelectCardEffect.Root.Hand, true));
  85. }
  86. else
  87. {
  88. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  89. selectCardEffect.SetUp(
  90. canTargetCondition: CanSelectCardCondition,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. canNoSelect: () => true,
  94. selectCardCoroutine: SelectCardCoroutine,
  95. afterSelectCardCoroutine: null,
  96. message: "Select 1 [Elizamon]/[Owen Dreadnought] to play.",
  97. maxCount: 1,
  98. canEndNotMax: false,
  99. isShowOpponent: true,
  100. mode: SelectCardEffect.Mode.Custom,
  101. root: SelectCardEffect.Root.Trash,
  102. customRootCardList: null,
  103. canLookReverseCard: true,
  104. selectPlayer: card.Owner,
  105. cardEffect: activateClass);
  106. selectCardEffect.SetUpCustomMessage("Select 1 [Elizamon]/[Owen Dreadnought] to play.", "The opponent is selecting 1 [Elizamon]/[Owen Dreadnought] to play.");
  107. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  108. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(
  109. CardEffectCommons.PlayPermanentCards(new List<CardSource>() { selectedCard }, activateClass, false, false, SelectCardEffect.Root.Trash, true));
  110. }
  111. #endregion
  112. }
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  114. }
  115. }
  116. #endregion
  117. #region Your turn - Delay
  118. if (timing == EffectTiming.OnTappedAnyone)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("1 of your [Dragonkin] or [Reptile] trait Digimon may digivolve", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  123. cardEffects.Add(activateClass);
  124. string EffectDescription()
  125. {
  126. return "[Your Turn] When any of your [Owen Dreadnought] suspend, <Delay> (By trashing this card after the placing turn, activate the effect below.)\r\n・1 of your [Dragonkin] or [Reptile] trait Digimon may digivolve into a [Dragonkin] or [Reptile] and [LIBERATOR] trait Digimon card in the hand with the digivolution cost reduced by 3.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnBattleArea(card)
  131. && CardEffectCommons.CanDeclareOptionDelayEffect(card)
  132. && CardEffectCommons.IsOwnerTurn(card)
  133. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsOwenDreadnought);
  134. }
  135. bool CanActivateCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.IsExistOnBattleArea(card);
  138. }
  139. bool IsOwenDreadnought(Permanent permanent)
  140. {
  141. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  142. && permanent.TopCard.EqualsCardName("Owen Dreadnought");
  143. }
  144. bool PermanentCondition(Permanent permanent)
  145. {
  146. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  147. && (permanent.TopCard.EqualsTraits("Reptile")
  148. || permanent.TopCard.EqualsTraits("Dragonkin"));
  149. }
  150. bool CardCondition(CardSource cardSource)
  151. {
  152. return cardSource.IsDigimon
  153. && (cardSource.EqualsTraits("Reptile")
  154. || cardSource.EqualsTraits("Dragonkin"))
  155. && cardSource.HasLiberatorTraits;
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable hashtable)
  158. {
  159. bool delaySuccessful = false;
  160. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  161. IEnumerator SuccessProcess()
  162. {
  163. delaySuccessful = true;
  164. yield return null;
  165. }
  166. if (delaySuccessful)
  167. {
  168. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  169. {
  170. Permanent selectedDigimon = null;
  171. #region Select Permanent
  172. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, PermanentCondition));
  173. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: PermanentCondition,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: maxCount,
  180. canNoSelect: true,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: SelectPermanentCoroutine,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Custom,
  185. cardEffect: activateClass);
  186. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  187. {
  188. selectedDigimon = permanent;
  189. yield return null;
  190. }
  191. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve", "The opponent is selecting 1 Digimon to digivolve");
  192. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  193. #endregion
  194. if (selectedDigimon != null) yield return ContinuousController.instance.StartCoroutine(
  195. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  196. targetPermanent: selectedDigimon,
  197. cardCondition: CardCondition,
  198. payCost: true,
  199. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  200. fixedCostTuple: null,
  201. ignoreDigivolutionRequirementFixedCost: -1,
  202. isHand: true,
  203. activateClass: activateClass,
  204. successProcess: null
  205. )
  206. );
  207. }
  208. }
  209. }
  210. }
  211. #endregion
  212. #region Security Effect
  213. if (timing == EffectTiming.SecuritySkill)
  214. {
  215. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  216. card: card,
  217. cardEffects: ref cardEffects,
  218. effectName: "Play 1 [Elizamon]/[Owen Dreadnought] from hand or trash, then place in battle area");
  219. }
  220. #endregion
  221. return cardEffects;
  222. }
  223. }
  224. }