Last active
August 29, 2015 14:08
-
-
Save FluffyPira/89af2c4295c9f98af31b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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