ST14_08.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ST14_08 : CEntity_Effect
  5. {
  6. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  7. {
  8. List<ICardEffect> cardEffects = new List<ICardEffect>();
  9. if (timing == EffectTiming.OnEnterFieldAnyone)
  10. {
  11. ActivateClass activateClass = new ActivateClass();
  12. activateClass.SetUpICardEffect("Trash 4 cards from deck top", CanUseCondition, card);
  13. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  14. cardEffects.Add(activateClass);
  15. string EffectDiscription()
  16. {
  17. return "[When Digivolving] Trash the top 4 cards of your deck.";
  18. }
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  22. }
  23. bool CanActivateCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (card.Owner.LibraryCards.Count >= 1)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  35. {
  36. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(4, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  37. }
  38. }
  39. if (timing == EffectTiming.OnDiscardLibrary)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Gain Memory", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  44. activateClass.SetHashString("Memory+_ST14_08");
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[All Turns][Once Per Turn] When a card is trashed from your deck, gain 1 memory for every 10 cards in your trash.";
  49. }
  50. int count()
  51. {
  52. return card.Owner.TrashCards.Count / 10;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (CardEffectCommons.CanTriggerWhenDiscardLibrary(hashtable, cardSource => cardSource.Owner == card.Owner))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. if (CardEffectCommons.IsExistOnBattleArea(card))
  68. {
  69. return true;
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(count(), activateClass));
  76. }
  77. }
  78. if (timing == EffectTiming.OnDiscardLibrary)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("Security Attack +1", CanUseCondition, card);
  82. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  83. activateClass.SetHashString("SecurityAttack+1_ST14_08");
  84. cardEffects.Add(activateClass);
  85. string EffectDiscription()
  86. {
  87. return "[Your Turn][Once Per Turn] When a card is trashed from your deck, this Digimon gains <Security Attack +1> (This Digimon checks 1 additional security card) for the turn.";
  88. }
  89. bool CanUseCondition(Hashtable hashtable)
  90. {
  91. if (CardEffectCommons.IsExistOnBattleArea(card))
  92. {
  93. if (CardEffectCommons.CanTriggerWhenDiscardLibrary(hashtable, cardSource => cardSource.Owner == card.Owner))
  94. {
  95. if (CardEffectCommons.IsOwnerTurn(card))
  96. {
  97. return true;
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. bool CanActivateCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.IsExistOnBattleArea(card);
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: card.PermanentOfThisCard(), changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  110. }
  111. }
  112. return cardEffects;
  113. }
  114. }