public GameChoiceWindow() { InitializeComponent(); //create directory for dll files //C:/Users/Stephanie/Desktop/New folder/Project3/Project3/src/Cecs475.BoardGames.WpfApplication/bin/Debug/lib //C:/Users/samue/Documents/CECS 475/Project3/Project3/src/Cecs475.BoardGames.WpfApplication/bin/Debug/lib string dir = "C:/Users/samue/Documents/CECS 475/Project3/Project3/src/Cecs475.BoardGames.WpfApplication/bin/Debug/lib"; Type IGameType = typeof(IGameType); List <Assembly> GameSearch = new List <Assembly>(); foreach (var dll in Directory.GetFiles(dir, "*.dll")) { var y = Assembly.LoadFrom(dll); GameSearch.Add(y); } //filters the assemblies with goodes that are assignable and are classes var gameTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()).Where(t => IGameType.IsAssignableFrom(t) && t.IsClass); List <IGameType> GameList = new List <IGameType>(); foreach (var GameTypes in gameTypes) { var x = GameTypes.GetConstructor(Type.EmptyTypes); // empty type are constructors that have no parameters IGameType instance = (IGameType)x.Invoke(null); GameList.Add(instance); } //add the list to the resource this.Resources.Add("GameTypes", GameList); }
/* * Game */ // Expected time in seconds that a player is expected to complete this game static public int GameExpectedTime(GameTypes type, GameDifficulty difficulty) { double factor; switch (difficulty) { case GameDifficulty.Easy: factor = 1.3; break; case GameDifficulty.Master: factor = 0.7; break; case GameDifficulty.Medium: default: factor = 1.0; break; } switch (type) { case GameTypes.Memory: return((int)(30 * factor)); case GameTypes.Calculation: return((int)(60 * factor)); case GameTypes.VerbalAnalogy: return((int)(30 * factor)); } return((int)(120 * factor)); // Default for all games (logic) }
public IGame CreateGame(GameTypes gameType) { switch (gameType) { case GameTypes.Playstation: lock (lockObject) { if (playstation == null) { playstation = new Playstation(); } return(playstation); } case GameTypes.Xbox: lock (lockObject) { if (xbox == null) { xbox = new Xbox(); } return(xbox); } default: return(null); } }
public GameLocator(Type type, int variant, GameTypes game_type, bool isGame) { TypeOf = type; Variant = variant; GameType = game_type; IsGame = isGame; }
/* Game */ // Expected time in seconds that a player is expected to complete this game public static int GameExpectedTime(GameTypes type, GameDifficulty difficulty) { double factor; switch (difficulty) { case GameDifficulty.Easy: factor = 1.3; break; case GameDifficulty.Master: factor = 0.7; break; case GameDifficulty.Medium: default: factor = 1.0; break; } switch (type) { case GameTypes.Memory: return (int) (30 * factor); case GameTypes.Calculation: return (int) (60 * factor); case GameTypes.VerbalAnalogy: return (int) (30 * factor); } return (int) (120 * factor); // Default for all games (logic) }
/// <summary> /// Set up the game variables based on whether this is a new game or a continued game. Always called after start. /// </summary> /// <param name='gameType'> /// Game type. /// </param> private void SetupGame(bool loadingGame, GameTypes gameType) { if (loadingGame == false) { // todo instantiate game class Inning = 1; InningType = InningTypes.Top; if (gameType == GameTypes.Local) { CurrentPlayer = 2; // if local multiplayer, player 2 bats first } else { CurrentPlayer = 1; // if single player, player goes before AI } StartBatter(); } else { // todo loaded a game LoadGame(); } }
private static void PlayerAssignHelper(Tournament tournament, IEnumerable<Player> players, GameTypes gameTypes, int teamCount) { var randomizedPlayers = players.OrderBy(p => Guid.NewGuid()).ToList(); switch (gameTypes) { case GameTypes.Singles: tournament.AddPlayers(randomizedPlayers.GetRange(0, teamCount)); break; case GameTypes.Doubles: for (int i = 0; i < teamCount*2; i += 2) { tournament.AddPlayers(randomizedPlayers[i], randomizedPlayers[i + 1]); } break; case GameTypes.Both: tournament.AddPlayers(randomizedPlayers.GetRange(0, teamCount/2)); for (int i = teamCount/2; i < teamCount + teamCount/2; i += 2) { tournament.AddPlayers(randomizedPlayers[i], randomizedPlayers[i + 1]); } break; default: throw new ArgumentOutOfRangeException(nameof(gameTypes), gameTypes, null); } }
private static string getRandomMapByGameType(List <string> mapList, GameTypes gameType) { var filteredList = new List <string>(); switch (gameType) { case GameTypes.armsrace: case GameTypes.deathmatch: case GameTypes.teamdeathmatch: filteredList = mapList.Where(x => x.Contains("ar_")).ToList(); break; case GameTypes.casual: case GameTypes.wingman: filteredList = mapList.Where(x => x.Contains("de_")).ToList(); break; case GameTypes.competitive: filteredList = mapList.Where(x => x.Contains("de_") || x.Contains("cs_")).ToList(); break; case GameTypes.dangerzone: filteredList = mapList.Where(x => x.Contains("dz_")).ToList(); break; default: filteredList = mapList; break; } return(filteredList.ElementAt(new Random(DateTime.Now.Millisecond).Next(filteredList.Count()))); }
protected PokemonNew() { this.deoxysForm = byte.MaxValue; this.gameType = GameTypes.Any; this.container = null; this.raw = null; }
private void Add() { if (string.IsNullOrWhiteSpace(NewGameExtension)) { MessageBox.Show("Game extension is empty."); return; } if (string.IsNullOrWhiteSpace(NewGameSaveGame)) { MessageBox.Show("Game Save game folder is empty."); return; } if (string.IsNullOrWhiteSpace(NewGameName)) { MessageBox.Show("Game Name is empty."); return; } var gameType = new GameType { Name = NewGameName, Extension = NewGameExtension, Icon = NewGameIcon, Savegames = NewGameSaveGame }; GameTypes.Add(new GameTypeViewModel(gameType)); Adding = false; }
public override void Unpack(byte[] data) { Reset(data); GameStyle = (GameTypes)ReadUInt16(); GameOptions = (GameOptionFlags)ReadUInt16(); MaxPlayers = ReadUInt16(); MaxShots = ReadUInt16(); TeamData.Clear(); for (TeamColors t = TeamColors.RogueTeam; t <= TeamColors.ObserverTeam; t++) { TeamInfo info = new TeamInfo(); info.Team = t; info.Size = ReadUInt16(); TeamData.Add(t, info); } for (TeamColors t = TeamColors.RogueTeam; t <= TeamColors.ObserverTeam; t++) { TeamInfo info = TeamData[t]; info.Max = ReadUInt16(); } ShakeWins = ReadUInt16();; ShakeTimeout = ReadUInt16();; MaxPlayerScore = ReadUInt16();; MaxTeamScore = ReadUInt16();; ElapsedTime = ReadUInt16();; }
public override bool IsRequirementsFulfilled(IGameSave gameSave) { GBAGameSave gbaSave = gameSave as GBAGameSave; GameTypes gameType = gameSave.GameType; for (int i = 0; i < 40; i++) { if (gameSave.Inventory.Items[ItemTypes.Berries].GetCountOfID((ushort)(i + 133)) == 0 && gameSave.Inventory.Items[ItemTypes.PC].GetCountOfID((ushort)(i + 133)) == 0) { return(false); } } if (gameType == GameTypes.Ruby || gameType == GameTypes.Sapphire) { return(gbaSave.GetGameFlag((int)RubySapphireGameFlags.HasBeatenEliteFour)); } else if (gameType == GameTypes.FireRed || gameType == GameTypes.LeafGreen) { return(gbaSave.GetGameFlag((int)FireRedLeafGreenGameFlags.HasBeatenEliteFour)); } else if (gameType == GameTypes.Emerald) { return(gbaSave.GetGameFlag((int)EmeraldGameFlags.HasBeatenEliteFour)); } return(false); }
private void vote() { if (_Settings.EventsEnabled) { _Arena.sendArenaMessage("[Event] Games until event starts: " + (Settings.GamesBeforeEvent - _gameCount)); _gameCount++; } if (_Settings.EventsEnabled && (_gameCount > Settings.GamesBeforeEvent)) { _Settings.GameState = GameStates.PreGame; _GameType = GameTypes.GLAD; _gameCount = 0; return; } if (!Settings.VotingEnabled) { _Arena.sendArenaMessage("[Game] Voting has been disabled."); } else { _VoteSystem = new VoteSystem(); string getTypes = string.Join(", ", gametypes); _Arena.sendArenaMessage("[Round Vote] Gametype Vote starting - Vote with ?Game <type>", 1); _Arena.sendArenaMessage(string.Format("[Round Vote] Choices are: {0}", getTypes)); } _Settings.GameState = GameStates.PreGame; preGame(); }
private void Awake() { Player1Stats.Health = 3; Player2Stats.Health = 3; BSS = FindObjectOfType <BallSpawnerScript>(); UltimatePinballData Data = SaveManager.LoadUltimatePinball(); Game_Type = (GameTypes)Data.LastGameTypeSelected; switch (Game_Type) { case GameTypes.Lives: Player1Stats.Health = Data.LastGameTypeAmountSelected; Player2Stats.Health = Data.LastGameTypeAmountSelected; break; case GameTypes.Timer: TimeLimit = Data.LastGameTypeAmountSelected; Timer = TimeLimit; break; case GameTypes.SetScore: TargetScore = Data.LastGameTypeAmountSelected; break; default: break; } }
Game ReturnRandomGameByType(GameTypes selectedType) { int randomIndex = 0; bool searchComplete = false; List <Game> potentialGames = GamesByType[selectedType]; Game returnGame = null; if (potentialGames.Count > 0) { while (!searchComplete) { randomIndex = Random.Range(0, potentialGames.Count); returnGame = potentialGames[randomIndex] as Game; if (OpenToPlay(returnGame)) { searchComplete = true; } else { potentialGames.Remove(returnGame); returnGame = null; if (potentialGames.Count < 1) { searchComplete = true; } // } // if/else Open to play } // While search isn't complete } // If potentialGames.count > 0 return(returnGame); }
public Game GetIdealGame(string Title, GameTypes typePref) { if (Games.Count < 1) { return(null); } Game returnGame = null; if (Title != "none") { returnGame = ReturnGame(Title); } if (returnGame) { return(returnGame); } returnGame = ReturnRandomGameByType(typePref); if (returnGame) { return(returnGame); } return(ReturnRandomGame()); }
public bool AssginKfFuben(GameTypes gameType, long gameId, int roleNum, out int kfSrvId) { kfSrvId = 0; lock (Mutex) { long payload = long.MaxValue; ClientAgent assignAgent = null; foreach (var sid in AllKfServerId) { ClientAgent agent = null; if (ServerId2ClientAgent.TryGetValue(sid, out agent) && agent.IsAlive && agent.TotalRolePayload < payload) { payload = agent.TotalRolePayload; assignAgent = agent; } } if (assignAgent != null) { assignAgent.AssginKfFuben(gameType, gameId, roleNum); kfSrvId = assignAgent.ClientInfo.ServerId; return(true); } } return(false); }
public override async Task <string> SendCapitulationRequest(GameTypes type, string address, string password = "") { if (!Players.ContainsKey(address)) { return(await Task.FromResult("Player address is not in the list of players!")); } try { var dto = new ChessGameDto() { GameId = Id.ToString(), GameState = string.Empty, Type = GameDtoTypes.ChessGame, LastGameRecordTxId = string.Empty, CapitulationRequest = true, }; dto.Players = new Dictionary <string, ChessPlayer>(); if (Players.TryGetValue(Player1Address, out var pl1)) { pl1.FigureType = FigureTypes.White; } if (Players.TryGetValue(Player1Address, out var pl2)) { pl2.FigureType = FigureTypes.Black; } foreach (var pl in Players) { dto.Players.TryAdd(pl.Key, pl.Value); } var moveString = JsonConvert.SerializeObject(dto); var tkData = new SendTokenTxData() { Amount = 1, Symbol = TokenSymbol, SenderAddress = Player1Address, ReceiverAddress = Player2Address, Id = TokenId }; tkData.Metadata.TryAdd("GameId", Id.ToString()); tkData.Metadata.TryAdd("GameData", moveString); tkData.Password = password; var res = await NeblioTransactionHelpers.SendNTP1TokenAPI(tkData, 30000); return(await Task.FromResult(res)); } catch (Exception ex) { log.Error("Chess Game - Cannot write move!", ex); return(await Task.FromResult("ERROR")); } }
public GameSessions(List <PlayerForGameSession> _current_players, GameTypes _gameType) { for (int i = 0; i < _current_players.Count; i++) { _current_players[i].SetPlayerGameType(_gameType); _current_players[i].MakePlayerBusyForSession(); CurrentPlayers.Add(_current_players[i]); } CurrentSessionType = _gameType; if (OrganizePVP(CurrentSessionType).Result) { WhenCheckWasOK = DateTime.Now; SessionStatus = PlayerStatus.ischeckedOrganization; for (int i = 0; i < CurrentPlayers.Count; i++) { CurrentPlayers[i].SetStatusToChecked(); WaitAndMakePlayerReadyStatus(); } } else { for (int i = 0; i < CurrentPlayers.Count; i++) { CurrentPlayers[i].ResetPlayerStatusToNonBusy(); } Server.GameSessionsAwaiting.Remove(this); } }
public bool init(IEventObject invoker) { //Populate our variables _Arena = invoker as Arena; _CFG = _Arena._server._zoneConfig; _Settings = new Settings(); _KOTH = new KOTH(_Arena, _Settings); _CTF = new CTF(_Arena, _Settings); _TDM = new TDM(_Arena, _Settings); _Gladiator = new Gladiator(_Arena, _Settings); _GameType = GameTypes.TDM; foreach (string type in gametypes) { Settings.AllowedGameTypes.Add((GameTypes)_Settings.GetType(type)); } //Put here so allowed game types aren't doubled in the vote system _VoteSystem = new VoteSystem(); _gameCount = 0; return(true); }
public ColosseumPokemon(byte[] data) { this.raw = data; this.gameType = GameTypes.Any; this.deoxysForm = byte.MaxValue; this.pokemonFinder = new PokemonFinder(this); }
/// <summary> /// Initialize a new human player. /// </summary> /// <param name="name">The name of the player.</param> /// <param name="diceHandler">The <see cref="DiceHandler"/> that handles the player's dice.</param> /// <param name="gameType">The type of game the player is participating in.</param> /// <param name="input">The <see cref="InputState"/> to check for touch input.</param> /// <param name="rollButtonTexture">Texture for the roll button.</param> /// <param name="scoreButtonTexture">Texture for the score button.</param> /// <param name="graphicsDevice">The <see cref="GraphicsDevice"/> depicting the display.</param> public HumanPlayer(string name, DiceHandler diceHandler, GameTypes gameType, InputState input, Rectangle screenBounds) : base(name, diceHandler) { this.input = input; this.gameType = gameType; this.screenBounds = screenBounds; }
public SettingsViewModel(ISettingsService settingsService, IGameTypeFactory gameTypeFactory, IChessPawnFactory chessPawnFactory, IDialogCoordinator dialogCoordinator, IChessboard chessboard) : base(settingsService, dialogCoordinator, chessboard) { _gameTypeFactory = gameTypeFactory; _chessPawnFactory = chessPawnFactory; _selectedGameType = GameTypes.FirstOrDefault(); SaveCommand = new DelegateCommand(SaveSettings); LoadSettings(); }
private void GetGameTypes() { //for_appSettings.GameTypes; foreach (var gametype in _appSettings.GamesTypes) { GameTypes.Add(gametype); } RaisePropertyChanged(nameof(GameTypes)); }
public Game(int id, string title, GenreTypes genre, GameTypes type, int releaseYear, double popularity) { Id = id; Title = title; Genre = genre; Type = type; ReleaseYear = releaseYear; PopularityRating = popularity; }
public override void AddGametype <T>(string gameType) { gameType = gameType.ToLower(); if (GameTypes.ContainsKey(gameType)) { Debug.Warning("server", $"Gametype '{gameType}' already exist"); } GameTypes.Add(gameType, typeof(T)); }
public void SetGameType(GameTypes gameType) { var spr = timeSpr; // 暂时不需要 // var spr = (gameType == GameTypes.Missions) ? missionSpr : timeSpr; bgImg.sprite = spr; }
internal static IOutcome<List<IHero>> LoadHeroes(GameTypes gameType) { var AllHeroes = HeroImporter.ImportHeroesFromAssemblies(); InitializeHeroState(AllHeroes); var Validator = new HeroValidator(AllHeroes, gameType); var ValidHeroesOutcome = Validator.GetValidHeroes(); return ValidHeroesOutcome; }
void Client_ReceiveGameType(RemoteEntityWorld sender, ReceiveDataReader reader) { GameTypes value = (GameTypes)reader.ReadVariableUInt32(); if (!reader.Complete()) { return; } gameType = value; }
public CreateTableViewModel(GameInfo game) { Game = game; GameTypes = game.AvailableVariants.OrderBy(x => (int)x).ToArray(); CurrentGameType = GameTypes.FirstOrDefault(); MinPlayers = game.MinPlayers; MaxPlayers = game.MaxPlayers; WaitingTimeAfterPlayerAction = 500; TableName = "Player's Table"; }
public PokemonOld(GameTypes gameType, byte[] data, bool decrypted = false) { this.gameType = gameType; this.deoxysFormID = (byte)(gameType == GameTypes.FireRed ? 1 : (gameType == GameTypes.LeafGreen ? 2 : (gameType == GameTypes.Emerald ? 3 : 0))); if (decrypted) OpenDecryptedData(data); else OpenEncryptedData(data); }
/// <summary> /// Resets form /// </summary> private void Reset() { Name = string.Empty; Description = string.Empty; Cost = 0; GameVariants.ForEach(x => x.IsSelected = false); GameTypes.ForEach(x => x.IsSelected = false); TableTypes.ForEach(x => x.IsSelected = false); Images.Clear(); }
public static IGame GetGame(GameTypes type, string id, string player1, string player2, string actualStateTx) { switch (type) { case GameTypes.ChessGame: return(new ChessGame(id, player1, player2, actualStateTx)); } return(null); }
public static IValidationStrategy GetValidatorFor(GameTypes gameType) { switch (gameType) { case GameTypes.DeathMatch: return new DeathMatchValidator(); default: throw new InvalidOperationException("Unexpected MatchType: " + gameType); } }
public void Game_Event(string event_name) { switch (event_name) { case "cannon": m_game_type = GameTypes.Cannon; m_manager_gameplay_cannon.Game_Event(event_name); break; } }
public void RemoveKfFuben(GameTypes gameType, int kfSrvId, long gameId) { lock (Mutex) { ClientAgent agent = null; if (ServerId2ClientAgent.TryGetValue(kfSrvId, out agent)) { agent.RemoveKfFuben(gameType, gameId); } } }
public SelectGameTypeWindow(GameTypes gameType1, GameTypes gameType2) { InitializeComponent(); this.gameType1 = gameType1; this.gameType2 = gameType2; imageGame1.Source = ResourceDatabase.GetImageFromName(gameType1.ToString() + "Physical"); imageGame2.Source = ResourceDatabase.GetImageFromName(gameType2.ToString() + "Physical"); labelGame1.Content = gameType1.ToString(); labelGame2.Content = gameType2.ToString(); }
public static GameTypes? ShowDialog(Window owner, GameTypes gameType1, GameTypes gameType2) { SelectGameTypeWindow form = new SelectGameTypeWindow(gameType1, gameType2); form.Owner = owner; form.WindowStartupLocation = WindowStartupLocation.CenterOwner; var dialogResult = form.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value) { return form.result; } return null; }
// Type enum to string representation (locale sensitive) public static string GetLocalized(ITranslations translations, GameTypes type) { switch (type) { case GameTypes.LogicPuzzle: return translations.GetString ("Logic"); case GameTypes.Memory: return translations.GetString ("Memory"); case GameTypes.Calculation: return translations.GetString ("Calculation"); case GameTypes.VerbalAnalogy: return translations.GetString ("Verbal"); default: throw new InvalidOperationException ("Unknown game type"); } }
public GCGameSave(string filePath, bool japanese = false) { byte[] data = File.ReadAllBytes(filePath); this.hasGCIData = false; this.gameType = GameTypes.Any; this.japanese = japanese; // GCI Data is 64 bytes in length if (data.Length == 393216 || data.Length == 393280) { if (data.Length == 393280) hasGCIData = true; gameType = GameTypes.Colosseum; } else if (data.Length == 352256 || data.Length == 352320) { if (data.Length == 352320) hasGCIData = true; gameType = GameTypes.XD; } else { throw new Exception("GameCube save data must be 393,216 or 393,280 bytes in length for Colosseum, and 352,256 or 352,320 bytes in length for XD"); } // First 24,576 bytes are for the gamecube memory card manager, such as name and icon int start = 24576 + (hasGCIData ? 64 : 0); if (gameType == GameTypes.Colosseum) { this.saveData = new GCSaveData[3]; if (!ByteHelper.CompareBytes(255, ByteHelper.SubByteArray(start + 0x1dfec, data, 20))) this.saveData[0] = new GCSaveData(this, ByteHelper.SubByteArray(start, data, 122880)); if (!ByteHelper.CompareBytes(255, ByteHelper.SubByteArray(start + 122880 + 0x1dfec, data, 20))) this.saveData[1] = new GCSaveData(this, ByteHelper.SubByteArray(start + 122880, data, 122880)); if (!ByteHelper.CompareBytes(255, ByteHelper.SubByteArray(start + 122880 * 2 + 0x1dfec, data, 20))) this.saveData[2] = new GCSaveData(this, ByteHelper.SubByteArray(start + 122880 * 2, data, 122880)); PokePC.ApplyGameType(gameType); } else { this.saveData = new GCSaveData[2]; if (!ByteHelper.CompareBytes(0, ByteHelper.SubByteArray(start + 0x10, data, 16))) this.saveData[0] = new GCSaveData(this, ByteHelper.SubByteArray(start, data, 163840)); if (!ByteHelper.CompareBytes(0, ByteHelper.SubByteArray(start + 163840 + 0x10, data, 16))) this.saveData[1] = new GCSaveData(this, ByteHelper.SubByteArray(start + 163840, data, 163840)); PokePC.ApplyGameType(gameType); } this.raw = data; loaded = true; }
public static void StartGame(GameTypes gameType) { if (Game.GameState != GameStates.GameNotStarted) throw new InvalidOperationException(); var LoadOutcome = HeroLoader.LoadHeroes(gameType); if (!LoadOutcome.Success) throw new InvalidOperationException("Failure filtering valid heroes: " + LoadOutcome); if (LoadOutcome.Messages.Count > 0) { //Show messages? } //Arrange the game map //Arrange the heroes in space Game.GameType = gameType; Game.GameState = GameStates.GameOn; }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this._systems = new List<GameSystem>(); this._objects = new List<GameObject>(); this._services = new Dictionary<string, GameSystem>(); this._systemsCallOrder = new List<int>(); this.curScreen = ScreenType.Start; this.graphics.PreferredBackBufferWidth = 1200; this.graphics.PreferredBackBufferHeight = 800; this.graphics.ApplyChanges(); this.CurrentPathfindingGraph = new AStarGraph(this, new List<AStarNode>()); this.play1 = SpriteType.None; this.play2 = SpriteType.None; this.winner = 0; this.playe1 = PlayerType.None; this.playe2 = PlayerType.None; gameType = GameTypes.None; LivesOrTime = 0; this.mapType = MapType.Basic; this.Winner = null; }
void Client_ReceiveGameType( RemoteEntityWorld sender, ReceiveDataReader reader ) { GameTypes value = (GameTypes)reader.ReadVariableUInt32(); if( !reader.Complete() ) return; gameType = value; }
private void OnGameType2Clicked(object sender, RoutedEventArgs e) { result = gameType2; DialogResult = true; Close(); }
// // Applies scoring formula to the session // static int SessionScoreFormula(ref GameSessionHistoryExtended history, GameTypes type, GameDifficulty difficulty) { int logbase, scored, played, won; double score, factor; switch (difficulty) { case GameDifficulty.Easy: logbase = 10; break; case GameDifficulty.Medium: logbase = 20; break; case GameDifficulty.Master: logbase = 30; break; default: throw new InvalidOperationException ("Invalid switch value"); } switch (type) { case GameTypes.LogicPuzzle: scored = history.LogicRawScore; played = history.LogicPlayed; won = history.LogicWon; break; case GameTypes.Memory: scored = history.MemoryRawScore; played = history.MemoryPlayed; won = history.MemoryWon; break; case GameTypes.Calculation: scored = history.MathRawScore; played = history.MathPlayed; won = history.MathWon; break; case GameTypes.VerbalAnalogy: scored = history.VerbalRawScore; played = history.VerbalPlayed; won = history.VerbalWon; break; default: throw new InvalidOperationException ("Invalid switch value"); } // Simple percentage of games won vs played score = scored > 0 ? scored / played * 10 : 0; // Puts score of the game in prespective for the whole game factor = Math.Log (won + 2, logbase); // +2 to avoid log 0 score = score * factor; if (score > 100) score = 100; return (int) score; }
public void ApplyGameType(GameTypes gameType) { foreach (IPokeBox pokeBox in boxes) { for (int i = 0; i < pokeBox.NumSlots; i++) { if (pokeBox[i] != null) pokeBox[i].GameType = gameType; } } foreach (IPokemon pokemon in party) pokemon.GameType = gameType; foreach (IPokemon pokemon in daycare) pokemon.GameType = gameType; }
/* Session */ /* How the game session is scored * Every game has a scoring algorithm that scores the player performance within the game. This takes into account time used and tips (result is from 0 to 10) * The results are added to the games and scores arrays where we store the results for the different game types (verbal, logic, etc) * We apply a SessionScoreFormula function that balances the total result with the number of games played (is not the same 100% games won playing 2 than 10 games) and the difficulty The final result is a number from 0 to 100 */ public static void SessionUpdateHistoryScore(ref GameSessionHistoryExtended history, GameTypes type, GameDifficulty difficulty, int game_score) { bool won; int components = 0; won = (game_score > 0 ? true : false); if (won == true) { history.GamesWon++; } switch (type) { case GameTypes.LogicPuzzle: history.LogicRawScore += game_score; history.LogicPlayed++; if (won) history.LogicWon++; history.LogicScore = SessionScoreFormula (ref history, type, difficulty); break; case GameTypes.Memory: history.MemoryRawScore += game_score; history.MemoryPlayed++; if (won) history.MemoryWon++; history.MemoryScore = SessionScoreFormula (ref history, type, difficulty); break; case GameTypes.Calculation: history.MathRawScore += game_score; history.MathPlayed++; if (won) history.MathWon++; history.MathScore = SessionScoreFormula (ref history, type, difficulty); break; case GameTypes.VerbalAnalogy: history.VerbalRawScore += game_score; history.VerbalPlayed++; if (won) history.VerbalWon++; history.VerbalScore = SessionScoreFormula (ref history, type, difficulty); break; default: throw new InvalidOperationException ("Invalid switch value"); } history.TotalScore = 0; // Updates total score taking only into account played game types if (history.LogicScore >= 0) { history.TotalScore += history.LogicScore; components++; } if (history.MemoryScore >= 0) { history.TotalScore += history.MemoryScore; components++; } if (history.MathScore >= 0) { history.TotalScore += history.MathScore; components++; } if (history.VerbalScore >= 0) { history.TotalScore += history.VerbalScore; components++; } history.TotalScore = history.TotalScore / components; }
public void StartGame(GameTypes gameType) { StartGameService.StartGame(gameType); }
public static ColosseumPokemon CreateInvalidPokemon(ColosseumPokemon invalidBackup, GameTypes gameType = GameTypes.Any) { ColosseumPokemon pkm = new ColosseumPokemon(); pkm.invalidBackup = invalidBackup; pkm.GameType = gameType; pkm.IsInvalid = true; // Pokemon Info pkm.Personality = 0; pkm.SpeciesID = 0; pkm.IsSecondAbility2 = false; // Met Info pkm.TrainerName = "INVALID"; pkm.TrainerGender = Genders.Male; pkm.TrainerID = 0; pkm.SecretID = 0; pkm.BallCaughtID = 1; pkm.LevelMet = 0; pkm.MetLocationID = 0; pkm.EncounterType = GCEncounterTypes.None; pkm.IsObedient = false; pkm.GameOrigin = GameOrigins.Unknown; pkm.Language = Languages.English; // Personalization Info pkm.Nickname = "INVALID"; pkm.HeldItemID = 0; // Stats Info pkm.Experience = 1; pkm.Friendship = 0; pkm.HPEV = 0; pkm.AttackEV = 0; pkm.DefenseEV = 0; pkm.SpeedEV = 0; pkm.SpAttackEV = 0; pkm.SpDefenseEV = 0; pkm.HPIV = 0; pkm.AttackIV = 0; pkm.DefenseIV = 0; pkm.SpeedIV = 0; pkm.SpAttackIV = 0; pkm.SpDefenseIV = 0; // Status Info pkm.StatusCondition = StatusConditionFlags.None; pkm.TurnsOfSleepRemaining = 0; pkm.TurnsOfBadPoison = 0; pkm.PokerusStrain = 0; pkm.PokerusDaysRemaining = 0; pkm.PokerusRemaining = 0; // Contest Info pkm.Coolness = 0; pkm.Beauty = 0; pkm.Cuteness = 0; pkm.Smartness = 0; pkm.Toughness = 0; pkm.Feel = 0; pkm.CoolRibbonCount = 0; pkm.BeautyRibbonCount = 0; pkm.CuteRibbonCount = 0; pkm.SmartRibbonCount = 0; pkm.ToughRibbonCount = 0; pkm.HasChampionRibbon = false; pkm.HasWinningRibbon = false; pkm.HasVictoryRibbon = false; pkm.HasArtistRibbon = false; pkm.HasEffortRibbon = false; pkm.HasMarineRibbon = false; pkm.HasLandRibbon = false; pkm.HasSkyRibbon = false; pkm.HasCountryRibbon = false; pkm.HasNationalRibbon = false; pkm.HasEarthRibbon = false; pkm.HasWorldRibbon = false; // Move Info pkm.SetMoveAt(0, new Move(165, 0, 0)); // Struggle pkm.SetMoveAt(1, new Move()); pkm.SetMoveAt(2, new Move()); pkm.SetMoveAt(3, new Move()); // Recalculate Stats to make sure they're accurate pkm.RecalculateStats(); return pkm; }
/// <summary> /// Set up the game variables based on whether this is a new game or a continued game. Always called after start. /// </summary> /// <param name='gameType'> /// Game type. /// </param> private void SetupGame( bool loadingGame, GameTypes gameType ) { if ( loadingGame == false ) { // todo instantiate game class Inning = 1; InningType = InningTypes.Top; if ( gameType == GameTypes.Local ) { CurrentPlayer = 2; // if local multiplayer, player 2 bats first } else { CurrentPlayer = 1; // if single player, player goes before AI } StartBatter(); } else { // todo loaded a game LoadGame(); } }
public HeroValidator(List<IHero> heroes, GameTypes gameType) { this.Heroes = heroes; this.GameType = gameType; this.Validator = ValidationStrategyFactory.GetValidatorFor(GameType); }
private void OnButtonClicked(object sender, RoutedEventArgs e) { result = (GameTypes)(sender as Button).Tag; DialogResult = true; Close(); }
GBAPokemon CreateGBAPokemon(GameTypes gameType);
public PlayerPersonalRecord(GameTypes type, int previous_score, int new_score) { GameType = type; PreviousScore = previous_score; NewScore = new_score; }
public PlayerTile(GameTypes.TileType tileType , int id) { TileType = tileType; Id = id; TicksLeftToCompleteion = tileType.BuildingTime; }
public GBAPokemon CreateGBAPokemon(GameTypes gameType, bool passFinder = true) { GBAPokemon pkm = new GBAPokemon(); if (passFinder) pkm.PokemonFinder = PokemonFinder; pkm.GameType = gameType; pkm.DeoxysForm = DeoxysForm; pkm.Language = Language; // Pokemon Info pkm.Personality = Personality; pkm.SpeciesID = SpeciesID; pkm.IsSecondAbility2 = IsSecondAbility2; // Met Info pkm.TrainerName = TrainerName; pkm.TrainerGender = TrainerGender; pkm.TrainerID = TrainerID; pkm.SecretID = SecretID; pkm.BallCaughtID = BallCaughtID; pkm.LevelMet = LevelMet; pkm.MetLocationID = MetLocationID; pkm.IsFatefulEncounter = IsFatefulEncounter; pkm.GameOrigin = GameOrigin; // Personalization Info pkm.Nickname = Nickname; pkm.HeldItemID = HeldItemID; pkm.Markings = Markings; // Stats Info pkm.Experience = Experience; pkm.Friendship = Friendship; pkm.HPEV = HPEV; pkm.AttackEV = AttackEV; pkm.DefenseEV = DefenseEV; pkm.SpeedEV = SpeedEV; pkm.SpAttackEV = SpAttackEV; pkm.SpDefenseEV = SpDefenseEV; pkm.HPIV = HPIV; pkm.AttackIV = AttackIV; pkm.DefenseIV = DefenseIV; pkm.SpeedIV = SpeedIV; pkm.SpAttackIV = SpAttackIV; pkm.SpDefenseIV = SpDefenseIV; // Status Info pkm.StatusCondition = StatusConditionFlags.None; pkm.TurnsOfSleepRemaining = 0; pkm.TurnsOfBadPoison = 0; pkm.PokerusStrain = PokerusStrain; pkm.PokerusDaysRemaining = PokerusDaysRemaining; pkm.PokerusRemaining = PokerusRemaining; // Contest Info pkm.Coolness = Coolness; pkm.Beauty = Beauty; pkm.Cuteness = Cuteness; pkm.Smartness = Smartness; pkm.Toughness = Toughness; pkm.Feel = Feel; pkm.CoolRibbonCount = CoolRibbonCount; pkm.BeautyRibbonCount = BeautyRibbonCount; pkm.CuteRibbonCount = CuteRibbonCount; pkm.SmartRibbonCount = SmartRibbonCount; pkm.ToughRibbonCount = ToughRibbonCount; pkm.HasChampionRibbon = HasChampionRibbon; pkm.HasWinningRibbon = HasWinningRibbon; pkm.HasVictoryRibbon = HasVictoryRibbon; pkm.HasArtistRibbon = HasArtistRibbon; pkm.HasEffortRibbon = HasEffortRibbon; pkm.HasMarineRibbon = HasMarineRibbon; pkm.HasLandRibbon = HasLandRibbon; pkm.HasSkyRibbon = HasSkyRibbon; pkm.HasCountryRibbon = HasCountryRibbon; pkm.HasNationalRibbon = HasNationalRibbon; pkm.HasEarthRibbon = HasEarthRibbon; pkm.HasWorldRibbon = HasWorldRibbon; // Move Info pkm.SetMoveAt(0, GetMoveAt(0)); pkm.SetMoveAt(1, GetMoveAt(1)); pkm.SetMoveAt(2, GetMoveAt(2)); pkm.SetMoveAt(3, GetMoveAt(3)); pkm.Checksum = pkm.CalculateChecksum(); // Recalculate Stats to make sure they're accurate pkm.RecalculateStats(); return pkm; }
public static uint GetHeartGaugeFromID(ushort shadowID, GameTypes gameType) { if (gameType == GameTypes.Colosseum) { if (colosseumHeartGauges.ContainsKey(shadowID)) return colosseumHeartGauges[shadowID]; return 0; } return 0; }
public void UpdateScore(GameTypes type, GameDifficulty difficulty, int game_score) { GameSessionHistoryExtended history = this; Score.SessionUpdateHistoryScore (ref history, type, difficulty, game_score); }