BT24_031.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Elecmon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_031 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("TS")
  18. && targetPermanent.TopCard.IsLevel2;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region On Play
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Reveal 3, Add 1 [Iliad] trait, and 1 [TS] trait", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  29. cardEffects.Add(activateClass);
  30. string EffectDescription()
  31. {
  32. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Iliad] trait and 1 card with [TS] trait among them to the hand. Return the rest to the bottom of the deck.";
  33. }
  34. bool HasIliad(CardSource source)
  35. {
  36. return source.EqualsTraits("Iliad");
  37. }
  38. bool HasTS(CardSource source)
  39. {
  40. return source.EqualsTraits("TS");
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerOnPlay(hashtable, card)
  45. && CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (card.Owner.LibraryCards.Count > 0)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  56. revealCount: 3,
  57. simplifiedSelectCardConditions:
  58. new SimplifiedSelectCardConditionClass[]
  59. {
  60. new SimplifiedSelectCardConditionClass(
  61. canTargetCondition:HasIliad,
  62. message: "Select 1 [Iliad] trait card.",
  63. mode: SelectCardEffect.Mode.AddHand,
  64. maxCount: 1,
  65. selectCardCoroutine: null),
  66. new SimplifiedSelectCardConditionClass(
  67. canTargetCondition:HasTS,
  68. message: "Select 1 [TS] trait card.",
  69. mode: SelectCardEffect.Mode.AddHand,
  70. maxCount: 1,
  71. selectCardCoroutine: null),
  72. },
  73. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  74. activateClass: activateClass
  75. ));
  76. }
  77. }
  78. }
  79. #endregion
  80. #region When Attacking - Inherited
  81. if (timing == EffectTiming.OnAllyAttack)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("May add 1 sec card to hand, if at 0 <Recovery +1>.", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  86. activateClass.SetHashString("BT24_031_Inherited");
  87. activateClass.SetIsInheritedEffect(true);
  88. cardEffects.Add(activateClass);
  89. string EffectDescription()
  90. {
  91. return "[When Attacking] [Once Per Turn] You may add your top security card to the hand. Then, if you have 0 security cards, <Recovery +1 (Deck)>.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanTriggerOnAttack(hashtable, card)
  96. && CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  97. }
  98. bool CanActivateCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  103. {
  104. if (card.Owner.SecurityCards.Count > 0)
  105. {
  106. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  107. {
  108. new SelectionElement<bool>(message: $"Add to hand", value : true, spriteIndex: 0),
  109. new SelectionElement<bool>(message: $"Not add to hand", value : false, spriteIndex: 1),
  110. };
  111. string selectPlayerMessage = "Will you add the card to hand?";
  112. string notSelectPlayerMessage = "The opponent is choosing whether to add the card to hand.";
  113. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  114. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  115. bool addHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  116. if (addHand)
  117. {
  118. CardSource topCard = card.Owner.SecurityCards[0];
  119. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  120. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  121. player: card.Owner,
  122. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  123. activateClass).ReduceSecurity());
  124. }
  125. }
  126. if (card.Owner.SecurityCards.Count == 0)
  127. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  128. }
  129. }
  130. #endregion
  131. return cardEffects;
  132. }
  133. }
  134. }