Skip to content

Instantly share code, notes, and snippets.

@duckinator
Forked from FluffyPira/5e.rb
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duckinator/e7d4980683525961cac7 to your computer and use it in GitHub Desktop.
Save duckinator/e7d4980683525961cac7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
roll1 = 4.times.map { rand(1..6) }.sort
roll2 = 4.times.map { rand(1..6) }.sort
roll3 = 4.times.map { rand(1..6) }.sort
roll4 = 4.times.map { rand(1..6) }.sort
roll5 = 4.times.map { rand(1..6) }.sort
roll6 = 4.times.map { rand(1..6) }.sort
roll1.reduce(:+) if roll1.size > 0
roll2.reduce(:+) if roll2.size > 0
roll3.reduce(:+) if roll3.size > 0
roll4.reduce(:+) if roll4.size > 0
roll5.reduce(:+) if roll5.size > 0
roll6.reduce(:+) if roll6.size > 0
strbonus = (roll1 - 10) / 2
dexbonus = (roll2 - 10) / 2
conbonus = (roll3 - 10) / 2
intbonus = (roll4 - 10) / 2
wisbonus = (roll5 - 10) / 2
chabonus = (roll6 - 10) / 2
acro = dexbonus
animal = wisbonus
arcana = intbonus
athlet = strbonus
decep = chabonus
hist = intbonus
insight = wisbonus
intim = chabonus
invest = intbonus
medicine = wisbonus
nature = intbonus
percep = wisbonus
perfor = chabonus
persua = chabonus
religion = intbonus
sleight = dexbonus
stealth = dexbonus
survival = wisbonus
testy = 4.times.map { rand(1..6) }.sort
puts "Stat Bonuses:"
puts "STR: #{strbonus}, DEX: #{dexbonus}, CON: #{conbonus}, INT: #{intbonus}, WIS: #{wisbonus}, CHA: #{chabonus}"
puts "Skill Bonuses:"
puts "Acrobatics: #{acro}, Animal Handling: #{animal}, Arcana #{arcana}, Athletics: #{athlet}, Deception: #{decep}, History: #{hist}, Insight: #{insight}, Intimidation #{intim}, Investigation #{invest}, Medicine: #{medicine}, Nature: #{nature}, Perception: #{percep}, Performance: #{perfor}, Persuasion: #{persua}, Religion: #{religion}, Sleight of Hand: #{sleight}, Stealth: #{stealth}, Survival: #{survival}"
puts "#{testy}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment