BT25_099.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Gear Forest Village
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_099 : 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.Green) || permanent.TopCard.CardColors.Contains(CardColor.Black))
  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 Piercing
  48. if (timing == EffectTiming.None)
  49. {
  50. bool PermanentCondition(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  53. && (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Black))
  54. && permanent.TopCard.HasTSTraits;
  55. }
  56. AddSkillClass addSkillClass = new AddSkillClass();
  57. addSkillClass.SetUpICardEffect("Your Digimon gain Piercing", CanUseCondition, card);
  58. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects, limitTiming: EffectTiming.OnDetermineDoSecurityCheck);
  59. cardEffects.Add(addSkillClass);
  60. bool HasOXII(Permanent permanent)
  61. {
  62. return permanent.TopCard.EqualsCardName("Bacchusmon")
  63. || permanent.TopCard.EqualsCardName("Ceresmon");
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.IsExistInSecurity(card, false)
  68. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasOXII);
  69. }
  70. bool CardSourceCondition(CardSource cardSource)
  71. {
  72. if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
  73. {
  74. if (cardSource.Owner == card.Owner)
  75. {
  76. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  77. {
  78. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  79. {
  80. return true;
  81. }
  82. }
  83. }
  84. }
  85. return false;
  86. }
  87. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  88. {
  89. if (_timing == EffectTiming.OnDetermineDoSecurityCheck)
  90. {
  91. bool Condition()
  92. {
  93. return true;
  94. }
  95. cardEffects.Add(CardEffectFactory.PierceSelfEffect(false, cardSource, Condition));
  96. }
  97. return cardEffects;
  98. }
  99. }
  100. #endregion
  101. #endregion
  102. #region Main Effect
  103. if (timing == EffectTiming.OptionSkill)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect("Replace your bottom sec with this face-up card, play a [TS] Digimon for -3", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  108. cardEffects.Add(activateClass);
  109. string EffectDescription()
  110. {
  111. 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 green or black [TS] trait Digimon card from your hand with the play cost reduced by 3.";
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  116. }
  117. bool CanSelectCardCondition(CardSource cardSource)
  118. {
  119. return cardSource.IsDigimon
  120. && (cardSource.HasCardColor(CardColor.Green) || cardSource.HasCardColor(CardColor.Black))
  121. && cardSource.HasTSTraits
  122. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, true, activateClass, fixedCost: cardSource.GetCostItself - 3);
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectFactory.ReplaceBottomSecurityWithFaceUpOptionEffect(card, activateClass));
  127. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  128. {
  129. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  130. canTargetCondition: CanSelectCardCondition,
  131. SelectCardEffect.Root.Hand,
  132. activateClass,
  133. payCost: true,
  134. reduceCostTuple: (3, null)
  135. ));
  136. }
  137. }
  138. }
  139. #endregion
  140. #region Security Effect
  141. if (timing == EffectTiming.SecuritySkill)
  142. {
  143. ActivateClass activateClass = new ActivateClass();
  144. activateClass.SetUpICardEffect($"Play 1 lvl 4- Green or Black [TS] Digimon card from hand", CanUseCondition, card);
  145. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  146. activateClass.SetIsSecurityEffect(true);
  147. cardEffects.Add(activateClass);
  148. string EffectDescription()
  149. => "[Security] You may play 1 level 4 or lower green or black [TS] trait Digimon card from your hand or trash without paying the cost.";
  150. bool CanUseCondition(Hashtable hashtable)
  151. {
  152. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  153. }
  154. bool CanPlayCondition(CardSource cardSource)
  155. {
  156. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 4
  157. && (cardSource.HasCardColor(CardColor.Green) || cardSource.HasCardColor(CardColor.Black))
  158. && cardSource.HasTSTraits
  159. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  160. }
  161. IEnumerator ActivateCoroutine(Hashtable hashtable)
  162. {
  163. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlayCondition);
  164. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlayCondition);
  165. if (canSelectHand || canSelectTrash)
  166. {
  167. if (canSelectHand && canSelectTrash)
  168. {
  169. List<SelectionElement<int>> selectionElements1 = new List<SelectionElement<int>>()
  170. {
  171. new (message: $"From hand", value : 1, spriteIndex: 0),
  172. new (message: $"From trash", value : 2, spriteIndex: 1),
  173. new (message: $"Don't play", value: 3, spriteIndex: 2)
  174. };
  175. string selectPlayerMessage1 = "From which area will you play a card?";
  176. string notSelectPlayerMessage1 = "The opponent is choosing from which area to select a card.";
  177. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  178. }
  179. else
  180. {
  181. GManager.instance.userSelectionManager.SetInt(canSelectHand ? 1 : 2);
  182. }
  183. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  184. bool doPlay = GManager.instance.userSelectionManager.SelectedIntValue != 3;
  185. SelectCardEffect.Root root = GManager.instance.userSelectionManager.SelectedIntValue == 1 ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash;
  186. if (doPlay)
  187. {
  188. #region Hand/Trash Card Selection & Play
  189. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  190. canTargetCondition: CanPlayCondition,
  191. root,
  192. activateClass,
  193. payCost: false
  194. ));
  195. #endregion
  196. }
  197. }
  198. }
  199. }
  200. #endregion
  201. return cardEffects;
  202. }
  203. }
  204. }