public static void EnterRoom(GameCharacters character, string roomName) { RoomBase characterCurrentRoom; // Only the player should trigger Exit and Enter events (which show text on the console) // Other characters should move around freely without triggering events or showing text if (character == GameCharacters.Player) { // Exit the existing room, if there is one set characterCurrentRoom = GetCharacterCurrentRoom(character); if (characterCurrentRoom != null) { characterCurrentRoom.Exit(); } } // Take note of where the character is now characterRoomLocations[character] = roomName; if (character == GameCharacters.Player) { characterCurrentRoom = GetCharacterCurrentRoom(character); // Enter the new room characterCurrentRoom.Enter(); // Take a look around characterCurrentRoom.Look(); } }
public static void WriteCharacterStats(GameCharacters gameCharacter) { var characterRoom = RoomManager.GetCharacterCurrentRoom(gameCharacter); var character = Characters[gameCharacter]; Console.WriteLine("-----------------------------------"); Console.WriteLine($"[{characterRoom.RoomName}] {character.Name} HP: {character.HitPoints} / {character.MaxHitPoints}"); }
public static void ProcessCharacterTurn(GameCharacters gameCharacter) { var character = Characters[gameCharacter]; // If a character is dead, they don't get a turn if (character.IsDead()) { return; } character.ProcessCharacterTurn(); }
public void SetCharacter(string gameCharacter) { //check to see the value inside of the string is equal to samurai or cowboy and set the local player equal to the right one if (gameCharacter == "Blademaster") { m_LocalPlayerCharacter = GameCharacters.Samurai; } else if (gameCharacter == "Gunslinger") { m_LocalPlayerCharacter = GameCharacters.Cowgirl; } }
public static bool CharacterIsInRoom(GameCharacters character, string roomName) { // If this character is nowhere if (!characterRoomLocations.ContainsKey(character)) { return(false); } string characterRoomName = characterRoomLocations[character]; return(characterRoomName.Equals(roomName)); }
public static bool CharacterIsInPlayersRoom(GameCharacters character) { if (!characterRoomLocations.ContainsKey(character)) { return(false); } string characterRoomName = characterRoomLocations[character]; string playersRoomName = characterRoomLocations[GameCharacters.Player]; return(characterRoomName.Equals(playersRoomName)); }
public static RoomBase GetCharacterCurrentRoom(GameCharacters character) { // If this character is nowhere if (!characterRoomLocations.ContainsKey(character)) { return(null); } string roomName = characterRoomLocations[character]; var room = roomStates[roomName]; return(room); }
public void UpdateLocationGameCharacters() { ObservableCollection <Character> updatedLocationCharacters = new ObservableCollection <Character>(); foreach (Character character in _gameCharacters) { updatedLocationCharacters.Add(character); } GameItems.Clear(); foreach (Character character in updatedLocationCharacters) { GameCharacters.Add(character); } }
//------------------------------------------------- #region static Methods Region public static CharacterInfo GetCharacterInfo(GameCharacters character, uint status) { CharacterInfo info = new CharacterInfo(character.ToString(), status); switch (character) { case GameCharacters.Kotomine: // Do Something here.. break; case GameCharacters.Tohsaka: // Do something here... break; case GameCharacters.Dark_Lord: // Do Another thing herer :" ... break; } return(info); }
public void AddDialog(GameCharacters character, ushort CharacterStatus, string DialogText, bool IsRight = false) { AddDialog(character.ToString(), CharacterStatus, DialogText, IsRight); }
public static void CharacterAttacksCharacter(GameCharacters attackingPlayer, GameCharacters defendingPlayer) { var attacker = Characters[attackingPlayer]; // If the attacker is dead then just don't do anything here. // If a message should be shown, then show it at the calling location if (attacker.IsDead()) { return; } var defender = Characters[defendingPlayer]; // The player can't be the defender at this point. // A player death should have been processed before here. // This can only be a character target. if (defender.IsDead()) { Console.WriteLine($"It would be pointless to attack {defender.Name}, they are already dead."); return; } // Now we know both characters are alive, process the attack // Determine the attacker attack value int damage = rnd.Next(0, attacker.Strength); // Apply the damage to the defender defender.Hit(damage); // Player is defending if (defendingPlayer == GameCharacters.Player) { Console.WriteLine( damage == 0 ? $"{attacker.Name} tries to attack you, but misses!" : $"You are attacked by {attacker.Name} for {damage} damage!" ); // The player dying is processed globally by the main game loop } else { if (damage == 0) { Console.WriteLine( attackingPlayer == GameCharacters.Player ? $"You attempt to attack {defender.Name} but miss!" : $"{attacker.Name} tries to attack {defender.Name} but misses!" ); } else { Console.WriteLine( attackingPlayer == GameCharacters.Player ? $"You attack {defender.Name} for {damage} damage!" : $"{attacker.Name} attacks {defender.Name} for {damage} damage!" ); } if (defender.IsDead()) { Console.WriteLine($"{defender.Name} has died."); } } }
public static bool CharacterIsDead(GameCharacters character) { var attacker = Characters[character]; return(attacker.IsDead()); }
public string TenGacha(EntertainMember entertainMember) { try { random = new Random(); if (entertainMember.gold < 1500) { return("\n?!你钻石不够力!"); } if (CurrentPoll == null) { return("\n当前没有扭蛋池子开放!"); } string output = ""; List <GameCharacters> newChars = new List <GameCharacters>(); entertainMember.gold -= 1500; for (int i = 0; i < 10; i++) { GameCharacters newChar = new GameCharacters(); int rnum = random.Next(1000) + 1; if (rnum <= CurrentPoll.upProbSSR) { if (rnum <= CurrentPoll.upProb) { newChar.name = CurrentPoll.upSSRChar[0]; newChar.starNum = 3; } else { int num = random.Next(CurrentPoll.SSRChar.Count()); newChar.name = CurrentPoll.SSRChar[num]; newChar.starNum = 3; } } else if (rnum > 1000 - (CurrentPoll.upProbSR)) { if (rnum >= 970) { newChar.name = CurrentPoll.upSRChar[0]; newChar.starNum = 2; } else { int num = random.Next(CurrentPoll.SRChar.Count()); newChar.name = CurrentPoll.SRChar[num]; newChar.starNum = 2; } } else { int num = random.Next(CurrentPoll.RChar.Count()); newChar.name = CurrentPoll.RChar[num]; newChar.starNum = 1; } newChars.Add(newChar); } if (newChars.Where(s => s.starNum == 2).FirstOrDefault() == null && newChars.Where(s => s.starNum == 3).FirstOrDefault() == null) { GameCharacters newChar = new GameCharacters(); int rnum = random.Next(100) + 1; if (rnum <= 16) { newChar.name = CurrentPoll.upSRChar[0]; } else { int num = random.Next(CurrentPoll.SRChar.Count()); newChar.name = CurrentPoll.SRChar[num]; } newChar.starNum = 2; newChars.RemoveAt(9); newChars.Add(newChar); } foreach (GameCharacters character in newChars) { if (entertainMember.inventory.Where(s => s.name == character.name).FirstOrDefault() == null) { entertainMember.inventory.Add(character); output += "\nNEW!! "; for (int i = 0; i < character.starNum; i++) { output += "★"; } output += character.name; } else { output += "\n"; for (int i = 0; i < character.starNum; i++) { output += "★"; } int stone = 0; switch (character.starNum) { case 1: stone = 1; break; case 2: stone = 10; break; case 3: stone = 50; break; } output += character.name + " => " + stone + "母!"; entertainMember.stoneNum += stone; } } LogMemberDetails(entertainMember); return(output); } catch (Exception e) { return("错误!" + e.ToString()); } }
public Game() { GameCharacters = new GameCharacters(); }
//Bring the camera associated with the new character to top priority public void DisplayCharacter(GameCharacters characterToDisplay) { characterCameras[currentlyActiveCamera].Priority = 0; characterCameras[(int)characterToDisplay].Priority = 10; }