Sha256: 4cccf7ef4680693af0724ebd91d57621cbed7826e4dfff8d20ac1540eb24980a

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

module Dicechucker
  module GameLogic

    def check_dc(dc)
      self.roll >= dc
    end
    
    def explode(individual_rolls = false)
      dice = roll_dice
      dice.each do |roll|
        if roll == @size
          dice << (rand(@size)+1)
        end
      end
      report(dice, individual_rolls) 
    end
    
    def drop_high(number_to_drop = 1, individual_rolls = false)
      dice = roll_dice.sort.reverse.drop(number_to_drop)
      report(dice, individual_rolls)
    end
    
    def drop_low(number_to_drop = 1, individual_rolls = false)
      dice = roll_dice.sort.drop(number_to_drop)
      report(dice, individual_rolls)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dicechucker-0.6.0 lib/dicechucker/game_logic.rb