Skip to content

Instantly share code, notes, and snippets.

@mediocretes
Created March 3, 2012 02:24
Show Gist options
  • Save mediocretes/1963826 to your computer and use it in GitHub Desktop.
Save mediocretes/1963826 to your computer and use it in GitHub Desktop.
claudius = {
:name => 'Claudius',
:bluff => 5,
:diplomacy => 7,
:intimidate => 3,
:perception => 1,
:sense_motive => 2,
:stealth => 7 }
albert = {
:name => 'Albert',
:bluff => 3,
:diplomacy => 11,
:intimidate => 3,
:perception => 0,
:sense_motive => 4,
:stealth => -6}
cassandra = {
:name => 'Cassandra',
:bluff => 2,
:diplomacy => 7,
:intimidate => 2,
:perception => 7,
:sense_motive => 11,
:stealth => 0}
garen = {
:name => 'Garen',
:bluff => 0,
:diplomacy => 0,
:intimidate => 8,
:perception => 0,
:sense_motive => 0,
:stealth => 1}
benjamin = {
:name => 'Benjamin',
:bluff => 5,
:diplomacy => 4,
:intimidate => 4,
:perception => 7,
:sense_motive => 7,
:stealth => 15}
rivain = {
:name => 'Rivain',
:bluff => 2,
:diplomacy => 2,
:intimidate => 9,
:perception => 11,
:sense_motive => 12,
:stealth => 11 }
eidolon = {
:name => 'Eidolon',
:bluff => 0,
:diplomacy => 0,
:intimidate => 0,
:perception => 4,
:sense_motive => 4,
:stealth => 6 }
@pcs = [albert, garen, rivain, claudius, benjamin, eidolon]
def roll(skill)
puts "rolling #{skill} for pcs"
best = 0
best_str = "no one"
@pcs.each do |x|
die = 1+rand(20)
best_str = "#{x[:name]} at #{die + x[skill]}" if die + x[skill] > best
best = die+x[skill] if die+x[skill] > best
puts "Rolled #{die+x[skill]} (#{die}+#{x[skill]}) for #{x[:name]}"
end
"Best Roll was #{best_str}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment