BT21_024.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_024 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Shared OP / WD
  12. string SharedEffectName = "Opponent places 1 card from hand in security bottom. Trash their security top";
  13. string SharedEffectDescription(string tag) => $"[{tag}] If your opponent has 5 or fewer security cards, they place 1 card from their hand as the bottom security card. Then, trash their top security card.";
  14. bool CanSelectCardCondition(CardSource cardSource) => true;
  15. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  16. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  17. {
  18. CardSource selectedCard = null;
  19. if (card.Owner.Enemy.SecurityCards.Count <= 5 && card.Owner.Enemy.HandCards.Count() >= 1)
  20. {
  21. int maxCount = 1;
  22. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  23. selectHandEffect.SetUp(
  24. selectPlayer: card.Owner.Enemy,
  25. canTargetCondition: CanSelectCardCondition,
  26. canTargetCondition_ByPreSelecetedList: null,
  27. canEndSelectCondition: null,
  28. maxCount: maxCount,
  29. canNoSelect: false,
  30. canEndNotMax: false,
  31. isShowOpponent: false,
  32. selectCardCoroutine: SelectCardCoroutine,
  33. afterSelectCardCoroutine: null,
  34. mode: SelectHandEffect.Mode.Custom,
  35. cardEffect: activateClass);
  36. selectHandEffect.SetUpCustomMessage(
  37. "Select 1 card to place at the bottom of security.",
  38. "The opponent is selecting 1 card to place at the bottom of security.");
  39. selectHandEffect.SetNotShowCard();
  40. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  41. IEnumerator SelectCardCoroutine(CardSource cardSource)
  42. {
  43. selectedCard = cardSource;
  44. yield return null;
  45. }
  46. }
  47. if (selectedCard != null)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard, toTop: false));
  50. }
  51. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  52. player: card.Owner.Enemy,
  53. destroySecurityCount: 1,
  54. cardEffect: activateClass,
  55. fromTop: true).DestroySecurity());
  56. }
  57. #endregion
  58. #region On Play
  59. if (timing == EffectTiming.OnEnterFieldAnyone)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  63. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  64. cardEffects.Add(activateClass);
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  68. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  69. }
  70. }
  71. #endregion
  72. #region When Digivolving
  73. if (timing == EffectTiming.OnEnterFieldAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  77. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  78. cardEffects.Add(activateClass);
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  82. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  83. }
  84. }
  85. #endregion
  86. #region Your Turn Inherited
  87. if (timing == EffectTiming.None)
  88. {
  89. bool Condition()
  90. {
  91. return CardEffectCommons.IsOwnerTurn(card);
  92. }
  93. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  94. changeValue: 4000,
  95. isInheritedEffect: true,
  96. card: card,
  97. condition: Condition));
  98. }
  99. #endregion
  100. return cardEffects;
  101. }
  102. }
  103. }