bool ProcessMove(GameMove gameMove, List <Actor> actors, GameData gameData) { Actor currentActor = actors.Find(a => a.name == gameMove.actionAuthorName); currentActor.currentLocation = gameMove.nextLocation; int index = actors.IndexOf(currentActor); playerTokens[index].TargetPosition = GetLocation(gameMove.nextLocation).playerLocations[index].position; switch (gameMove.gameAction) { default: case GameAction.Nothing: break; case GameAction.NormalAttack: case GameAction.StabAttack: return(ProcessAttack(gameMove, actors, currentActor)); case GameAction.RepairGenerator: if (currentActor.currentLocation == Location.Basement && gameData.generatorHp > 0) { gameData.generatorHp -= objectiveRepairRate; GameOuput.Output($"{currentActor.name} repairs the generator in the basement."); if (gameData.generatorHp <= 0) { basement.ClearObjective(); } return(true); } break; case GameAction.RepairGate: if (currentActor.currentLocation == Location.Exit && gameData.gateHp > 0) { gameData.gateHp -= objectiveRepairRate; GameOuput.Output($"{currentActor.name} repairs the exit gate."); if (gameData.gateHp <= 0) { exitGate.ClearObjective(); } return(true); } break; case GameAction.UnlockSafe: if (currentActor.currentLocation == Location.Armory && !gameData.isSafeUnlocked) { gameData.isSafeUnlocked = true; GameOuput.Output($"{currentActor.name} unlocks the safe containing the gun."); armory.ChangeObjective(); return(true); } break; case GameAction.TakeGun: if (currentActor.currentLocation == Location.Armory && !gameData.isGunTaken && gameData.isSafeUnlocked) { gameData.isGunTaken = true; currentActor.items.Add(Item.Gun); GameOuput.Output($"{currentActor.name} takes the gun in the safe."); armory.ClearObjective(); return(true); } break; case GameAction.TakeMedkit: if (currentActor.currentLocation == Location.Bathroom && !gameData.isMedkitTaken) { gameData.isMedkitTaken = true; currentActor.items.Add(Item.Medkit); GameOuput.Output($"{currentActor.name} takes the medkit in the bathroom."); bathroom.ClearObjective(); return(true); } break; case GameAction.UseMedkit: if (currentActor.items.Contains(Item.Medkit)) { Actor healTarget = actors.Find(actor => actor.name == gameMove.actionTargetName); if (healTarget == null) { var anyActorQuery = from actor in actors where actor.currentLocation == currentActor.currentLocation select actor; var anyActorList = anyActorQuery.ToList(); healTarget = anyActorList[MyRandom.Next(0, anyActorList.Count)]; } if (healTarget.currentLocation == currentActor.currentLocation) { currentActor.items.Remove(Item.Medkit); healTarget.hp = 100; GameOuput.Output($"{currentActor.name} heals {healTarget.name} with the medkit!"); return(true); } } break; } return(false); }