BT21_085.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT21
  4. {
  5. public class BT21_085 : 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 Main Phase
  11. if (timing == EffectTiming.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.IsExistOnBattleArea(card) &&
  24. CardEffectCommons.IsOwnerTurn(card);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.IsExistOnBattleArea(card) &&
  29. card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1 &&
  30. card.Owner.CanAddMemory(activateClass);
  31. }
  32. IEnumerator ActivateCoroutine(Hashtable hashtable)
  33. {
  34. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  35. }
  36. }
  37. #endregion
  38. #region Main
  39. if (timing == EffectTiming.OnDeclaration)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Trash top card of [Armor Form] Digimon to <Draw 1> and gain 1 memory", CanUseCondition,
  43. card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  45. cardEffects.Add(activateClass);
  46. string EffectDescription()
  47. {
  48. return
  49. "[Main] By suspending this Tamer and trashing the top stacked card of 1 of your [Armor Form] trait Digimon, <Draw 1> and gain 1 memory.";
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.IsExistOnBattleArea(card) &&
  54. CardEffectCommons.IsOwnerTurn(card);
  55. }
  56. bool CanSelectPermanentCondition(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  59. permanent.DigivolutionCards.Count >= 1 &&
  60. (permanent.TopCard.EqualsTraits("Armor Form") || permanent.TopCard.EqualsTraits("ArmorForm"));
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleArea(card) &&
  65. CardEffectCommons.CanActivateSuspendCostEffect(card) &&
  66. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable hashtable)
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  71. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  72. Permanent selectedPermanent = null;
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectPermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: 1,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: SelectPermanentCoroutine,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to trash the top stacked card of.",
  87. "The opponent is selecting 1 Digimon to trash the top stacked card of.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. selectedPermanent = permanent;
  92. yield return null;
  93. }
  94. if (selectedPermanent != null)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(
  97. new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  98. yield return ContinuousController.instance.StartCoroutine(
  99. new DrawClass(card.Owner, 1, activateClass).Draw());
  100. yield return ContinuousController.instance.StartCoroutine(
  101. card.Owner.AddMemory(1, activateClass));
  102. }
  103. }
  104. }
  105. #endregion
  106. #region Security Effect
  107. if (timing == EffectTiming.SecuritySkill)
  108. {
  109. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  110. }
  111. #endregion
  112. return cardEffects;
  113. }
  114. }
  115. }