Skip to content

Instantly share code, notes, and snippets.

@intinig
Created May 4, 2015 17:00
Show Gist options
  • Save intinig/4bb28cc7a7d3c9e99435 to your computer and use it in GitHub Desktop.
Save intinig/4bb28cc7a7d3c9e99435 to your computer and use it in GitHub Desktop.
BLOW = 0
ROLL = 1
PARRY = 2
HAND = 3
KI = 4
class Die
def self.faces
[[],[],[],[],[],[]]
end
def self.roll
faces.sample
end
end
class Giovanni < Die
def self.faces
[
[BLOW],
[BLOW],
[BLOW],
[BLOW],
[BLOW],
[BLOW]
]
end
end
class GreenDie < Die
def self.faces
[
[BLOW, BLOW],
[BLOW, BLOW, ROLL],
[ROLL],
[ROLL],
[ROLL, PARRY],
[HAND]
]
end
end
class GreyDie < Die
def self.faces
[
[BLOW],
[BLOW],
[BLOW, HAND],
[PARRY, HAND],
[HAND, HAND, PARRY],
[HAND, HAND]
]
end
end
class BlueDie < Die
def self.faces
[
[BLOW],
[BLOW, PARRY],
[PARRY],
[PARRY, PARRY],
[PARRY, PARRY],
[ROLL]
]
end
end
class RedDie < Die
def self.faces
[
[BLOW],
[BLOW],
[BLOW],
[BLOW],
[HAND, PARRY],
[HAND, ROLL]
]
end
end
DICE = [GreenDie, GreyDie, BlueDie, RedDie, Giovanni]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment