BT25_094.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  98. canTargetCondition: CanSelectCardCondition,
  99. SelectCardEffect.Root.Hand,
  100. activateClass,
  101. payCost: true,
  102. reduceCostTuple: (3, null)
  103. ));
  104. }
  105. }
  106. }
  107. #endregion
  108. #region Security Effect
  109. if (timing == EffectTiming.SecuritySkill)
  110. {
  111. ActivateClass activateClass = new ActivateClass();
  112. activateClass.SetUpICardEffect($"Play 1 lvl 4- Red or Blue [TS] Digimon card from hand", CanUseCondition, card);
  113. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  114. activateClass.SetIsSecurityEffect(true);
  115. cardEffects.Add(activateClass);
  116. string EffectDescription()
  117. => "[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.";
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  121. }
  122. bool CanPlayCondition(CardSource cardSource)
  123. {
  124. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 4
  125. && (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Blue))
  126. && cardSource.HasTSTraits
  127. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable hashtable)
  130. {
  131. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlayCondition);
  132. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlayCondition);
  133. if (canSelectHand || canSelectTrash)
  134. {
  135. if (canSelectHand && canSelectTrash)
  136. {
  137. List<SelectionElement<int>> selectionElements1 = new List<SelectionElement<int>>()
  138. {
  139. new (message: $"From hand", value : 1, spriteIndex: 0),
  140. new (message: $"From trash", value : 2, spriteIndex: 1),
  141. new (message: $"Don't play", value: 3, spriteIndex: 2)
  142. };
  143. string selectPlayerMessage1 = "From which area will you play a card?";
  144. string notSelectPlayerMessage1 = "The opponent is choosing from which area to select a card.";
  145. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  146. }
  147. else
  148. {
  149. GManager.instance.userSelectionManager.SetInt(canSelectHand ? 1 : 2);
  150. }
  151. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  152. bool doPlay = GManager.instance.userSelectionManager.SelectedIntValue != 3;
  153. SelectCardEffect.Root root = GManager.instance.userSelectionManager.SelectedIntValue == 1 ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash;
  154. if (doPlay)
  155. {
  156. #region Hand/Trash Card Selection & Play
  157. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  158. canTargetCondition: CanPlayCondition,
  159. root,
  160. activateClass,
  161. payCost: false
  162. ));
  163. #endregion
  164. }
  165. }
  166. }
  167. }
  168. #endregion
  169. return cardEffects;
  170. }
  171. }
  172. }