| @@ -15,18 +15,26 @@ namespace GameClass.GameObj | |||||
| /// <returns>人物在受到攻击后死了吗</returns> | /// <returns>人物在受到攻击后死了吗</returns> | ||||
| public bool BeAttacked(Bullet bullet) | public bool BeAttacked(Bullet bullet) | ||||
| { | { | ||||
| #if DEBUG | |||||
| Debugger.Output(this, "is being shot!"); | |||||
| #endif | |||||
| lock (beAttackedLock) | lock (beAttackedLock) | ||||
| { | { | ||||
| if (hp <= 0 || NoHp()) | if (hp <= 0 || NoHp()) | ||||
| return false; // 原来已经死了 | return false; // 原来已经死了 | ||||
| if (bullet.Parent.TeamID != this.TeamID) | |||||
| if (bullet.Parent.IsGhost() != this.IsGhost()) | |||||
| { | { | ||||
| #if DEBUG | |||||
| Debugger.Output(bullet, bullet.AP.ToString()); | |||||
| #endif | |||||
| if (TryUseShield()) | if (TryUseShield()) | ||||
| { | { | ||||
| if (bullet.HasSpear) | if (bullet.HasSpear) | ||||
| { | { | ||||
| int subHp = TrySubHp(bullet.AP); | int subHp = TrySubHp(bullet.AP); | ||||
| #if DEBUG | |||||
| Debugger.Output(this, "is being shot! Now his hp is" + HP.ToString()); | |||||
| #endif | |||||
| bullet.Parent.AddScore(GameData.TrickerScoreAttackStudent(subHp) + GameData.ScorePropUseSpear); | bullet.Parent.AddScore(GameData.TrickerScoreAttackStudent(subHp) + GameData.ScorePropUseSpear); | ||||
| bullet.Parent.HP = (int)(bullet.Parent.HP + (bullet.Parent.Vampire * subHp)); | bullet.Parent.HP = (int)(bullet.Parent.HP + (bullet.Parent.Vampire * subHp)); | ||||
| } | } | ||||
| @@ -36,12 +44,13 @@ namespace GameClass.GameObj | |||||
| else | else | ||||
| { | { | ||||
| int subHp = (bullet.HasSpear) ? TrySubHp(bullet.AP + GameData.ApSpearAdd) : TrySubHp(bullet.AP); | int subHp = (bullet.HasSpear) ? TrySubHp(bullet.AP + GameData.ApSpearAdd) : TrySubHp(bullet.AP); | ||||
| #if DEBUG | |||||
| Debugger.Output(this, "is being shot with spear! Now his hp is" + HP.ToString()); | |||||
| #endif | |||||
| bullet.Parent.AddScore(GameData.TrickerScoreAttackStudent(subHp)); | bullet.Parent.AddScore(GameData.TrickerScoreAttackStudent(subHp)); | ||||
| bullet.Parent.HP = (int)(bullet.Parent.HP + (bullet.Parent.Vampire * subHp)); | bullet.Parent.HP = (int)(bullet.Parent.HP + (bullet.Parent.Vampire * subHp)); | ||||
| } | } | ||||
| #if DEBUG | |||||
| Console.WriteLine($"PlayerID:{ID} is being shot! Now his hp is {hp}."); | |||||
| #endif | |||||
| if (hp <= 0) | if (hp <= 0) | ||||
| TryActivatingLIFE(); // 如果有复活甲 | TryActivatingLIFE(); // 如果有复活甲 | ||||
| } | } | ||||
| @@ -340,8 +340,8 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| } | } | ||||
| public bool NoHp() => (playerState != PlayerStateType.Deceased && playerState != PlayerStateType.Escaped | |||||
| && playerState != PlayerStateType.Addicted && playerState != PlayerStateType.Rescued); | |||||
| public bool NoHp() => (playerState == PlayerStateType.Deceased || playerState == PlayerStateType.Escaped | |||||
| || playerState == PlayerStateType.Addicted || playerState == PlayerStateType.Rescued); | |||||
| public bool Commandable() => (playerState != PlayerStateType.Deceased && playerState != PlayerStateType.Escaped | public bool Commandable() => (playerState != PlayerStateType.Deceased && playerState != PlayerStateType.Escaped | ||||
| && playerState != PlayerStateType.Addicted && playerState != PlayerStateType.Rescued | && playerState != PlayerStateType.Addicted && playerState != PlayerStateType.Rescued | ||||
| && playerState != PlayerStateType.Swinging && playerState != PlayerStateType.TryingToAttack | && playerState != PlayerStateType.Swinging && playerState != PlayerStateType.TryingToAttack | ||||
| @@ -132,7 +132,7 @@ namespace Gaming | |||||
| { | { | ||||
| case GameObjType.Character: | case GameObjType.Character: | ||||
| if ((!((Character)objBeingShot).IsGhost()) && bullet.Parent.IsGhost()) | |||||
| if ((!(((Character)objBeingShot).IsGhost())) && bullet.Parent.IsGhost()) | |||||
| { | { | ||||
| Student oneBeAttacked = (Student)objBeingShot; | Student oneBeAttacked = (Student)objBeingShot; | ||||
| if (oneBeAttacked.BeAttacked(bullet)) | if (oneBeAttacked.BeAttacked(bullet)) | ||||
| @@ -157,7 +157,7 @@ namespace Gaming | |||||
| { | { | ||||
| #if DEBUG | #if DEBUG | ||||
| if (objBeingShot != null) | if (objBeingShot != null) | ||||
| Debugger.Output(bullet, "bombed!" + objBeingShot.ToString()); | |||||
| Debugger.Output(bullet, "bombed with" + objBeingShot.ToString()); | |||||
| else | else | ||||
| Debugger.Output(bullet, "bombed without objBeingShot"); | Debugger.Output(bullet, "bombed without objBeingShot"); | ||||
| #endif | #endif | ||||
| @@ -79,7 +79,7 @@ namespace Preparation.Utility | |||||
| public const int basicTreatmentDegree = 1500000; | public const int basicTreatmentDegree = 1500000; | ||||
| public const int basicTimeOfRescue = 1000; | public const int basicTimeOfRescue = 1000; | ||||
| public const int basicMoveSpeed = 1270; // 基本移动速度,单位:s-1 | |||||
| public const int basicMoveSpeed = 3000;//DEBUG //1270;TRUE // 基本移动速度,单位:s-1 | |||||
| public const int characterMaxSpeed = 12000; // 最大速度 | public const int characterMaxSpeed = 12000; // 最大速度 | ||||
| public const double basicConcealment = 1.0; | public const double basicConcealment = 1.0; | ||||
| @@ -1,6 +1,6 @@ | |||||
| @echo off | @echo off | ||||
| start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 2 --trickerCount 0 --gameTimeInSecond 600 --fileName test | |||||
| start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 1 --trickerCount 1 --gameTimeInSecond 600 --fileName test | |||||
| ping -n 2 127.0.0.1 > NUL | ping -n 2 127.0.0.1 > NUL | ||||