You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

SkillManager.PassiveSkill.cs 2.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Reflection.Emit;
  3. using System.Threading;
  4. using GameClass.GameObj;
  5. using Preparation.Interface;
  6. using Preparation.Utility;
  7. using Timothy.FrameRateTask;
  8. namespace Gaming // 被动技能开局时就释放,持续到游戏结束
  9. {
  10. public partial class Game
  11. {
  12. private partial class SkillManager
  13. {
  14. public void Meditate(Character player)
  15. {
  16. const int learningDegree = GameData.basicFixSpeed / 4;
  17. WriteAnswers activeSkill = (WriteAnswers)player.FindIActiveSkill(ActiveSkillType.WriteAnswers);
  18. new Thread
  19. (
  20. () =>
  21. {
  22. new FrameRateTaskExecutor<int>
  23. (
  24. () => gameMap.Timer.IsGaming && !player.IsRemoved,
  25. () =>
  26. {
  27. if (player.Commandable() && player.PlayerState != PlayerStateType.Fixing) activeSkill.DegreeOfMeditation += learningDegree * GameData.frameDuration;
  28. else activeSkill.DegreeOfMeditation = 0;
  29. //Debugger.Output(player, "with " + (((WriteAnswers)activeSkill).DegreeOfMeditation).ToString());
  30. },
  31. timeInterval: GameData.frameDuration,
  32. () => 0,
  33. maxTotalDuration: GameData.gameDuration
  34. )
  35. {
  36. AllowTimeExceed = true,
  37. MaxTolerantTimeExceedCount = ulong.MaxValue,
  38. TimeExceedAction = b =>
  39. {
  40. if (b)
  41. Console.WriteLine("Fetal Error: The computer runs so slow that passive skill time exceeds!!!!!!");
  42. #if DEBUG
  43. else
  44. {
  45. Console.WriteLine("Debug info: passive skill time exceeds for once.");
  46. }
  47. #endif
  48. }
  49. }.Start();
  50. }
  51. )
  52. { IsBackground = true }.Start();
  53. }
  54. }
  55. }
  56. }