| @@ -3,7 +3,7 @@ | |||
| #include <array> | |||
| #include "AI.h" | |||
| #include "constants.h" | |||
| //注意不要使用conio.h,Windows.h等非标准库 | |||
| // 注意不要使用conio.h,Windows.h等非标准库 | |||
| // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新 | |||
| extern const bool asynchronous = false; | |||
| @@ -194,9 +194,9 @@ $$ | |||
| | 隐蔽度 | 1.5 | 1 | 0.8 | 0.75| | |||
| | 警戒范围 | 22,100 | 17000 | 15300 | 17000 | |||
| | 视野范围 | 15600 | 13000 | 13000 | 14300| | |||
| | 开锁门速度 | 4000 | 4000 | 4000 |4000 | | |||
| | 翻窗速度 | 2540 | 2540 | 2794 | 2540| | |||
| | 翻箱速度 | 1000 | 1100 | 1000 |1000| | |||
| | 开锁门速度/ms | 4000 | 4000 | 4000 |4000 | | |||
| | 翻窗速度/s | 2540 | 2540 | 2794 | 2540| | |||
| | 翻箱速度/ms | 1000 | 1100 | 1000 |1000| | |||
| #### Assassin | |||
| - 普通攻击为 CommonAttackOfGhost | |||
| @@ -244,17 +244,17 @@ $$ | |||
| | 学生职业 | 教师Teacher | 健身狂Athlete | 学霸StraightAStudent | 开心果Sunshine | | |||
| | :------------ | :--------------------- | :--------------------- | :--------------------- | :--------------------- | | |||
| | 移动速度 | 2700 | 3150 | 2880 | 3000 | | |||
| | 移动速度/s | 2700 | 3150 | 2880 | 3000 | | |||
| | 最大毅力值 | 30000000 | 3000000 | 3300000 | 3200000 | | |||
| | 最大沉迷度 | 600000 | 54,000 | 78,000 | 66,000 | | |||
| | 学习一科速度 | 0 | 73 | 135 | 123 | | |||
| | 勉励速度 | 80 | 90 | 100 | 120 | | |||
| | 勉励速度/ms | 80 | 90 | 100 | 120 | | |||
| | 隐蔽度 | 0.5 | 0.9 | 0.9 | 0.8 | | |||
| | 警戒范围 | 7500 | 15000 | 13,500 | 15000 | | |||
| | 视野范围 | 9,000 | 11000 | 9,000 | 10000 | | |||
| | 开锁门速度 | 4000 | 4000 | 4000 | 2800 | | |||
| | 翻窗速度 | 1270 | 3048 | 2116 | 2540 | | |||
| | 翻箱速度 | 1000 | 1000 | 1000 | 900 | | |||
| | 开锁门速度/ms | 4000 | 4000 | 4000 | 2800 | | |||
| | 翻窗速度/ms | 1270 | 3048 | 2116 | 2540 | | |||
| | 翻箱速度/ms | 1000 | 1000 | 1000 | 900 | | |||
| #### 运动员 | |||
| - 主动技能 | |||
| @@ -312,7 +312,7 @@ $$ | |||
| - 眩晕状态中的玩家不能再次被眩晕 | |||
| ### 初始状态 | |||
| - 玩家出生点固定且一定为空地 | |||
| - 初赛玩家出生点固定且一定为空地 | |||
| ### 道具 | |||
| - 使用钥匙相当于销毁 | |||
| @@ -130,7 +130,7 @@ namespace GameClass.GameObj | |||
| public override bool CanAttack(GameObj target) | |||
| { | |||
| return XY.Distance(this.Position, target.Position) <= BulletBombRange; | |||
| return XY.DistanceFloor3(this.Position, target.Position) <= BulletBombRange; | |||
| } | |||
| public override bool CanBeBombed(GameObjType gameObjType) | |||
| { | |||
| @@ -176,7 +176,7 @@ namespace GameClass.GameObj | |||
| public override bool CanAttack(GameObj target) | |||
| { | |||
| return XY.Distance(this.Position, target.Position) <= BulletBombRange; | |||
| return XY.DistanceFloor3(this.Position, target.Position) <= BulletBombRange; | |||
| } | |||
| public override bool CanBeBombed(GameObjType gameObjType) | |||
| { | |||
| @@ -594,7 +594,7 @@ namespace GameClass.GameObj | |||
| { | |||
| return true; | |||
| } | |||
| if (targetObj.Type == GameObjType.Character && XY.Distance(targetObj.Position, this.Position) < this.Radius + targetObj.Radius) | |||
| if (targetObj.Type == GameObjType.Character && XY.DistanceFloor3(targetObj.Position, this.Position) < this.Radius + targetObj.Radius) | |||
| return true; | |||
| return false; | |||
| } | |||
| @@ -75,7 +75,7 @@ namespace GameEngine | |||
| // if (obj.WillCollideWith(square, obj.Position)) | |||
| // tmpMax = 0; | |||
| // else tmpMax = | |||
| // Math.Abs(XYPosition.Distance(obj.Position, square.Position) - obj.Radius - | |||
| // Math.Abs(XYPosition.DistanceFloor3(obj.Position, square.Position) - obj.Radius - | |||
| // (square.Radius / Math.Min(Math.Abs(Math.Cos(angle)), Math.Abs(Math.Sin(angle))))); | |||
| // return tmpMax; | |||
| // } | |||
| @@ -144,7 +144,7 @@ namespace GameEngine | |||
| case ShapeType.Circle: | |||
| { | |||
| // 计算两者之间的距离 | |||
| double mod = XY.Distance(listObj.Position, obj.Position); | |||
| double mod = XY.DistanceFloor3(listObj.Position, obj.Position); | |||
| int orgDeltaX = listObj.Position.x - obj.Position.x; | |||
| int orgDeltaY = listObj.Position.y - obj.Position.y; | |||
| @@ -181,7 +181,7 @@ namespace GameEngine | |||
| while (left < right - 1) | |||
| { | |||
| int mid = (right - left) / 2 + left; | |||
| if (obj.WillCollideWith(listObj, obj.Position + new XY((int)(mid * Math.Cos(moveVec.Angle())), (int)(mid * Math.Sin(moveVec.Angle()))))) | |||
| if (obj.WillCollideWith(listObj, obj.Position + new XY(moveVec, mid))) | |||
| { | |||
| right = mid; | |||
| } | |||
| @@ -1,5 +1,4 @@ | |||
| using System; | |||
| using System.Numerics; | |||
| using System.Threading; | |||
| using Preparation.Interface; | |||
| using Preparation.Utility; | |||
| @@ -1,6 +1,4 @@ | |||
| using System; | |||
| using System.Diagnostics; | |||
| using System.Net.NetworkInformation; | |||
| using System.Threading; | |||
| using GameClass.GameObj; | |||
| using GameEngine; | |||
| @@ -135,10 +135,10 @@ namespace Gaming | |||
| double bgmVolume = 0; | |||
| foreach (Character person in gameMap.GameObjDict[GameObjType.Character]) | |||
| { | |||
| if (!person.IsGhost() && XY.Distance(newPlayer.Position, person.Position) <= (newPlayer.AlertnessRadius / person.Concealment)) | |||
| if (!person.IsGhost() && XY.DistanceFloor3(newPlayer.Position, person.Position) <= (newPlayer.AlertnessRadius / person.Concealment)) | |||
| { | |||
| if ((double)newPlayer.AlertnessRadius / XY.Distance(newPlayer.Position, person.Position) > bgmVolume) | |||
| bgmVolume = newPlayer.AlertnessRadius / XY.Distance(newPlayer.Position, person.Position); | |||
| if ((double)newPlayer.AlertnessRadius / XY.DistanceFloor3(newPlayer.Position, person.Position) > bgmVolume) | |||
| bgmVolume = newPlayer.AlertnessRadius / XY.DistanceFloor3(newPlayer.Position, person.Position); | |||
| } | |||
| } | |||
| newPlayer.AddBgm(BgmType.StudentIsApproaching, bgmVolume); | |||
| @@ -151,11 +151,11 @@ namespace Gaming | |||
| { | |||
| if (!noise) | |||
| { | |||
| if (XY.Distance(newPlayer.Position, person.Position) <= (newPlayer.AlertnessRadius / person.Concealment)) | |||
| newPlayer.AddBgm(BgmType.GhostIsComing, (double)newPlayer.AlertnessRadius / XY.Distance(newPlayer.Position, person.Position)); | |||
| if (XY.DistanceFloor3(newPlayer.Position, person.Position) <= (newPlayer.AlertnessRadius / person.Concealment)) | |||
| newPlayer.AddBgm(BgmType.GhostIsComing, (double)newPlayer.AlertnessRadius / XY.DistanceFloor3(newPlayer.Position, person.Position)); | |||
| else newPlayer.AddBgm(BgmType.GhostIsComing, 0); | |||
| } | |||
| if (newPlayer.CharacterType != CharacterType.Teacher && newPlayer.CharacterType != CharacterType.Robot && !newPlayer.NoHp() && newPlayer.PlayerState != PlayerStateType.Stunned && XY.Distance(newPlayer.Position, person.Position) <= GameData.PinningDownRange) | |||
| if (newPlayer.CharacterType != CharacterType.Teacher && newPlayer.CharacterType != CharacterType.Robot && !newPlayer.NoHp() && newPlayer.PlayerState != PlayerStateType.Stunned && XY.DistanceFloor3(newPlayer.Position, person.Position) <= GameData.PinningDownRange) | |||
| { | |||
| TimePinningDown += GameData.checkInterval; | |||
| newPlayer.AddScore(GameData.StudentScorePinDown(TimePinningDown) - ScoreAdded); | |||
| @@ -180,10 +180,10 @@ namespace Gaming | |||
| double bgmVolume = 0; | |||
| foreach (Generator generator in gameMap.GameObjDict[GameObjType.Generator]) | |||
| { | |||
| if (XY.Distance(newPlayer.Position, generator.Position) <= newPlayer.AlertnessRadius) | |||
| if (XY.DistanceFloor3(newPlayer.Position, generator.Position) <= newPlayer.AlertnessRadius) | |||
| { | |||
| if (generator.NumOfFixing > 0 && (double)newPlayer.AlertnessRadius * generator.DegreeOfRepair / GameData.degreeOfFixedGenerator / XY.Distance(newPlayer.Position, generator.Position) > bgmVolume) | |||
| bgmVolume = (double)newPlayer.AlertnessRadius * generator.DegreeOfRepair / GameData.degreeOfFixedGenerator / XY.Distance(newPlayer.Position, generator.Position); | |||
| if (generator.NumOfFixing > 0 && (double)newPlayer.AlertnessRadius * generator.DegreeOfRepair / GameData.degreeOfFixedGenerator / XY.DistanceFloor3(newPlayer.Position, generator.Position) > bgmVolume) | |||
| bgmVolume = (double)newPlayer.AlertnessRadius * generator.DegreeOfRepair / GameData.degreeOfFixedGenerator / XY.DistanceFloor3(newPlayer.Position, generator.Position); | |||
| } | |||
| } | |||
| newPlayer.AddBgm(BgmType.GeneratorIsBeingFixed, bgmVolume); | |||
| @@ -51,7 +51,7 @@ namespace Gaming | |||
| { | |||
| if (!person.IsGhost() && player.CharacterType != CharacterType.Robot && !person.NoHp()) | |||
| { | |||
| double dis = XY.Distance(person.Position, player.Position); | |||
| double dis = XY.DistanceFloor3(person.Position, player.Position); | |||
| if (dis >= player.AlertnessRadius) | |||
| { | |||
| person.AddMoveSpeed(GameData.checkIntervalWhenShowTime, dis / player.AlertnessRadius); | |||
| @@ -185,7 +185,7 @@ namespace Gaming | |||
| { | |||
| foreach (Character character in gameMap.GameObjDict[GameObjType.Character]) | |||
| { | |||
| if (!character.IsGhost() && !character.NoHp() && XY.Distance(character.Position, player.Position) <= player.ViewRange) | |||
| if (!character.IsGhost() && !character.NoHp() && XY.DistanceFloor3(character.Position, player.Position) <= player.ViewRange) | |||
| { | |||
| if (characterManager.BeStunned(character, GameData.timeOfStudentStunnedWhenHowl)) | |||
| player.AddScore(GameData.TrickerScoreStudentBeStunned(GameData.timeOfStudentStunnedWhenHowl)); | |||
| @@ -24,7 +24,7 @@ namespace Preparation.Interface | |||
| if (targetObj.Shape == ShapeType.Circle) | |||
| { | |||
| return XY.Distance(nextPos, targetObj.Position) < targetObj.Radius + Radius; | |||
| return XY.DistanceCeil3(nextPos, targetObj.Position) < targetObj.Radius + Radius; | |||
| } | |||
| else // Square | |||
| { | |||
| @@ -62,14 +62,24 @@ namespace Preparation.Utility | |||
| { | |||
| return v1.x != v2.x || v1.y != v2.y; | |||
| } | |||
| public static double Distance(XY p1, XY p2) | |||
| public static double DistanceFloor3(XY p1, XY p2) | |||
| { | |||
| long c = (((long)(p1.x - p2.x) * (p1.x - p2.x)) + ((long)(p1.y - p2.y) * (p1.y - p2.y))) * 1000000; | |||
| long t = c / 2 + 1; | |||
| while (t * t > c || (t + 1) * (t + 1) < c) | |||
| while (t * t > c || (t + 1) * (t + 1) <= c) | |||
| t = (c / t + t) / 2; | |||
| return (double)t / 1000.0; | |||
| } | |||
| public static double DistanceCeil3(XY p1, XY p2) | |||
| { | |||
| long c = (((long)(p1.x - p2.x) * (p1.x - p2.x)) + ((long)(p1.y - p2.y) * (p1.y - p2.y))) * 1000000; | |||
| long t = c / 2 + 1; | |||
| while (t * t > c || (t + 1) * (t + 1) <= c) | |||
| t = (c / t + t) / 2; | |||
| if (t * t == c) return (double)t / 1000.0; | |||
| else return (double)(t + 1) / 1000.0; | |||
| } | |||
| public double Length() | |||
| { | |||
| return Math.Sqrt(((long)x * x) + ((long)y * y)); | |||