Sha256: ef4cc8dc7f92461c666b88d99ad0bb168e1a73b72f14c6fd2cccbf32e4d9a33b
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
module HDeck # Manager class for Card Caster class CardCaster attr_accessor :alignment, :deck def initialize(alignment: 'CN') @alignment = alignment @deck = Deck.new end def draw_card(shuffle_before: true, replace: false, calculate_match: false) if deck.length <= 0 puts 'Deck is out of cards' return end deck.shuffle if shuffle_before drawn_card = deck.draw(replace: replace) if calculate_match # Bonuses applied via Role Dealer feat case detect_alignment_match(drawn_card) when :full puts "Full alignment match!\n"\ "--------------------\n"\ "crit range: 19-20\n"\ "crit damage bonus: x3\n"\ "+4 bonus to confirmation roll\n" when :partial puts "Partial alignment match!\n"\ "--------------------\n"\ "crit range: 19-20\n" end end puts("\n#{drawn_card.to_s}\n\n") end def detect_alignment_match(card) return :full if card.morality == @alignment @alignment.each_char do |sign| return :partial if card.morality.include?(sign) end :none end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hdeck-0.1.3 | lib/hdeck/card_caster.rb |
hdeck-0.1.2 | lib/hdeck/card_caster.rb |
hdeck-0.1.1 | lib/hdeck/card_caster.rb |
hdeck-0.1.0 | lib/hdeck/card_caster.rb |