| @@ -24,14 +24,24 @@ namespace GameClass.GameObj | |||
| numOfRepairedGenerators = value; | |||
| } | |||
| } | |||
| private uint numOfSurvivingStudent = GameData.numOfStudent; | |||
| public uint NumOfSurvivingStudent | |||
| private uint numOfDeceasedStudent = 0; | |||
| public uint NumOfDeceasedStudent | |||
| { | |||
| get => numOfSurvivingStudent; | |||
| get => numOfDeceasedStudent; | |||
| set | |||
| { | |||
| lock (lockForNum) | |||
| numOfSurvivingStudent = value; | |||
| numOfDeceasedStudent = value; | |||
| } | |||
| } | |||
| private uint numOfEscapedStudent = 0; | |||
| public uint NumOfEscapedStudent | |||
| { | |||
| get => numOfEscapedStudent; | |||
| set | |||
| { | |||
| lock (lockForNum) | |||
| numOfEscapedStudent = value; | |||
| } | |||
| } | |||
| @@ -162,6 +172,27 @@ namespace GameClass.GameObj | |||
| } | |||
| return GameObjForInteract; | |||
| } | |||
| public Student? StudentForInteract(XY Pos) | |||
| { | |||
| Student? GameObjForInteract = null; | |||
| GameObjLockDict[GameObjType.Character].EnterReadLock(); | |||
| try | |||
| { | |||
| foreach (Character character in GameObjDict[GameObjType.Character]) | |||
| { | |||
| if (!character.IsGhost() && GameData.ApproachToInteract(character.Position, Pos)) | |||
| { | |||
| GameObjForInteract = (Student)character; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| finally | |||
| { | |||
| GameObjLockDict[GameObjType.Character].ExitReadLock(); | |||
| } | |||
| return GameObjForInteract; | |||
| } | |||
| public GameObj? OneInTheSameCell(XY Pos, GameObjType gameObjType) | |||
| { | |||
| GameObj? GameObjForInteract = null; | |||
| @@ -150,6 +150,7 @@ namespace Gaming | |||
| if (doorwayForEscape.IsOpen()) | |||
| { | |||
| player.AddScore(GameData.StudentScoreEscape); | |||
| ++gameMap.NumOfEscapedStudent; | |||
| player.Die(PlayerStateType.Escaped); | |||
| return true; | |||
| } | |||
| @@ -169,8 +170,13 @@ namespace Gaming | |||
| } | |||
| } | |||
| public bool Treat(Student player, Student playerTreated) | |||
| public bool Treat(Student player, Student? playerTreated = null) | |||
| { | |||
| if (playerTreated == null) | |||
| { | |||
| playerTreated = gameMap.StudentForInteract(player.Position); | |||
| if (playerTreated == null) return false; | |||
| } | |||
| if ((!player.Commandable()) || player.PlayerState == PlayerStateType.Treating || | |||
| (!playerTreated.Commandable()) || | |||
| playerTreated.HP == playerTreated.MaxHp || !GameData.ApproachToInteract(playerTreated.Position, player.Position)) | |||
| @@ -226,8 +232,13 @@ namespace Gaming | |||
| { IsBackground = true }.Start(); | |||
| return true; | |||
| } | |||
| public bool Rescue(Student player, Student playerRescued) | |||
| public bool Rescue(Student player, Student? playerRescued = null) | |||
| { | |||
| if (playerRescued == null) | |||
| { | |||
| playerRescued = gameMap.StudentForInteract(player.Position); | |||
| if (playerRescued == null) return false; | |||
| } | |||
| if ((!player.Commandable()) || playerRescued.PlayerState != PlayerStateType.Addicted || !GameData.ApproachToInteract(playerRescued.Position, player.Position)) | |||
| return false; | |||
| player.PlayerState = PlayerStateType.Rescuing; | |||
| @@ -98,8 +98,8 @@ namespace Gaming | |||
| gameMap.Add(prop); | |||
| } | |||
| } | |||
| --gameMap.NumOfSurvivingStudent; | |||
| if (gameMap.NumOfSurvivingStudent == 1) | |||
| ++gameMap.NumOfDeceasedStudent; | |||
| if (GameData.numOfStudent - gameMap.NumOfDeceasedStudent - gameMap.NumOfEscapedStudent == 1) | |||
| { | |||
| gameMap.GameObjLockDict[GameObjType.EmergencyExit].EnterReadLock(); | |||
| try | |||
| @@ -229,30 +229,47 @@ namespace Gaming | |||
| } | |||
| } | |||
| public bool Treat(long playerID, long playerTreatedID) | |||
| public bool Treat(long playerID, long playerTreatedID = -1) | |||
| { | |||
| if (!gameMap.Timer.IsGaming) | |||
| return false; | |||
| ICharacter? player = gameMap.FindPlayer(playerID); | |||
| ICharacter? playerTreated = gameMap.FindPlayer(playerTreatedID); | |||
| if (player != null && playerTreated != null) | |||
| if (playerTreatedID == -1) | |||
| { | |||
| if (!playerTreated.IsGhost() && !player.IsGhost()) | |||
| return actionManager.Treat((Student)player, (Student)playerTreated); | |||
| if (player != null && !player.IsGhost()) | |||
| return actionManager.Treat((Student)player); | |||
| } | |||
| else | |||
| { | |||
| ICharacter? playerTreated = gameMap.FindPlayer(playerTreatedID); | |||
| if (player != null && playerTreated != null) | |||
| { | |||
| if (!playerTreated.IsGhost() && !player.IsGhost()) | |||
| return actionManager.Treat((Student)player, (Student)playerTreated); | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| public bool Rescue(long playerID, long playerRescuedID) | |||
| public bool Rescue(long playerID, long playerRescuedID = -1) | |||
| { | |||
| if (!gameMap.Timer.IsGaming) | |||
| return false; | |||
| ICharacter? player = gameMap.FindPlayer(playerID); | |||
| ICharacter? playerRescued = gameMap.FindPlayer(playerRescuedID); | |||
| if (player != null && playerRescued != null) | |||
| if (playerRescuedID == -1) | |||
| { | |||
| if (!playerRescued.IsGhost() && !player.IsGhost()) | |||
| return actionManager.Treat((Student)player, (Student)playerRescued); | |||
| if (player != null && !player.IsGhost()) | |||
| return actionManager.Rescue((Student)player); | |||
| } | |||
| else | |||
| { | |||
| ICharacter? playerRescued = gameMap.FindPlayer(playerRescuedID); | |||
| if (player != null && playerRescued != null) | |||
| { | |||
| if (!playerRescued.IsGhost() && !player.IsGhost()) | |||
| return actionManager.Rescue((Student)player, (Student)playerRescued); | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| public bool Fix(long playerID) | |||
| @@ -81,7 +81,7 @@ namespace Gaming | |||
| } | |||
| public bool BecomeInvisible(Character player) | |||
| public static bool BecomeInvisible(Character player) | |||
| { | |||
| return ActiveSkillEffect(player.UseIActiveSkill(ActiveSkillType.BecomeInvisible), player, () => | |||
| { | |||
| @@ -104,7 +104,7 @@ namespace Gaming | |||
| } | |||
| public bool UseKnife(Character player) | |||
| public static bool UseKnife(Character player) | |||
| { | |||
| return ActiveSkillEffect(player.UseIActiveSkill(ActiveSkillType.UseKnife), player, () => | |||
| { | |||
| @@ -115,6 +115,17 @@ namespace Gaming | |||
| { player.BulletOfPlayer = player.OriBulletOfPlayer; }); | |||
| } | |||
| public bool Publish(Character player) | |||
| { | |||
| return ActiveSkillEffect(player.UseIActiveSkill(ActiveSkillType.Publish), player, () => | |||
| { | |||
| player.BulletOfPlayer = BulletType.FlyingKnife; | |||
| Debugger.Output(player, "uses flyingknife!"); | |||
| }, | |||
| () => | |||
| { player.BulletOfPlayer = player.OriBulletOfPlayer; }); | |||
| } | |||
| public bool SuperFast(Character player) | |||
| { | |||
| return ActiveSkillEffect(player.UseIActiveSkill(ActiveSkillType.SuperFast), player, () => | |||