BT16_005.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class BT16_005 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnDestroyedAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  15. activateClass.SetIsInheritedEffect(true);
  16. activateClass.SetHashString("BT16-005-Memory+1");
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[All Turns] [Once Per Turn] When another Digimon with <Blocker> is deleted, gain 1 memory.";
  21. }
  22. bool PermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  25. {
  26. if (permanent.IsDigimon)
  27. {
  28. if (permanent.HasBlocker)
  29. {
  30. if (permanent != card.PermanentOfThisCard())
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (card.Owner.CanAddMemory(activateClass))
  55. {
  56. List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
  57. if (hashtables != null)
  58. {
  59. if (hashtables.Count >= 1)
  60. {
  61. return true;
  62. }
  63. }
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable hashtable)
  69. {
  70. List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
  71. if (hashtables != null)
  72. {
  73. if (hashtables.Count > 0)
  74. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  75. }
  76. }
  77. }
  78. return cardEffects;
  79. }
  80. }
  81. }