Last active
November 24, 2017 19:30
-
-
Save apeiros/807be6640d3ea4af6607e367f17de3dc to your computer and use it in GitHub Desktop.
This file contains 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
Stats = Struct.new(:strength, :dexterity, :endurance, :intelligence, :education, :social_status) do | |
def self.random(min: 5, max: 10) | |
new(*Array.new(6) { rand(min..max) }) | |
end | |
def +(other) | |
self.class.new( | |
strength+other.strength, | |
dexterity+other.dexterity, | |
endurance+other.endurance, | |
intelligence+other.intelligence, | |
education+other.education, | |
social_status+other.social_status, | |
) | |
end | |
end | |
roll = Stats.random | |
mod = Stats.new(0,0,1,2,0,1) | |
after_career = roll + mod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment