BT25_102.cs 9.1 KB

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