BT24_012.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Dimetromon
  4. namespace DCGO.CardEffects.BT24
  5. {
  6. public class BT24_012 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Blocker
  12. if (timing == EffectTiming.None)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  15. isInheritedEffect: false,
  16. card: card,
  17. condition: null));
  18. }
  19. #endregion
  20. #region All Turns
  21. if (timing == EffectTiming.WhenRemoveField)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("By bouncing to hand, others don't leave", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  26. cardEffects.Add(activateClass);
  27. string EffectDescription()
  28. {
  29. return "[All Turns] When any of your other Digimon with the [Reptile] or [Dragonkin] trait would leave the battle area by your opponent's effects, by returning this Digimon to the hand, they don't leave.";
  30. }
  31. bool OtherDigimon(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  34. permanent != card.PermanentOfThisCard() &&
  35. (permanent.TopCard.EqualsTraits("Reptile") || permanent.TopCard.EqualsTraits("Dragonkin"));
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  40. {
  41. if (CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, OtherDigimon))
  42. {
  43. if (CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOpponentEffect(cardEffect, card)))
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  56. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  57. activateClass: activateClass,
  58. successProcess: SuccessProcess(),
  59. failureProcess: null)
  60. );
  61. IEnumerator SuccessProcess()
  62. {
  63. List<Permanent> removedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(OtherDigimon);
  64. foreach (Permanent removed in removedPermanents)
  65. {
  66. removed.willBeRemoveField = false;
  67. removed.HideDeleteEffect();
  68. removed.HideHandBounceEffect();
  69. removed.HideDeckBounceEffect();
  70. removed.HideWillRemoveFieldEffect();
  71. }
  72. yield return null;
  73. }
  74. }
  75. }
  76. #endregion
  77. #region Your Turn (ESS)
  78. if (timing == EffectTiming.OnLoseSecurity)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("Gain 1 memory", CanUseCondition, card);
  82. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  83. activateClass.SetIsInheritedEffect(true);
  84. activateClass.SetHashString("GainMemory_BT24-012");
  85. cardEffects.Add(activateClass);
  86. string EffectDescription()
  87. => "[Your Turn] [Once Per Turn] When your opponent's security stack is removed from, gain 1 memory.";
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  91. {
  92. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, PlayerCondition))
  93. {
  94. if (CardEffectCommons.IsOwnerTurn(card))
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. return false;
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  105. {
  106. return true;
  107. }
  108. return false;
  109. }
  110. bool PlayerCondition(Player player)
  111. {
  112. if (player == card.Owner.Enemy)
  113. {
  114. return true;
  115. }
  116. return false;
  117. }
  118. IEnumerator ActivateCoroutine(Hashtable hashtable)
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  121. }
  122. }
  123. #endregion
  124. return cardEffects;
  125. }
  126. }
  127. }