BATTLEOFF.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. namespace OpenVIII.Fields.Scripts.Instructions
  2. {
  3. /// <summary>
  4. /// Disable random battles.
  5. /// </summary>
  6. internal sealed class BATTLEOFF : JsmInstruction
  7. {
  8. #region Constructors
  9. public BATTLEOFF()
  10. {
  11. }
  12. public BATTLEOFF(int parameter, IStack<IJsmExpression> stack)
  13. : this()
  14. {
  15. }
  16. #endregion Constructors
  17. #region Methods
  18. public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services) => sw.Format(formatterContext, services)
  19. .StaticType(nameof(IGameplayService))
  20. .Property(nameof(IGameplayService.IsRandomBattlesEnabled))
  21. .Assign(false)
  22. .Comment(nameof(BATTLEOFF));
  23. public override IAwaitable TestExecute(IServices services)
  24. {
  25. ServiceId.Gameplay[services].IsRandomBattlesEnabled = false;
  26. return DummyAwaitable.Instance;
  27. }
  28. public override string ToString() => $"{nameof(BATTLEOFF)}()";
  29. #endregion Methods
  30. }
  31. }