EX6_003.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_003 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region When Attacking - ESS
  13. if (timing == EffectTiming.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(
  17. "Add 1 card from top of security to hand to place 1 card from hand at the bottom of security",
  18. CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  20. activateClass.SetIsInheritedEffect(true);
  21. activateClass.SetHashString("Attacking_EX6_003");
  22. cardEffects.Add(activateClass);
  23. string EffectDescription()
  24. {
  25. return
  26. "[When Attacking] [Once Per Turn] By adding the top card of your security stack to the hand, you may place 1 Digimon card with the [Angel]/[Archangel]/[Three Great Angels] trait from your hand at the bottom of your security stack.";
  27. }
  28. bool CanSelectCardCondition(CardSource cardSource)
  29. {
  30. if (cardSource.IsDigimon)
  31. {
  32. if ((cardSource.ContainsTraits("Angel") && !cardSource.ContainsTraits("Fallen Angel")) ||
  33. cardSource.ContainsTraits("Archangel") ||
  34. cardSource.ContainsTraits("Three Great Angels") ||
  35. cardSource.ContainsTraits("ThreeGreatAngels"))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. if (card.Owner.SecurityCards.Count >= 1)
  51. {
  52. return true;
  53. }
  54. }
  55. return false;
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. if (card.Owner.SecurityCards.Count >= 1)
  60. {
  61. CardSource topCard = card.Owner.SecurityCards[0];
  62. yield return ContinuousController.instance.StartCoroutine(
  63. CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false,
  64. activateClass));
  65. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  66. player: card.Owner,
  67. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  68. activateClass).ReduceSecurity());
  69. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  70. {
  71. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  72. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  73. selectHandEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectCardCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: true,
  80. canEndNotMax: false,
  81. isShowOpponent: true,
  82. selectCardCoroutine: SelectCardCoroutine,
  83. afterSelectCardCoroutine: null,
  84. mode: SelectHandEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of security.",
  87. "The opponent is selecting 1 card to place at the bottom of security.");
  88. selectHandEffect.SetUpCustomMessage_ShowCard("Security Bottom Card");
  89. yield return StartCoroutine(selectHandEffect.Activate());
  90. IEnumerator SelectCardCoroutine(CardSource cardSource)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(
  93. CardObjectController.AddSecurityCard(cardSource, toTop: false));
  94. }
  95. }
  96. }
  97. }
  98. }
  99. #endregion
  100. return cardEffects;
  101. }
  102. }
  103. }