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.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.FindActiveSkill(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. public void Lucky(Character player)
  55. {
  56. player.PropInventory[0] = PropFactory.GetConsumables((PropType)((4 * Environment.TickCount) % 5 + 4), new XY(0, 0));
  57. }
  58. }
  59. }
  60. }