| @@ -34,7 +34,7 @@ namespace Gaming | |||||
| public bool Fix(Student player)// 自动检查有无发电机可修 | public bool Fix(Student player)// 自动检查有无发电机可修 | ||||
| { | { | ||||
| if (player.IsGhost() || (!player.Commandable()) || player.PlayerState == PlayerStateType.Fixing) | |||||
| if ((!player.Commandable()) || player.PlayerState == PlayerStateType.Fixing) | |||||
| return false; | return false; | ||||
| Generator? generatorForFix = (Generator?)gameMap.OneForInteract(player.Position, GameObjType.Generator); | Generator? generatorForFix = (Generator?)gameMap.OneForInteract(player.Position, GameObjType.Generator); | ||||
| @@ -97,22 +97,22 @@ namespace Gaming | |||||
| return true; | return true; | ||||
| } | } | ||||
| public bool OpenDoorWay(Student player) | |||||
| public bool OpenDoorway(Student player) | |||||
| { | { | ||||
| if (!(player.Commandable()) || player.PlayerState == PlayerStateType.OpeningTheDoorWay) | |||||
| if (!(player.Commandable()) || player.PlayerState == PlayerStateType.OpeningTheDoorway) | |||||
| return false; | return false; | ||||
| Doorway? doorwayToOpen = (Doorway?)gameMap.OneForInteract(player.Position, GameObjType.Doorway); | Doorway? doorwayToOpen = (Doorway?)gameMap.OneForInteract(player.Position, GameObjType.Doorway); | ||||
| if (doorwayToOpen == null || doorwayToOpen.IsOpening || !doorwayToOpen.PowerSupply) | if (doorwayToOpen == null || doorwayToOpen.IsOpening || !doorwayToOpen.PowerSupply) | ||||
| return false; | return false; | ||||
| player.PlayerState = PlayerStateType.OpeningTheDoorWay; | |||||
| player.PlayerState = PlayerStateType.OpeningTheDoorway; | |||||
| doorwayToOpen.IsOpening = true; | doorwayToOpen.IsOpening = true; | ||||
| new Thread | new Thread | ||||
| ( | ( | ||||
| () => | () => | ||||
| { | { | ||||
| new FrameRateTaskExecutor<int>( | new FrameRateTaskExecutor<int>( | ||||
| loopCondition: () => player.PlayerState == PlayerStateType.OpeningTheDoorWay && gameMap.Timer.IsGaming && doorwayToOpen.OpenDegree < GameData.degreeOfOpenedDoorway, | |||||
| loopCondition: () => player.PlayerState == PlayerStateType.OpeningTheDoorway && gameMap.Timer.IsGaming && doorwayToOpen.OpenDegree < GameData.degreeOfOpenedDoorway, | |||||
| loopToDo: () => | loopToDo: () => | ||||
| { | { | ||||
| doorwayToOpen.OpenDegree += GameData.frameDuration; | doorwayToOpen.OpenDegree += GameData.frameDuration; | ||||
| @@ -125,7 +125,7 @@ namespace Gaming | |||||
| doorwayToOpen.IsOpening = false; | doorwayToOpen.IsOpening = false; | ||||
| if (doorwayToOpen.OpenDegree >= GameData.degreeOfOpenedDoorway) | if (doorwayToOpen.OpenDegree >= GameData.degreeOfOpenedDoorway) | ||||
| { | { | ||||
| if (player.PlayerState == PlayerStateType.OpeningTheDoorWay) | |||||
| if (player.PlayerState == PlayerStateType.OpeningTheDoorway) | |||||
| player.PlayerState = PlayerStateType.Null; | player.PlayerState = PlayerStateType.Null; | ||||
| } | } | ||||
| } | } | ||||
| @@ -252,11 +252,8 @@ namespace Gaming | |||||
| if (!gameMap.Timer.IsGaming) | if (!gameMap.Timer.IsGaming) | ||||
| return false; | return false; | ||||
| ICharacter? player = gameMap.FindPlayer(playerID); | ICharacter? player = gameMap.FindPlayer(playerID); | ||||
| if (player != null) | |||||
| { | |||||
| if (!player.IsGhost()) | |||||
| return actionManager.Fix((Student)player); | |||||
| } | |||||
| if (player != null && !player.IsGhost()) | |||||
| return actionManager.Fix((Student)player); | |||||
| return false; | return false; | ||||
| } | } | ||||
| public bool Escape(long playerID) | public bool Escape(long playerID) | ||||
| @@ -282,7 +279,50 @@ namespace Gaming | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| public bool OpenDoorway(long playerID) | |||||
| { | |||||
| if (!gameMap.Timer.IsGaming) | |||||
| return false; | |||||
| Character? player = gameMap.FindPlayer(playerID); | |||||
| if (player != null && !player.IsGhost()) | |||||
| { | |||||
| return actionManager.OpenDoorway((Student)player); | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public bool OpenChest(long playerID) | |||||
| { | |||||
| if (!gameMap.Timer.IsGaming) | |||||
| return false; | |||||
| Character? player = gameMap.FindPlayer(playerID); | |||||
| if (player != null) | |||||
| { | |||||
| return actionManager.OpenChest(player); | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public bool ClimbingThroughWindow(long playerID) | |||||
| { | |||||
| if (!gameMap.Timer.IsGaming) | |||||
| return false; | |||||
| Character? player = gameMap.FindPlayer(playerID); | |||||
| if (player != null) | |||||
| { | |||||
| return actionManager.ClimbingThroughWindow(player); | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public bool LockOrOpenDoor(long playerID) | |||||
| { | |||||
| if (!gameMap.Timer.IsGaming) | |||||
| return false; | |||||
| Character? player = gameMap.FindPlayer(playerID); | |||||
| if (player != null) | |||||
| { | |||||
| return actionManager.LockOrOpenDoor(player); | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public void Attack(long playerID, double angle) | public void Attack(long playerID, double angle) | ||||
| { | { | ||||
| if (!gameMap.Timer.IsGaming) | if (!gameMap.Timer.IsGaming) | ||||
| @@ -67,6 +67,49 @@ namespace Preparation.Interface | |||||
| public int timeOfOpenChest = GameData.basicSpeedOfOpenChest; | public int timeOfOpenChest = GameData.basicSpeedOfOpenChest; | ||||
| public int TimeOfOpenChest => timeOfOpenChest; | public int TimeOfOpenChest => timeOfOpenChest; | ||||
| } | } | ||||
| public class Teacher : IStudent | |||||
| { | |||||
| private const int moveSpeed = GameData.basicMoveSpeed / 38 * 40; | |||||
| public int MoveSpeed => moveSpeed; | |||||
| private const int maxHp = GameData.basicHp / 30 * 32; | |||||
| public int MaxHp => maxHp; | |||||
| public const int cd = 0; | |||||
| public int CD => cd; | |||||
| public const int maxBulletNum = 0; | |||||
| public int MaxBulletNum => maxBulletNum; | |||||
| public BulletType InitBullet => BulletType.Null; | |||||
| public List<ActiveSkillType> ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.CanBeginToCharge }); | |||||
| public List<PassiveSkillType> ListOfIPassiveSkill => new(new PassiveSkillType[] { }); | |||||
| public const int fixSpeed = GameData.basicFixSpeed / 10 * 6; | |||||
| public int FixSpeed => fixSpeed; | |||||
| public const int treatSpeed = GameData.basicTreatSpeed / 10 * 8; | |||||
| public int TreatSpeed => treatSpeed; | |||||
| public const double concealment = GameData.basicConcealment * 0.9; | |||||
| public double Concealment => concealment; | |||||
| public const int alertnessRadius = (int)(GameData.basicAlertnessRadius * 0.9); | |||||
| public int AlertnessRadius => alertnessRadius; | |||||
| public int viewRange = (int)(GameData.basicViewRange * 1.1); | |||||
| public int ViewRange => viewRange; | |||||
| public int timeOfOpeningOrLocking = GameData.basicSpeedOfOpeningOrLocking * 12 / 10; | |||||
| public int TimeOfOpeningOrLocking => timeOfOpeningOrLocking; | |||||
| public int speedOfClimbingThroughWindows = GameData.basicStudentSpeedOfClimbingThroughWindows * 12 / 10; | |||||
| public int SpeedOfClimbingThroughWindows => speedOfClimbingThroughWindows; | |||||
| public int timeOfOpenChest = GameData.basicSpeedOfOpenChest; | |||||
| public int TimeOfOpenChest => timeOfOpenChest; | |||||
| } | |||||
| public class Athlete : IStudent | public class Athlete : IStudent | ||||
| { | { | ||||
| private const int moveSpeed = GameData.basicMoveSpeed / 38 * 40; | private const int moveSpeed = GameData.basicMoveSpeed / 38 * 40; | ||||
| @@ -23,7 +23,7 @@ namespace Preparation.Utility | |||||
| OpeningTheChest = 14, | OpeningTheChest = 14, | ||||
| ClimbingThroughWindows = 15, | ClimbingThroughWindows = 15, | ||||
| UsingSkill = 16, | UsingSkill = 16, | ||||
| OpeningTheDoorWay = 17, | |||||
| OpeningTheDoorway = 17, | |||||
| } | } | ||||
| public enum GameObjType | public enum GameObjType | ||||
| { | { | ||||
| @@ -1,4 +1,5 @@ | |||||
| using System; | using System; | ||||
| using System.Net.NetworkInformation; | |||||
| namespace Preparation.Utility | namespace Preparation.Utility | ||||
| { | { | ||||
| @@ -7,6 +8,7 @@ namespace Preparation.Utility | |||||
| #region 基本常数 | #region 基本常数 | ||||
| public const int numOfStepPerSecond = 20; // 每秒行走的步数 | public const int numOfStepPerSecond = 20; // 每秒行走的步数 | ||||
| public const int frameDuration = 50; // 每帧时长 | public const int frameDuration = 50; // 每帧时长 | ||||
| public const long checkInterval = 50; // 检查位置标志、补充子弹的帧时长 | |||||
| public const long gameDuration = 600000; // 游戏时长600000ms = 10min | public const long gameDuration = 600000; // 游戏时长600000ms = 10min | ||||
| @@ -85,7 +87,6 @@ namespace Preparation.Utility | |||||
| public const int basicAlertnessRadius = 30700; | public const int basicAlertnessRadius = 30700; | ||||
| public const int basicViewRange = 5 * numOfPosGridPerCell; | public const int basicViewRange = 5 * numOfPosGridPerCell; | ||||
| public const int maxNumOfPropInPropInventory = 3; | public const int maxNumOfPropInPropInventory = 3; | ||||
| public const int addScoreWhenKillOneLevelPlayer = 30; // 击杀一级角色获得的加分 | |||||
| public static XY PosWhoDie = new XY(1, 1); | public static XY PosWhoDie = new XY(1, 1); | ||||
| @@ -98,6 +99,24 @@ namespace Preparation.Utility | |||||
| }; | }; | ||||
| } | } | ||||
| #endregion | #endregion | ||||
| #region 得分相关 | |||||
| public static int TrickerScoreAttackStudent(int damage) | |||||
| { | |||||
| return damage * 100 / basicApOfGhost; | |||||
| } | |||||
| public const int TrickerScoreStudentBeAddicted = 50; | |||||
| public const int TrickerScoreStudentBeStunned = 25; | |||||
| public const int TrickerScoreStudentDie = 1000; | |||||
| public static int StudentScoreFix(int degreeOfFix) | |||||
| { | |||||
| return degreeOfFix; | |||||
| } | |||||
| public static int StudentScorePinDown(int timeOfPiningDown) | |||||
| { | |||||
| return 0; | |||||
| } | |||||
| #endregion | |||||
| #region 攻击与子弹相关 | #region 攻击与子弹相关 | ||||
| public const int basicApOfGhost = 1500000; // 捣蛋鬼攻击力 | public const int basicApOfGhost = 1500000; // 捣蛋鬼攻击力 | ||||
| public const int MinAP = 0; // 最小攻击力 | public const int MinAP = 0; // 最小攻击力 | ||||
| @@ -147,8 +166,5 @@ namespace Preparation.Utility | |||||
| public const int numOfGeneratorRequiredForRepair = 7; | public const int numOfGeneratorRequiredForRepair = 7; | ||||
| public const int numOfGeneratorRequiredForEmergencyExit = 3; | public const int numOfGeneratorRequiredForEmergencyExit = 3; | ||||
| #endregion | #endregion | ||||
| #region 游戏帧相关 | |||||
| public const long checkInterval = 50; // 检查位置标志、补充子弹的帧时长 | |||||
| #endregion | |||||
| } | } | ||||
| } | } | ||||
| @@ -96,7 +96,7 @@ namespace Server | |||||
| return PlayerState.Attacking; | return PlayerState.Attacking; | ||||
| case Preparation.Utility.PlayerStateType.UsingSkill: | case Preparation.Utility.PlayerStateType.UsingSkill: | ||||
| return PlayerState.UsingSpecialSkill; | return PlayerState.UsingSpecialSkill; | ||||
| case Preparation.Utility.PlayerStateType.OpeningTheDoorWay: | |||||
| case Preparation.Utility.PlayerStateType.OpeningTheDoorway: | |||||
| return PlayerState.OpeningAGate; | return PlayerState.OpeningAGate; | ||||
| default: | default: | ||||
| return PlayerState.NullStatus; | return PlayerState.NullStatus; | ||||
| @@ -97,7 +97,7 @@ | |||||
| OpeningTheChest = 14, | OpeningTheChest = 14, | ||||
| ClimbingThroughWindows = 15, | ClimbingThroughWindows = 15, | ||||
| UsingSkill = 16, | UsingSkill = 16, | ||||
| OpeningTheDoorWay = 17, | |||||
| OpeningTheDoorway = 17, | |||||
| } | } | ||||
| ~~~ | ~~~ | ||||
| - 可执行指令的(不用给选手) | - 可执行指令的(不用给选手) | ||||