Reboot.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. public partial class CardEffectFactory
  7. {
  8. #region Static effect of [Reboot] on oneself
  9. public static RebootClass RebootSelfStaticEffect(bool isInheritedEffect, CardSource card, Func<bool> condition)
  10. {
  11. bool PermanentCondition(Permanent permanent) => permanent == card.PermanentOfThisCard();
  12. bool CanUseCondition()
  13. {
  14. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  15. {
  16. if (condition == null || condition())
  17. {
  18. return true;
  19. }
  20. }
  21. return false;
  22. }
  23. return RebootStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: isInheritedEffect, card: card, condition: CanUseCondition);
  24. }
  25. #endregion
  26. #region Static effect of [Reboot]
  27. public static RebootClass RebootStaticEffect(Func<Permanent, bool> permanentCondition, bool isInheritedEffect, CardSource card, Func<bool> condition)
  28. {
  29. string effectName = "Reboot";
  30. RebootClass rebootClass = new RebootClass();
  31. rebootClass.SetUpICardEffect(effectName, CanUseCondition, card);
  32. rebootClass.SetUpRebootClass(PermanentCondition: PermanentCondition);
  33. if (isInheritedEffect)
  34. {
  35. rebootClass.SetIsInheritedEffect(true);
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return condition == null || condition();
  40. }
  41. bool PermanentCondition(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  44. {
  45. if (permanentCondition == null || permanentCondition(permanent))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. return rebootClass;
  53. }
  54. #endregion
  55. }