BT19_028.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_028 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Security Attack +1, Blocker
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(
  14. changeValue: 1,
  15. isInheritedEffect: false,
  16. card: card,
  17. condition: null));
  18. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  19. isInheritedEffect: false,
  20. card: card,
  21. condition: null));
  22. }
  23. #endregion
  24. #region When Digivolving
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect(
  29. "Unsuspend 1 Digimon, then place 1 of your other digimon into digivolution cards to get 3 memory.",
  30. CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return
  36. "[When Digivolving] Unsuspend 1 of your Digimon. Then, by placing 1 of your other Digimon with [Aqua]/[Sea Animal] in one of its traits as this Digimon's bottom digivolution card, gain 3 memory.";
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  41. }
  42. bool CanSelectYourSuspendedDigimon(Permanent permanent)
  43. {
  44. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  45. }
  46. bool CanSelectAquaDigimon(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  49. permanent != card.PermanentOfThisCard() &&
  50. permanent.TopCard.HasAquaTraits;
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  55. (CardEffectCommons.HasMatchConditionPermanent(CanSelectYourSuspendedDigimon) ||
  56. CardEffectCommons.HasMatchConditionPermanent(CanSelectAquaDigimon));
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectYourSuspendedDigimon))
  61. {
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canTargetCondition: CanSelectYourSuspendedDigimon,
  67. canEndSelectCondition: null,
  68. maxCount: 1,
  69. canNoSelect: false,
  70. canEndNotMax: false,
  71. selectPermanentCoroutine: null,
  72. afterSelectPermanentCoroutine: null,
  73. mode: SelectPermanentEffect.Mode.UnTap,
  74. cardEffect: activateClass);
  75. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend.",
  76. "The opponent is selecting 1 Digimon to unsuspend.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectAquaDigimon))
  80. {
  81. Permanent selectedPermanent = null;
  82. SelectPermanentEffect selectPermanentEffect =
  83. GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectAquaDigimon,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: 1,
  90. canNoSelect: true,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage(
  97. "Select 1 card to place on bottom of digivolution cards.",
  98. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  101. {
  102. selectedPermanent = permanent;
  103. yield return null;
  104. }
  105. if (selectedPermanent != null)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(
  108. new List<Permanent[]>() { new[] { selectedPermanent, card.PermanentOfThisCard() } },
  109. false,
  110. activateClass).PlacePermanentToDigivolutionCards());
  111. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(3, activateClass));
  112. }
  113. }
  114. }
  115. }
  116. #endregion
  117. return cardEffects;
  118. }
  119. }
  120. }