Ok this is the actual inital code... need to convert from mongo to sqlite...
This commit is contained in:
parent
8c856ce465
commit
8fa1664bcb
13 changed files with 1168 additions and 0 deletions
91
entities/boss.rb
Normal file
91
entities/boss.rb
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
class Boss < Entity
|
||||
@@bossMods = [
|
||||
"Insanely Violent", "Horiffic and Huge", "Incredibly Monstrous", "World-Threatening",
|
||||
"Disasterously Unhinged", "Literally God-like", "Absurdly Deranged", "Wildly Disastrous",
|
||||
"Potentially Universe Ending", "Unhinged Ancient", "Insatiably Hungry", "Malevolently Cruel",
|
||||
"Practically Omniscient Like Wow You Don't Even Know",
|
||||
]
|
||||
|
||||
@@bossTypes = [
|
||||
"Space Demon", "Literal Star", "Supervillian", "Kitten", "Bob", "Subatomic Particle",
|
||||
"Dental Hygenist", "Creature from Beyond the Stars", "Previously Slumbering Elder Being",
|
||||
"Bag of Snacks that Says it's 20g In Size But Somehow 19g's of it are Just Air???",
|
||||
"Mysterious Button", "English Teacher", "Corrupted Wizard", "Pit Fiend",
|
||||
"King Henry VIII's 9th Wife", "Guy Fieri", "Celestial Being", "Balloon-Shaped Horror",
|
||||
"GREAT Worm", "Planet Smasher", "DragBot Mecha-Queen",
|
||||
]
|
||||
|
||||
@@bossLosses = [
|
||||
"returned from the dimension from which they came", "slumbers under the sea once more",
|
||||
"flees to the stars", "gives up and vanishes without a trace", "runs home to devise a new plan",
|
||||
]
|
||||
|
||||
@@bossWins = [
|
||||
"isn't sure what to do with themselves now, and goes off to plan an easier conflict",
|
||||
"only partially destroys the planet", "deletes a star out there, probably somewhere over the rainbow",
|
||||
"summoned several eldritch beings that quickly passed away in their atmosphere", "eats some cake",
|
||||
]
|
||||
|
||||
@@encounterTypes = [
|
||||
"tangle", "struggle", "wrestle", "argue", "combat", "stare down", "grapple",
|
||||
]
|
||||
|
||||
def get_default_doc()
|
||||
q = {
|
||||
'type' => :boss,
|
||||
'spawned_by' => nil,
|
||||
'location' => nil,
|
||||
'exp' => nil,
|
||||
'last_line' => nil,
|
||||
'name' => @@bossMods.sample + " " + @@bossTypes.sample
|
||||
}
|
||||
|
||||
return q
|
||||
end
|
||||
|
||||
def resolve(p)
|
||||
max_player_attack = p.get('exp')
|
||||
max_xp_gain = (self.get('exp').to_f + 0.25).to_i
|
||||
|
||||
encounter_str = "runs into a Boss, spawned by " +
|
||||
self.get("spawned_by") + " with their wicked incantation of \"" +
|
||||
self.get("last_line") + "\"! Known by legend as the "
|
||||
|
||||
result = p.get("name") + "[" + max_player_attack.to_s + "str] "
|
||||
result = result + encounter_str
|
||||
result = result + self.get("name") + "[" + self.get('exp').to_s + "str] "
|
||||
|
||||
player_attack = 1+rand(max_player_attack)
|
||||
foe_attack = 1+rand(self.get('exp'))
|
||||
|
||||
result = result + "They " + @@encounterTypes.sample + "! "
|
||||
result = result + "[" + player_attack.to_s + "dmg vs " + foe_attack.to_s + "dmg]! "
|
||||
|
||||
if player_attack > foe_attack then
|
||||
xp = 1 + rand(max_xp_gain)
|
||||
result = result + p.get("name") + " wins! "
|
||||
result = result + "The " + self.get('name') + " " + @@bossLosses.sample + "! "
|
||||
result = result + p.get('name') + " earns " + xp.to_s + "xp!"
|
||||
p.gain_exp(xp)
|
||||
elsif player_attack < foe_attack then
|
||||
result = result + "The " + self.get("name") + " wins and " + @@bossWins.sample + "! "
|
||||
|
||||
if self.get("spawned_by") != p.get("name") then
|
||||
raw_spawner = @mc.collection().find({"type" => :player, "name" => self.get("spawned_by")}).first
|
||||
s = Player.new(@mc, raw_spawner)
|
||||
|
||||
xp = 1 + rand(1 + (s.get("exp")*0.05).to_i)
|
||||
|
||||
result = result + self.get("spawned_by") + "'s nefarious plan succeeded! They gain " + xp.to_s + "xp!"
|
||||
s.gain_exp(xp)
|
||||
else
|
||||
result = result + self.get("spawned_by") + " was betrayed by their creation! "
|
||||
result = result + "The shame they feel is immeasurable!"
|
||||
end
|
||||
else
|
||||
result = result + "They tied! They begrudgingly back away from each other."
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue