megazear7 / battleleague

0 stars 0 forks source link

Add Game Types #7

Open megazear7 opened 10 years ago

megazear7 commented 10 years ago

Give ability to choose different game types. This will require adding a string field to games with a drop down list of different game types. Then when an army moves a method will need to be called. This method will be in the game class. It will look at this.game_type and call another method based on what this.game_type is. In this method it will determine who gets victory points and how much. In this way you can add a method, add a string to the drop down select, and you have a new game type. In this method it should check for end of game status to know whether the game has ended, if so it should mark the winning alliances / teams is_winner flag and set the games has_ended flag (both of which need to be added). Also there will need to be a corresponding method to initialize the game, as some games might start with different victory points or something. Also an option for "custom" needs added so that the players can track manually if they want to.

megazear7 commented 10 years ago
add_column :games, :game_type, :string
add_column :alliance, :is_winner, :boolean
add_column :armies, :is_winner, :boolean
add_column :games, :has_ended, :boolean
megazear7 commented 10 years ago

Also spaces will need to be capturable. This also might depend on the game type as well. So maybe this could be taken care of in that game type method. Regardless we will need something like this:

spaces belongs_to :user 
# and for convenience:
def alliance
  self.user.armies.where(game: self.game).first.alliance
end