BT3_092.cs 3.1 KB

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