private void RemoveRandomCard(List <WonderCardModel> typeDeck, EraType era) { var deck = typeDeck.Where(x => x.Era == era).ToList(); var removeIndex = _randomService.Next(deck.Count - 1); typeDeck.RemoveAt(removeIndex); }
/// <summary> /// Instantiates a Simulation Era object for the supplied arguements /// </summary> /// <param name="Simulation">The simulation to which the era belongs</param> /// <param name="Type">The era type</param> /// <param name="Name">The era name</param> /// <param name="Description">The era decription</param> /// <param name="SQLConnector">A GFSqlConnector object representing a connection to the GroundFrame.SQL database</param> public SimulationEra(Simulation Simulation, EraType Type, string Name, string Description, GFSqlConnector SQLConnector) { //Load Resources this.LoadResource(); if (Simulation == null) { throw new ArgumentNullException(this._ExceptionMessageResources.GetString("InvalidSimulationArgument", Globals.UserSettings.GetCultureInfo())); } //Check the parent simulation is saved to the GroundFrame.SQL Database if (Simulation.ID == 0) { throw new ArgumentException(this._ExceptionMessageResources.GetString("InvalidSimulationNotSavedToDBArgument", Globals.UserSettings.GetCultureInfo())); } if (string.IsNullOrEmpty(Name)) { throw new ArgumentException(this._ExceptionMessageResources.GetString("InvalidSecondsArgument", Globals.UserSettings.GetCultureInfo())); } if (SQLConnector == null) { throw new ArgumentException(this._ExceptionMessageResources.GetString("InvalidSQLConnectorArgument", Globals.UserSettings.GetCultureInfo())); } this._SQLConnector = new GFSqlConnector(SQLConnector); //Create a new connection object to prevent connection / command conflicts this._ID = 0; this._SimID = Simulation.ID; this.Name = Name; this.Description = Description; this.Type = Type; this.SaveToSQLDB(); }
/// <summary> /// Parses a SqlDataReader object into a simulation era object /// </summary> /// <param name="DataReader"></param> private void ParseDataReader(SqlDataReader DataReader) { this._ID = DataReader.GetInt16(DataReader.GetOrdinal(("id"))); this._SimID = DataReader.GetInt16(DataReader.GetOrdinal(("sim_id"))); this.Name = DataReader.GetString(DataReader.GetOrdinal(("name"))); this.Description = DataReader.GetString(DataReader.GetOrdinal(("description"))); this.Type = (EraType)DataReader.GetByte(DataReader.GetOrdinal(("era_type_id"))); }
public WonderCardModel(int id, FocusType type, EraType era, string name, int cost) { Id = id; Type = type; Era = era; Name = name; Cost = cost; }