BT15_047.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT15
  4. {
  5. public class BT15_047 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region All Turns
  11. if (timing == EffectTiming.None)
  12. {
  13. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  14. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseCondition, card);
  15. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  16. cardEffects.Add(canNotAffectedClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. if (CardEffectCommons.IsExistOnBattleArea(card))
  20. {
  21. if (card.PermanentOfThisCard().IsSuspended)
  22. {
  23. return true;
  24. }
  25. }
  26. return false;
  27. }
  28. bool CardCondition(CardSource cardSource)
  29. {
  30. if (cardSource == card)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleArea(card))
  33. {
  34. if (cardSource == card.PermanentOfThisCard().TopCard)
  35. {
  36. return true;
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. bool SkillCondition(ICardEffect cardEffect)
  43. {
  44. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  45. {
  46. if (cardEffect.IsDigimonEffect)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. }
  54. #endregion
  55. #region Inherited Effect
  56. if (timing == EffectTiming.OnEndBattle)
  57. {
  58. ActivateClass activateClass = new ActivateClass();
  59. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  60. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  61. activateClass.SetIsInheritedEffect(true);
  62. activateClass.SetHashString("Memory+1_BT15_047");
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[All Turns] [Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, gain 1 memory.";
  67. }
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.IsExistOnBattleArea(card))
  71. {
  72. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  73. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  74. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  75. return true;
  76. }
  77. return false;
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. return true;
  84. }
  85. return false;
  86. }
  87. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  90. }
  91. }
  92. #endregion
  93. return cardEffects;
  94. }
  95. }
  96. }