fix: 🚑 fix the bug about adding scores
tags/v0.1.0
| @@ -179,6 +179,7 @@ $$ | |||
| - 使学生沉迷时,得50分。 | |||
| - 使学生眩晕时,得20*眩晕时长(/s)分。 | |||
| - 每淘汰一个学生,得1000分 | |||
| - 摧毁一个TTechOtaku的机器人,得50分。 | |||
| ### 学生 | |||
| - 学生每完成n%的作业,得2n分 | |||
| @@ -71,4 +71,5 @@ | |||
| - fix:修复了开校门的bug | |||
| # 5月25日更新 | |||
| - fix:修复了Semaphore设置错误的问题 | |||
| - fix:修复了Semaphore设置错误的问题 | |||
| - fix:修复了终局得分的问题 | |||
| @@ -85,8 +85,11 @@ namespace GameClass.GameObj | |||
| } | |||
| public void MapDieStudent() | |||
| { | |||
| if (Interlocked.Increment(ref numOfNoHpStudent) == GameData.numOfStudent) | |||
| uint noHp = Interlocked.Increment(ref numOfNoHpStudent); | |||
| ghost!.AddScore(GameData.TrickerScoreStudentDie); | |||
| if (noHp == GameData.numOfStudent) | |||
| { | |||
| AddScoreFromAddict(); | |||
| Timer.IsGaming = false; | |||
| return; | |||
| } | |||
| @@ -97,11 +100,15 @@ namespace GameClass.GameObj | |||
| public void MapAddictStudent() | |||
| { | |||
| if (Interlocked.Increment(ref numOfNoHpStudent) == GameData.numOfStudent) | |||
| { | |||
| AddScoreFromAddict(); | |||
| Timer.IsGaming = false; | |||
| } | |||
| } | |||
| public void MapRescueStudent() | |||
| { | |||
| Interlocked.Decrement(ref numOfNoHpStudent); | |||
| if (Timer.IsGaming) | |||
| Interlocked.Decrement(ref numOfNoHpStudent); | |||
| } | |||
| private void OpenEmergencyExit() | |||
| @@ -123,7 +130,7 @@ namespace GameClass.GameObj | |||
| } | |||
| private void AddScoreFromAddict() | |||
| { | |||
| ghost.AddScore(GameData.TrickerScoreStudentDie * (GameData.numOfStudent - NumOfRemovedStudent)); | |||
| } | |||
| @@ -187,26 +194,7 @@ namespace GameClass.GameObj | |||
| } | |||
| return player; | |||
| } | |||
| public Character FindGhost() | |||
| { | |||
| gameObjLockDict[GameObjType.Character].EnterReadLock(); | |||
| try | |||
| { | |||
| int i; | |||
| for (i = 0; i < (gameObjDict[GameObjType.Character]).Count - 1; ++i) | |||
| { | |||
| if (((Character)gameObjDict[GameObjType.Character][i]).IsGhost()) | |||
| { | |||
| return ((Character)gameObjDict[GameObjType.Character][i]); | |||
| } | |||
| } | |||
| return ((Character)gameObjDict[GameObjType.Character][i]); | |||
| } | |||
| finally | |||
| { | |||
| gameObjLockDict[GameObjType.Character].ExitReadLock(); | |||
| } | |||
| } | |||
| public Ghost? ghost = null; | |||
| public Character? FindPlayerToAction(long playerID) | |||
| { | |||
| Character? player = null; | |||
| @@ -47,7 +47,7 @@ namespace Gaming | |||
| else | |||
| { | |||
| if (GameData.IsGhost(characterType)) | |||
| newPlayer = new Ghost(pos, GameData.characterRadius, characterType); | |||
| newPlayer = gameMap.ghost = new Ghost(pos, GameData.characterRadius, characterType); | |||
| else | |||
| { | |||
| newPlayer = new Student(pos, GameData.characterRadius, characterType); | |||
| @@ -223,7 +223,6 @@ namespace Gaming | |||
| if (player.CharacterType == CharacterType.Robot) | |||
| { | |||
| ghost.AddScore(GameData.TrickerScoreDestroyRobot); | |||
| Die(player); | |||
| return; | |||
| } | |||
| @@ -235,7 +234,6 @@ namespace Gaming | |||
| player.GamingAddiction = GameData.MidGamingAddiction; | |||
| else | |||
| { | |||
| ghost.AddScore(GameData.TrickerScoreStudentDie); | |||
| Die(player); | |||
| return; | |||
| } | |||
| @@ -260,7 +258,6 @@ namespace Gaming | |||
| gameMap.MapRescueStudent(); | |||
| if (player.GamingAddiction == player.MaxGamingAddiction && gameMap.Timer.IsGaming) | |||
| { | |||
| ghost.AddScore(GameData.TrickerScoreStudentDie); | |||
| Die(player); | |||
| } | |||
| return 0; | |||
| @@ -418,8 +415,9 @@ namespace Gaming | |||
| parent.SetPlayerStateNaturally(); | |||
| } | |||
| } | |||
| gameMap.ghost.AddScore(GameData.TrickerScoreDestroyRobot); | |||
| return; | |||
| } | |||
| return; | |||
| } | |||
| gameMap.MapDieStudent(); | |||
| } | |||
| @@ -48,7 +48,7 @@ namespace Gaming | |||
| { | |||
| foreach (Character person in gameMap.GameObjDict[GameObjType.Character]) | |||
| { | |||
| if (!person.IsGhost() && player.CharacterType != CharacterType.Robot && !person.NoHp()) | |||
| if (!person.IsGhost() && person.CharacterType != CharacterType.Robot && !person.NoHp()) | |||
| { | |||
| double dis = XY.DistanceFloor3(person.Position, player.Position); | |||
| if (dis >= player.AlertnessRadius) | |||
| @@ -62,7 +62,6 @@ namespace Gaming | |||
| student.GamingAddiction += GameData.checkIntervalWhenShowTime; | |||
| if (student.GamingAddiction == student.MaxGamingAddiction) | |||
| { | |||
| player.AddScore(GameData.TrickerScoreStudentDie); | |||
| characterManager.Die(student); | |||
| } | |||
| } | |||
| @@ -142,7 +142,7 @@ namespace Preparation.Utility | |||
| return damage * 100 / basicApOfGhost; | |||
| } | |||
| public const int TrickerScoreStudentBeAddicted = 50; | |||
| public const int TrickerScoreDestroyRobot = 30; | |||
| public const int TrickerScoreDestroyRobot = 50; | |||
| public const int TrickerScoreStudentDie = 1000; | |||
| public static int TrickerScoreStudentBeStunned(int time) | |||
| { | |||