BT19_082.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_082 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Start of Your Turn
  11. if (timing == EffectTiming.OnStartTurn)
  12. {
  13. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  14. }
  15. #endregion
  16. #region Your Turn
  17. if (timing == EffectTiming.OnAllyAttack)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Place a card from hand as the bottom digivolution card of 1 of our Digimon", CanUseCondition,
  21. card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  23. cardEffects.Add(activateClass);
  24. string EffectDescription()
  25. {
  26. return
  27. "[Your Turn] When any of your Digimon with [Aqua]/[Sea Animal] in one of its traits attack, by suspending this Tamer, you may place 1 level 5 or lower Digimon card with [Aqua]/[Sea Animal] in one of its traits from your hand as that Digimon's bottom digivolution card.";
  28. }
  29. bool AttackingPermanent(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  32. permanent.TopCard.HasAquaTraits;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleArea(card) &&
  37. CardEffectCommons.IsOwnerTurn(card) &&
  38. CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, AttackingPermanent);
  39. }
  40. bool CanSelectHandCardCondition(CardSource cardSource)
  41. {
  42. return cardSource.IsDigimon &&
  43. cardSource.HasLevel && cardSource.Level <= 5 &&
  44. cardSource.HasAquaTraits;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleArea(card) &&
  49. CardEffectCommons.CanActivateSuspendCostEffect(card);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(
  54. new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() },
  55. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  56. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(GManager.instance.attackProcess.AttackingPermanent))
  57. {
  58. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardCondition))
  59. {
  60. List<CardSource> selectedCards = new List<CardSource>();
  61. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  62. selectHandEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectHandCardCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: true,
  69. canEndNotMax: false,
  70. isShowOpponent: true,
  71. selectCardCoroutine: SelectCardCoroutine,
  72. afterSelectCardCoroutine: null,
  73. mode: SelectHandEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  76. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  77. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  78. yield return StartCoroutine(selectHandEffect.Activate());
  79. IEnumerator SelectCardCoroutine(CardSource cardSource)
  80. {
  81. selectedCards.Add(cardSource);
  82. yield return null;
  83. }
  84. if (selectedCards.Count >= 1)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.AttackingPermanent
  87. .AddDigivolutionCardsBottom(selectedCards, activateClass));
  88. }
  89. }
  90. }
  91. }
  92. }
  93. #endregion
  94. #region Security Effect
  95. if (timing == EffectTiming.SecuritySkill)
  96. {
  97. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  98. }
  99. #endregion
  100. return cardEffects;
  101. }
  102. }
  103. }