activerpg/entities/random_event.rb

61 lines
4.2 KiB
Ruby

class RandomEvent < Entity
@@eventTypes = [
"ate a real solid kebab", "discovered the secret of magnets", "managed to do almost seven whole pushups in a row",
"found a giant cache of fresh beans", "got help from a particularly friendly woodling sprite",
"received a kiss from a travelling prince. Or princess. They weren't exactly sure but it felt great",
"somehow managed to wake up rested", "finished a Rubix cube without swapping any of the stickers this time",
"made a bet with an impish gnome and won", "arm wrestled an ogre and won", "discovered a way to impersonate Guy Fieri",
"found an altar adorned with skulls but it turned out that the god being worshiped was just misunderstood and was actually pretty chill",
"paid for insurance at the blackjack table and it actually worked", "boiled a pot of water without screwing it up",
"finally replied to that text they got from a friend like a week ago but kept putting off responding for no good reason",
"made friends with a tree", "got invited to sit at the cool kids table", "found some dusty sacred texts",
"chose to be a better person", "digs up dirt on their political opponents", "was gifted a jar of honey from The True Queen Bee",
"changed a flat tire for a weary traveller", "won at a game of poker with a tribe of wandering mages",
"didn't die, not even a little", "accidentally solved world hunger, at least for a few minutes",
"felt at one with the universe before realizing it was just a bit of indigestion. But still, it felt pretty good",
"took a big refreshing gulp of ocean water", "replaced the batteries in the smoke detector",
"passed the lie detector test (somehow)", "was found innocent on all charges", "brushed their teeth and took a shower",
"stood up to the schoolyard bully", "found a penny. Not a particularly lucky one but hey, it's better than nothing",
"finally remembered the name of that song that they had half stuck in their head for the past several days",
"discovered music", "found the right cable from that big box of cables they keep saved in that one closet for some reason",
"artfully evaded a swarm of angry ducks", "fell into a hole but found a big ol' pile of treasure at the bottom",
"overheard a joke a friend said but no one else in the group did, repeated it and got good big laughs in return",
"found their way out of The Endless Wood", "found a scratch-off lottery ticket and won a couple bucks",
"got a haircut", "felt a fleeting moment of happiness", "went to bed early", "comforted a grieving child",
"deleted those dozen apps from their phone that they hadn't used in years", "planned a party that people actually showed up for",
"caught a lucky fish that whispered eldritch secrets to them", "raised awareness for The Cause", "helped a friend move",
"didn't burn down the house", "crafted a not-haunted puppet", "saw their childhood imaginary friend",
"discovered a cure for sneezing", "saved the world but it wasn't THAT big of a deal", "donated money to charity",
"regretted previous decisions and made amends", "educated the ignorant", "cut loose on the dance floor",
"filed the appropriate paperwork to prevent The Great Disintegration just in time", "made a new friend",
"finished that TV series their friend recommended a good few months back", "took a hot bath", "won the game",
"cracked the code", "found a sheep stuck on its side, and after righting it found a super small secret wishing well",
"raked some leaves for the elderly couple next door", "kissed a toad, hallucinated",
"saved up the pennies over the years and can now afford that downpayment", "lost a foot but found a fresh new one",
"ran into a crowd, who then started chanting and calling them Muad'Dib",
]
def get_default_doc()
q = {
'type' => :random_event,
'location' => nil,
'name' => @@eventTypes.sample
}
return q
end
def resolve(p)
exp = p.get('exp')
max_xp_gain = ((exp.to_f * (0.10)).to_i)+1
actual_xp_gain = rand(max_xp_gain)+1
result = p.get('name') + "[" + exp.to_s + "xp] " + self.get('name') + "!"
result = result + " They gained " + actual_xp_gain.to_s + "xp!"
p.gain_exp(actual_xp_gain)
return result
end
end