BT25_095.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Paradise Colosseum
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_095 : 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 All Turns - Security DP
  32. if (timing == EffectTiming.None)
  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.Green))
  38. && permanent.TopCard.HasTSTraits;
  39. }
  40. #region +2k DP
  41. bool CanUseCondition()
  42. {
  43. return CardEffectCommons.IsExistInSecurity(card, false);
  44. }
  45. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  46. permanentCondition: PermanentCondition,
  47. changeValue: 2000,
  48. isInheritedEffect: false,
  49. card: card,
  50. condition: CanUseCondition,
  51. effectName: () => "All of your red or green [TS] trait Digimon get +2000 DP."));
  52. #endregion
  53. }
  54. #endregion
  55. #region Rush
  56. if (timing == EffectTiming.None)
  57. {
  58. bool PermanentCondition(Permanent permanent)
  59. {
  60. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  61. && (permanent.TopCard.CardColors.Contains(CardColor.Red) || permanent.TopCard.CardColors.Contains(CardColor.Green))
  62. && permanent.TopCard.HasTSTraits;
  63. }
  64. bool HasBearBro(Permanent permanent)
  65. {
  66. return permanent.TopCard.EqualsCardName("Marsmon")
  67. || permanent.TopCard.EqualsCardName("Callismon");
  68. }
  69. bool Condition()
  70. {
  71. return CardEffectCommons.IsExistInSecurity(card, false)
  72. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasBearBro);
  73. }
  74. cardEffects.Add(CardEffectFactory.RushStaticEffect(PermanentCondition, false, card, Condition));
  75. }
  76. #endregion
  77. #endregion
  78. #region Main Effect
  79. if (timing == EffectTiming.OptionSkill)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("Replace your bottom sec with this face-up card, play a [TS] Digimon for -3", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  84. cardEffects.Add(activateClass);
  85. string EffectDescription()
  86. {
  87. 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 green [TS] trait Digimon card from your hand with the play cost reduced by 3.";
  88. }
  89. bool CanUseCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  92. }
  93. bool CanSelectCardCondition(CardSource cardSource)
  94. {
  95. return cardSource.IsDigimon
  96. && (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Green))
  97. && cardSource.HasTSTraits
  98. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, true, activateClass, fixedCost: cardSource.GetCostItself - 3);
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable hashtable)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectFactory.ReplaceBottomSecurityWithFaceUpOptionEffect(card, activateClass));
  103. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  106. canTargetCondition: CanSelectCardCondition,
  107. SelectCardEffect.Root.Hand,
  108. activateClass,
  109. payCost: true,
  110. reduceCostTuple: (3, null)
  111. ));
  112. }
  113. }
  114. }
  115. #endregion
  116. #region Security Effect
  117. if (timing == EffectTiming.SecuritySkill)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect($"Play 1 lvl 4- Red or Green [TS] Digimon card from hand", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  122. activateClass.SetIsSecurityEffect(true);
  123. cardEffects.Add(activateClass);
  124. string EffectDescription()
  125. => "[Security] You may play 1 level 4 or lower red or green [TS] trait Digimon card from your hand or trash without paying the cost.";
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  129. }
  130. bool CanPlayCondition(CardSource cardSource)
  131. {
  132. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 4
  133. && (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Green))
  134. && cardSource.HasTSTraits
  135. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable hashtable)
  138. {
  139. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlayCondition);
  140. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlayCondition);
  141. if (canSelectHand || canSelectTrash)
  142. {
  143. if (canSelectHand && canSelectTrash)
  144. {
  145. List<SelectionElement<int>> selectionElements1 = new List<SelectionElement<int>>()
  146. {
  147. new (message: $"From hand", value : 1, spriteIndex: 0),
  148. new (message: $"From trash", value : 2, spriteIndex: 1),
  149. new (message: $"Don't play", value: 3, spriteIndex: 2)
  150. };
  151. string selectPlayerMessage1 = "From which area will you play a card?";
  152. string notSelectPlayerMessage1 = "The opponent is choosing from which area to select a card.";
  153. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  154. }
  155. else
  156. {
  157. GManager.instance.userSelectionManager.SetInt(canSelectHand ? 1 : 2);
  158. }
  159. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  160. bool doPlay = GManager.instance.userSelectionManager.SelectedIntValue != 3;
  161. SelectCardEffect.Root root = GManager.instance.userSelectionManager.SelectedIntValue == 1 ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash;
  162. if (doPlay)
  163. {
  164. #region Hand/Trash Card Selection & Play
  165. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  166. canTargetCondition: CanPlayCondition,
  167. root,
  168. activateClass,
  169. payCost: false
  170. ));
  171. #endregion
  172. }
  173. }
  174. }
  175. }
  176. #endregion
  177. return cardEffects;
  178. }
  179. }
  180. }