BT24_008.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Elizamon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_008 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash 1 [Reptile], [Dragonkin] or [LIBERATOR] trait to <Draw 2>", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return "[On Play] By trashing 1 card with the [Reptile], [Dragonkin] or [LIBERATOR] trait in your hand, <Draw 2>.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  26. }
  27. bool HasARequiredTrait(CardSource cardSource)
  28. {
  29. return (cardSource.EqualsTraits("Reptile")
  30. || cardSource.EqualsTraits("Dragonkin")
  31. || cardSource.EqualsTraits("LIBERATOR"));
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  36. && CardEffectCommons.HasMatchConditionOwnersHand(card, HasARequiredTrait);
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable hashtable)
  39. {
  40. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  41. selectHandEffect.SetUp(
  42. canTargetCondition: HasARequiredTrait,
  43. canTargetCondition_ByPreSelecetedList: null,
  44. canEndSelectCondition: null,
  45. canNoSelect: true,
  46. selectCardCoroutine: null,
  47. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  48. maxCount: 1,
  49. canEndNotMax: false,
  50. isShowOpponent: true,
  51. mode: SelectHandEffect.Mode.Discard,
  52. selectPlayer: card.Owner,
  53. cardEffect: activateClass);
  54. selectHandEffect.SetUpCustomMessage("Select 1 card with the [Reptile], [Dragonkin] or [LIBERATOR] trait to discard.",
  55. "The opponent is selecting 1 card with the [Reptile], [Dragonkin] or [LIBERATOR] trait to discard.");
  56. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  57. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  58. {
  59. if (cardSources.Count > 0)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(
  62. new DrawClass(card.Owner, 2, activateClass).Draw());
  63. }
  64. }
  65. }
  66. }
  67. #endregion
  68. #region Your Turn - ESS
  69. if (timing == EffectTiming.OnLoseSecurity)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("Gain 1 memory", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  74. activateClass.SetIsInheritedEffect(true);
  75. activateClass.SetHashString("GainMemory_BT24_008");
  76. cardEffects.Add(activateClass);
  77. string EffectDescription()
  78. => "[Your Turn] [Once Per Turn] When your opponent's security stack is removed from, gain 1 memory.";
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  82. {
  83. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, PlayerCondition))
  84. {
  85. if (CardEffectCommons.IsOwnerTurn(card))
  86. {
  87. return true;
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  96. {
  97. return true;
  98. }
  99. return false;
  100. }
  101. bool PlayerCondition(Player player)
  102. {
  103. if (player == card.Owner.Enemy)
  104. {
  105. return true;
  106. }
  107. return false;
  108. }
  109. IEnumerator ActivateCoroutine(Hashtable hashtable)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  112. }
  113. }
  114. #endregion
  115. return cardEffects;
  116. }
  117. }
  118. }