Skip to content

Instantly share code, notes, and snippets.

@FluffyPira
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save FluffyPira/89af2c4295c9f98af31b to your computer and use it in GitHub Desktop.
Save FluffyPira/89af2c4295c9f98af31b to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def roll_once
4.times.map { rand(1..6) }.sort.drop(1).reduce(:+)
end
def roll(rolls=1)
rolls.times.map { roll_once }
end
playerrolls = roll(6)
puts "Your rolls are #{playerrolls}"
puts "What do you want for strength"
str = gets.chomp.to_i
unless playerrolls.include?(str)
puts "Nice try wise guy"
else
strbonus = (str - 10) / 2
dexbonus = (roll_once - 10) / 2
conbonus = (roll_once - 10) / 2
intbonus = (roll_once - 10) / 2
wisbonus = (roll_once - 10) / 2
chabonus = (roll_once - 10) / 2
athletics = strbonus
acrobatics = dexbonus
sleightofhand = dexbonus
stealth = dexbonus
animalhandling = wisbonus
insight = wisbonus
medicine = wisbonus
perception = wisbonus
survival = wisbonus
arcana = intbonus
history = intbonus
investigation = intbonus
nature = intbonus
religion = intbonus
deception = chabonus
intimidation = chabonus
performance = chabonus
persuasion = chabonus
puts "Stat Bonuses:"
puts "STR: #{strbonus}, DEX: #{dexbonus}, CON: #{conbonus}, INT: #{intbonus}, WIS: #{wisbonus}, CHA: #{chabonus}"
puts "Skill Bonuses:"
puts "Acrobatics: #{acrobatics}, Animal Handling: #{animalhandling}, Arcana #{arcana}, Athletics: #{athletics}, Deception: #{deception}, History: #{history}, Insight: #{insight}, Intimidation #{intimidation}, Investigation #{investigation}, Medicine: #{medicine}, Nature: #{nature}, Perception: #{perception}, Performance: #{performance}, Persuasion: #{persuasion}, Religion: #{religion}, Sleight of Hand: #{sleightofhand}, Stealth: #{stealth}, Survival: #{survival}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment