BT25_094.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Cosmic Area
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_094 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Ignore Color Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  17. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  18. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  19. cardEffects.Add(ignoreColorConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return card.Owner.SecurityCards.Count(cardSource => !cardSource.IsFlipped) == 0;
  23. }
  24. bool CardCondition(CardSource cardSource)
  25. {
  26. return cardSource == card;
  27. }
  28. }
  29. #endregion
  30. #region All Turns - Security
  31. #region Alliance
  32. if (timing == EffectTiming.OnAllyAttack)
  33. {
  34. bool PermanentCondition(Permanent permanent)
  35. {
  36. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  37. && (permanent.TopCard.CardColors.Contains(CardColor.Red) || permanent.TopCard.CardColors.Contains(CardColor.Blue))
  38. && permanent.TopCard.HasTSTraits;
  39. }
  40. bool CanUseCondition()
  41. {
  42. return CardEffectCommons.IsExistInSecurity(card, false);
  43. }
  44. cardEffects.Add(CardEffectFactory.AllianceStaticEffect(PermanentCondition, false, card, CanUseCondition));
  45. }
  46. #endregion
  47. #region Rush
  48. if (timing == EffectTiming.None)
  49. {
  50. bool PermanentCondition(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  53. && (permanent.TopCard.CardColors.Contains(CardColor.Red) || permanent.TopCard.CardColors.Contains(CardColor.Blue))
  54. && permanent.TopCard.HasTSTraits;
  55. }
  56. bool HasOXII(Permanent permanent)
  57. {
  58. return permanent.TopCard.EqualsCardName("Apollomon")
  59. || permanent.TopCard.EqualsCardName("Dianamon");
  60. }
  61. bool Condition()
  62. {
  63. return CardEffectCommons.IsExistInSecurity(card, false)
  64. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasOXII);
  65. }
  66. cardEffects.Add(CardEffectFactory.RushStaticEffect(PermanentCondition, false, card, Condition));
  67. }
  68. #endregion
  69. #endregion
  70. #region Main Effect
  71. if (timing == EffectTiming.OptionSkill)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect("Replace your bottom sec with this face-up card, play a [TS] Digimon for -3", CanUseCondition, card);
  75. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  76. cardEffects.Add(activateClass);
  77. string EffectDescription()
  78. {
  79. return "[Main] Add your bottom security card to the hand and place this card face up as the bottom security card. Then, you may play 1 red or blue [TS] trait Digimon card from your hand with the play cost reduced by 3.";
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  84. }
  85. bool CanSelectCardCondition(CardSource cardSource)
  86. {
  87. return cardSource.IsDigimon
  88. && (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Blue))
  89. && cardSource.HasTSTraits
  90. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, true, activateClass, fixedCost: cardSource.GetCostItself - 3);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable hashtable)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(CardEffectFactory.ReplaceBottomSecurityWithFaceUpOptionEffect(card, activateClass));
  95. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  96. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  97. selectHandEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectCardCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: true,
  104. canEndNotMax: false,
  105. isShowOpponent: true,
  106. selectCardCoroutine: null,
  107. afterSelectCardCoroutine: null,
  108. mode: SelectHandEffect.Mode.PlayForCost,
  109. cardEffect: activateClass);
  110. selectHandEffect.SetReducedCostTuple((3, null));
  111. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  112. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  113. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  114. }
  115. }
  116. #endregion
  117. #region Security Effect
  118. if (timing == EffectTiming.SecuritySkill)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect($"Play 1 lvl 4- Red or Blue [TS] Digimon card from hand", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  123. activateClass.SetIsSecurityEffect(true);
  124. cardEffects.Add(activateClass);
  125. string EffectDescription()
  126. => "[Security] You may play 1 level 4 or lower red or blue [TS] trait Digimon card from your hand or trash without paying the cost.";
  127. bool CanUseCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  130. }
  131. bool CanPlayCondition(CardSource cardSource)
  132. {
  133. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 4
  134. && (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Blue))
  135. && cardSource.HasTSTraits
  136. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  137. }
  138. IEnumerator ActivateCoroutine(Hashtable hashtable)
  139. {
  140. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlayCondition);
  141. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlayCondition);
  142. if (canSelectHand || canSelectTrash)
  143. {
  144. if (canSelectHand && canSelectTrash)
  145. {
  146. List<SelectionElement<int>> selectionElements1 = new List<SelectionElement<int>>()
  147. {
  148. new (message: $"From hand", value : 1, spriteIndex: 0),
  149. new (message: $"From trash", value : 2, spriteIndex: 1),
  150. new (message: $"Don't play", value: 3, spriteIndex: 2)
  151. };
  152. string selectPlayerMessage1 = "From which area will you play a card?";
  153. string notSelectPlayerMessage1 = "The opponent is choosing from which area to select a card.";
  154. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  155. }
  156. else
  157. {
  158. GManager.instance.userSelectionManager.SetInt(canSelectHand ? 1 : 2);
  159. }
  160. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  161. bool fromHand = GManager.instance.userSelectionManager.SelectedIntValue == 1;
  162. bool fromTrash = GManager.instance.userSelectionManager.SelectedIntValue == 2;
  163. if (fromHand)
  164. {
  165. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  166. selectHandEffect.SetUp(
  167. selectPlayer: card.Owner,
  168. canTargetCondition: CanPlayCondition,
  169. canTargetCondition_ByPreSelecetedList: null,
  170. canEndSelectCondition: null,
  171. maxCount: 1,
  172. canNoSelect: true,
  173. canEndNotMax: false,
  174. isShowOpponent: true,
  175. selectCardCoroutine: null,
  176. afterSelectCardCoroutine: null,
  177. mode: SelectHandEffect.Mode.PlayForFree,
  178. cardEffect: activateClass);
  179. selectHandEffect.SetUpCustomMessage("Select 1 digimon to play", "The opponent is selecting 1 digimon to play");
  180. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  181. }
  182. if (fromTrash)
  183. {
  184. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  185. selectCardEffect.SetUp(
  186. canTargetCondition: CanPlayCondition,
  187. canTargetCondition_ByPreSelecetedList: null,
  188. canEndSelectCondition: null,
  189. canNoSelect: () => true,
  190. selectCardCoroutine: null,
  191. afterSelectCardCoroutine: null,
  192. message: "Select 1 digimon to play",
  193. maxCount: 1,
  194. canEndNotMax: false,
  195. isShowOpponent: true,
  196. mode: SelectCardEffect.Mode.PlayForFree,
  197. root: SelectCardEffect.Root.Trash,
  198. customRootCardList: null,
  199. canLookReverseCard: true,
  200. selectPlayer: card.Owner,
  201. cardEffect: activateClass);
  202. selectCardEffect.SetUpCustomMessage("Select 1 digimon to play", "The opponent is selecting 1 digimon to play");
  203. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Digimon");
  204. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  205. }
  206. }
  207. }
  208. }
  209. #endregion
  210. return cardEffects;
  211. }
  212. }
  213. }