[![Gem Version](https://badge.fury.io/rb/gloomhaven.svg)](https://badge.fury.io/rb/gloomhaven) # Gloomhaven Ruby gem for generating Gloomhaven characters and ability decks. ## Installation Add this line to your application's Gemfile: ```ruby gem 'gloomhaven' ``` And then execute: $ bundle Or install it yourself as: $ gem install gloomhaven ## Usage ### Basic useage #### Deck Create a `Gloomhaven::Deck` `@deck` object to create a standard 20-`Gloomhaven::Card` modifier deck. ``` require 'gloomhaven' @deck = Gloomhaven::Deck.new => # # shuffle the deck to start @deck.shuffle! @deck.cards.count => 20 # draw some cards @deck.draw => # # check the deck size, it's decreased @deck.cards.count => 19 # Let's bless and curse the deck # Note that blessing/cursing a deck will automatically reshuffle the remaining (undrawn) cards. @deck.bless! @deck.curse! # confirm we added two new cards @deck.cards.count => 21 # let's shuffle the deck again and return the first card we drew @deck.shuffle! # final count of a shuffled deck w/ 1 bless, 1 curse @deck.cards.size => 22 # and let's look at the cards @deck.cards.to_a [ #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #, # ] ``` #### Player Create a `Gloomhaven::Player` `@player` object. Includes attribute tracking for `player#gold`, `player#xp`. ``` @player = Gloomhaven::Player.new(character_class: 'Mindthief', name: 'Ratteo') => # # check / set gold @player.gold => 0 @player.gold = 10 => 10 @player.gold => 10 # Note: can do the same attr setting w/ @player.xp ``` New players have a default, 20-card attack modifier `@deck` object. `@player`s can also add valid perks of class `Gloomhaven::Perk` to directly modify their deck. ``` @player.deck => # # Basic starting attack modifier deck comes with each player @player.deck.cards.count => 20 # Default characters don't have any perks @player.perks => [] # If we add perks, it will directly modify the deck # Let's remove two -1 cards @player.add_perk!(Gloomhaven::Perk.new('remove_two_minus_one_cards')) => [#"Attack -1", "count"=>2}]>] # And confirm the perks @player.perks => [#"Attack -1", "count"=>2}]>] # Finally, the deck should have two less cards because of the perk. @player.deck.cards.count => 18 # Perfect. Let's just double check the cards directly p @player.deck.cards.to_a [ #, #, #, #, #, #, #, #, #, #, #, #, #, #, # <-- Note we only have 3x -1 cards now #, #, #, # ] ```