Created
March 14, 2012 22:02
-
-
Save XQYZ/2039893 to your computer and use it in GitHub Desktop.
Mythic RPG
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
{ scopeName = 'mythic'; | |
fileTypes = ( 'mythics', 'mythicc' ); | |
patterns = ( | |
{ name = 'comment.block.mythic'; | |
match = '^ (.+)'; | |
captures = { 1 = { name = 'comment.block.mythic'; }; }; | |
}, | |
{ name = 'markup.heading.mythic'; | |
match = '^(.+)\:$'; | |
captures = { 1 = { name = 'markup.heading.mythic'; }; }; | |
}, | |
{ name = 'markup.heading.mythic'; | |
match = '^(.+)\:(.+)$'; | |
captures = { | |
1 = { name = 'variable.mythic'; }; | |
2 = { name = 'entity.mythic'; }; | |
}; | |
}, | |
{ name = 'markup.heading.mythic'; | |
match = '^\t(.+)$'; | |
captures = { 1 = { name = 'comment.mythic'; }; }; | |
}, | |
); | |
} |
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
{ scopeName = 'mythic'; | |
fileTypes = ( 'mythic' ); | |
patterns = ( | |
{ name = 'comment.block.mythic'; | |
match = '^ (.+)'; | |
captures = { 1 = { name = 'comment.block.mythic'; }; }; | |
}, | |
{ name = 'markup.heading.mythic'; | |
match = '^[=]+(.+)[=]+$'; | |
captures = { 1 = { name = 'markup.heading.mythic'; }; }; | |
}, | |
{ name = 'markup.heading.mythic'; | |
match = '"(.*)"'; | |
captures = { 1 = { name = 'string.mythic'; }; }; | |
}, | |
); | |
} |
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
#!/usr/bin/ruby | |
# In TextMate set this up like this: | |
# Input: Entire Document | |
# Output: Replace Document | |
# Activation: Key Equivalent: Whatever Key you want, I use Option + Command + F | |
$ranks = { | |
'minuscule' => 1, | |
'weak' => 2, | |
'below average' => 4, | |
'low' => 3, | |
'above average' => 6, | |
'average' => 5, | |
'high' => 7, | |
'exceptional' => 8, | |
'incredible' => 9, | |
'awesome' => 10, | |
'superhuman' => 11 | |
} | |
$odds = { | |
'impossible' => -4, | |
'no way' => -3, | |
'very unlikely' => -2, | |
'unlikely' => -1, | |
'50/50' => 0, | |
'somewhat likely' => 1, | |
'likely' => 2, | |
'very likely' => 3, | |
'near a sure thing' => 4, | |
'sure thing' => 5 | |
} | |
$npc_adjectives = [ "superfluous", "addicted", "conformist", "nefarious", "sensible", "untrained", "romantic", "unreasonable", "skilled", "neglectful", "lively", "forthright", "idealistic", "unsupportive", "rational", "coarse", "foolish", "cunning", "delightful", "miserly", "inept", "banal", "logical", "subtle", "reputable", "wicked", "lazy", "pessimistic", "solemn", "habitual", "meek", "helpful", "unconcerned", "generous", "docile", "cheery", "pragmatic", "serene", "thoughtful", "hopeless", "pleasant", "insensitive", "titled", "inexperienced", "prying", "oblivious", "refined", "indispensable", "scholarly", "conservative", "uncouth", "wilful", "indifferent", "fickle", "elderly", "sinful", "naive", "privileged", "glum", "likeable", "lethargic", "defiant", "obnoxious", "insightful", "tactless", "fanatic", "plebeian", "childish", "pious", "uneducated", "inconsiderate", "cultured", "revolting", "curious", "touchy", "needy", "dignified", "pushy", "kind", "corrupt", "jovial", "shrewd", "liberal", "compliant", "destitute", "conniving", "careful", "alluring", "defective", "optimistic", "affluent", "despondent", "mindless", "passionate", "devoted", "established", "unseemly", "dependable", "righteous", "confident" ]; | |
$npc_nouns = [ "gypsy", "witch", "merchant", "expert", "commoner", "judge", "ranger", "occultist", "reverend", "thug", "drifter", "journeyman", "statesman", "astrologer", "duelist", "jack-of-all-trades", "aristocrat", "preacher", "artisan", "rogue", "missionary", "outcast", "mercenary", "caretaker", "hermit", "orator", "chieftain", "pioneer", "burglar", "vicar", "officer", "explorer", "warden", "outlaw", "adept", "bum", "sorcerer", "labourer", "master", "ascendant", "villager", "magus", "conscript", "worker", "actor", "herald", "highwayman", "fortune-hunter", "governor", "scrapper", "monk", "homemaker", "recluse", "steward", "polymath", "magician", "traveler", "vagrant", "apprentice", "politician", "mediator", "crook", "civilian", "activist", "hero", "champion", "cleric", "slave", "gunman", "clairvoyant", "patriarch", "shopkeeper", "crone", "adventurer", "soldier", "entertainer", "craftsman", "scientist", "ascetic", "superior", "performer ", "magister ", "serf", "brute", "inquisitor", "lord", "villain", "professor", "servant", "charmer", "globetrotter ", "sniper", "courtier ", "priest", "tradesman ", "hitman", "wizard", "beggar", "tradesman", "warrior" ]; | |
$npc_motivation_verbs = [ "advise", "obtain", "attempt", "spoil", "oppress", "interact", "create", "abduct", "promote", "conceive", "blight", "progress", "distress", "possess", "record", "embrace", "contact", "pursue", "associate", "prepare", "shepherd", "abuse", "indulge", "chronicle", "fulfil", "drive", "review", "aid", "follow", "advance", "guard", "conquer", "hinder", "plunder", "construct", "encourage", "agonise", "comprehend", "administer", "relate", "take", "discover", "deter", "acquire", "damage", "publicise", "burden", "advocate", "implement", "understand", "collaborate", "strive", "complete", "compel", "join", "assist", "defile", "produce", "institute", "account", "work", "accompany", "offend", "guide", "learn", "persecute", "communicate", "process", "report", "develop", "steal", "suggest", "weaken", "achieve", "secure", "inform", "patronise", "depress", "determine", "seek", "manage", "suppress", "proclaim", "operate", "access", "refine", "compose", "undermine", "explain", "discourage", "attend", "detect", "execute", "maintain", "realise", "convey", "rob", "establish", "overthrow", "support" ]; | |
$npc_motivation_nouns = [ "wealth", "hardship", "affluence", "resources", "prosperity", "poverty", "opulence", "deprivation", "success", "distress", "contraband", "music", "literature", "technology", "alcohol", "medicines", "beauty", "strength", "intelligence", "force", "the wealthy", "the populous", "enemies", "the public", "religion", "the poor", "family", "the elite", "academia", "the forsaken", "the law", "the government", "the downtrodden", "friends", "criminals", "allies", "secret societies", "the world", "military", "the church", "dreams", "discretion", "love", "freedom", "pain", "faith", "slavery", "enlightenment", "racism", "sensuality", "dissonance", "peace", "discrimination", "disbelief", "pleasure", "hate", "happiness", "servitude", "harmony", "justice", "gluttony", "lust", "envy", "greed", "laziness", "wrath", "pride", "purity", "moderation", "vigilance", "zeal", "composure", "charity", "modesty", "atrocities", "cowardice", "narcissism", "compassion", "valour", "patience", "advice", "propaganda", "science", "knowledge", "communications", "lies", "myths", "riddles", "stories", "legends", "industry", "new religions", "progress", "animals", "ghosts", "magic", "nature", "old religions", "expertise", "spirits" ]; | |
$randomevent_meaning_action = [ "Attainment", "Starting", "Neglect", "Fight", "Recruit", "Triumph", "Violate", "Oppose", "Malice", "Communicate", "Persecute", "Increase", "Decrease", "Abandon", "Gratify", "Inquire", "Antagonise", "Move", "Waste", "Truce", "Release", "Befriend", "Judge", "Desert", "Dominate", "Procrastinate", "Praise", "Separate", "Take", "Break", "Heal", "Delay", "Stop", "Lie", "Return", "Imitate", "Struggle", "Inform", "Bestow", "Postpone", "Expose", "Haggle", "Imprison", "Release", "Celebrate", "Develop", "Travel", "Block", "Harm", "Debase", "Overindulge", "Adjourn", "Adversity", "Kill", "Disrupt", "Usurp", "Create", "Betray", "Agree", "Abuse", "Oppress", "Inspect", "Ambush", "Spy", "Attach", "Carry", "Open", "Carelessness", "Ruin", "Extravagance", "Trick", "Arrive", "Propose", "Divide", "Refuse", "Mistrust", "Deceive", "Cruelty", "Intolerance", "Trust", "Excitement", "Activity", "Assist", "Care", "Negligence", "Passion", "Work hard", "Control", "Attract", "Failure", "Pursue", "Vengeance", "Proceedings", "Dispute", "Punish", "Guide", "Transform", "Overthrow", "Oppress", "Change" ]; | |
$randomevent_meaning_subject = [ "Goals", "Dreams", "Environment", "Outside", "Inside", "Reality", "Allies", "Enemies", "Evil", "Good", "Emotions", "Opposition", "War", "Peace", "The innocent", "Love", "The spiritual", "The intellectual", "New ideas", "Joy", "Messages", "Energy", "Balance", "Tension", "Friendship", "The physical", "A project", "Pleasures", "Pain", "Possessions", "Benefits", "Plans", "Lies", "Expectations", "Legal matters", "Bureaucracy", "Business", "A path", "News", "Exterior factors", "Advice", "A plot", "Competition", "Prison", "Illness", "Food", "Attention", "Success", "Failure", "Travel", "Jealousy", "Dispute", "Home", "Investment", "Suffering", "Wishes", "Tactics", "Stalemate", "Randomness", "Misfortune", "Death", "Disruption", "Power", "A burden", "Intrigues", "Fears", "Ambush", "Rumour", "Wounds", "Extravagance", "A representative", "Adversities", "Opulence", "Liberty", "Military", "The mundane", "Trials", "Masses", "Vehicle", "Art", "Victory", "Dispute", "Riches", "Status quo", "Technology", "Hope", "Magic", "Illusions", "Portals", "Danger", "Weapons", "Animals", "Weather", "Elements", "Nature", "The public", "Leadership", "Fame", "Anger", "Information" ]; | |
$focus = "standard"; | |
$randomevent_focus = { | |
"standard" => { | |
1 => "Remote event", | |
8 => "NPC Action", | |
29 => "Introduce a new NPC", | |
36 => "Move toward a thread", | |
46 => "Move away from a thread", | |
53 => "Close a thread", | |
56 => "PC negative", | |
68 => "PC positive", | |
76 => "Ambiguous event", | |
84 => "NPC negative", | |
93 => "NPC positive" | |
}, | |
"horror" => { | |
1 => "Horror - PC", | |
11 => "Horror - NPC", | |
24 => "Remote event", | |
31 => "NPC Action", | |
50 => "Introduce a new NPC", | |
53 => "Move toward a thread", | |
56 => "Move away from a thread", | |
63 => "PC negative", | |
73 => "PC positive", | |
76 => "Ambiguous event", | |
83 => "NPC negative", | |
98 => "NPC positive" | |
}, | |
"adventure" => { | |
1 => "Action!", | |
17 => "Remote event", | |
25 => "NPC Action", | |
45 => "Introduce a new NPC", | |
53 => "Move toward a thread", | |
57 => "Move away from a thread", | |
65 => "PC negative", | |
77 => "PC positive", | |
81 => "Ambiguous event", | |
85 => "NPC negative", | |
97 => "NPC positive" | |
}, | |
"mystery" => { | |
1 => "Remote event", | |
9 => "NPC Action", | |
21 => "Introduce a new NPC", | |
33 => "Move toward a thread", | |
53 => "Move away from a thread", | |
65 => "PC negative", | |
73 => "PC positive", | |
81 => "Ambiguous event", | |
89 => "NPC negative", | |
97 => "NPC positive" | |
}, | |
"social" => { | |
1 => "Drop a bomb!", | |
13 => "Remote event", | |
25 => "NPC Action", | |
37 => "Introduce a new NPC", | |
45 => "Move toward a thread", | |
57 => "Move away from a thread", | |
61 => "Close a thread", | |
65 => "PC negative", | |
73 => "PC positive", | |
81 => "Ambiguous event", | |
93 => "NPC negative", | |
97 => "NPC positive" | |
}, | |
"personal" => { | |
1 => "Remote event", | |
8 => "NPC Action", | |
25 => "PC NPC acion", | |
29 => "Introduce a new NPC", | |
36 => "Move toward a thread", | |
43 => "Move toward a PC thread", | |
46 => "Move away from a thread", | |
51 => "Move away from a PC thread", | |
53 => "Close a thread", | |
55 => "Close a PC thread", | |
56 => "PC negative", | |
68 => "PC positive", | |
76 => "Ambiguous event", | |
84 => "NPC negative", | |
91 => "PC NPC negative", | |
93 => "NPC positive", | |
100 => "PC NPC positive" | |
}, | |
"epic" => { | |
1 => "Thread escalates", | |
13 => "Remote event", | |
17 => "NPC Action", | |
31 => "Introduce a new NPC", | |
43 => "Move toward a thread", | |
47 => "Move away from a thread", | |
59 => "PC negative", | |
73 => "PC positive", | |
81 => "Ambiguous event", | |
85 => "NPC negative", | |
93 => "NPC positive" | |
} | |
} | |
$fatetable = { | |
-5 => [ 1, 5, 82], | |
-4 => [ 2, 9, 83], | |
-3 => [ 3, 15, 84], | |
-2 => [ 5, 24, 86], | |
-1 => [ 8, 37, 89], | |
0 => [10, 50, 91], | |
1 => [13, 63, 94], | |
2 => [15, 76, 96], | |
3 => [16, 85, 97], | |
4 => [17, 91, 99], | |
5 => [18, 95, 99] | |
} | |
lastline = "" | |
$chaoslevel = 0 | |
chaosregex = Regexp.new('^ chaos level\: (\d+)$') | |
focusregex = Regexp.new('^ theme\: (.+)$') | |
newlinecache = "" | |
ARGF.each do |line| | |
line = line.rstrip | |
if (line != "") | |
line.scan(/\%(\d+)d(\d+)\%/) {|s| | |
num = s[0].to_i | |
sides = s[1].to_i | |
if (num > 0 and sides > 0) | |
sum = 0 | |
num.times { sum += 1 + rand(sides) } | |
line = line.sub("%"+num.to_s+"d"+sides.to_s+"%", sum.to_s) | |
end | |
} | |
puts newlinecache + line | |
newlinecache = "" | |
lastline = line | |
if (m = chaosregex.match(line.downcase())) | |
$chaoslevel = m[1].to_i - 5 | |
end | |
if (m = focusregex.match(line.downcase())) | |
if $randomevent_focus.has_key?(m[1].strip) | |
$focus = m[1].strip | |
end | |
end | |
else | |
newlinecache += "\n" | |
end | |
end | |
def rankToNumber(rank) | |
rank = rank.downcase() | |
$ranks.each { |r, num| | |
rank = rank.sub(r, num.to_s) | |
} | |
return eval(rank) | |
end | |
def printResult(diff) | |
if (diff < -5) | |
diff = -5 | |
elsif (diff > 5) | |
diff = 5 | |
end | |
t = $fatetable[diff] | |
roll = 1 + rand(100) | |
if (roll <= t[0]) | |
puts " Exceptional Yes [Fav Y " + (t[0] + 1 - roll).to_s + | |
" N " + (t[1] + 1 - roll).to_s + | |
" ExN " + (t[2] - roll).to_s + "]" | |
elsif (roll <= t[1]) | |
puts " Yes [Fav ExY " + (roll - t[0]).to_s + | |
" N " + (t[1] + 1 - roll).to_s + | |
" ExN " + (t[2] - roll).to_s + "]" | |
elsif (roll < t[2]) | |
puts " No [Fav ExY " + (roll - t[0]).to_s + | |
" Y " + (roll - t[1]).to_s + | |
" ExN " + (t[2] - roll).to_s + "]" | |
else | |
puts " Exceptional No [Fav ExY " + (roll - t[0]).to_s + | |
" Y " + (roll - t[1]).to_s + | |
" N " + (roll - t[2] + 1).to_s + "]" | |
end | |
if (roll % 11 == 0) | |
if (roll / 11 <= $chaoslevel + 5) | |
puts " Random event occurred!" | |
end | |
end | |
end | |
def getRandomEvent() | |
focus_roll = 1 + rand(100) | |
meaning_roll_action = rand(100) | |
meaning_roll_subject = rand(100) | |
meaning_action = $randomevent_meaning_action[meaning_roll_action]; | |
meaning_subject = $randomevent_meaning_subject[meaning_roll_subject]; | |
focus = ""; | |
$randomevent_focus[$focus].each { |mi, fo| | |
if (mi <= focus_roll) | |
focus = fo | |
end | |
} | |
return "[Focus '" + focus + "' Meaning '" + meaning_action + "', '" + meaning_subject + "']" | |
end | |
vsregex = Regexp.new('^ .* \((.*) vs\. (.*)\)$') | |
if (m = vsregex.match(lastline.downcase())) | |
AR = m[1] | |
DR = m[2] | |
begin | |
diff = rankToNumber(AR) - rankToNumber(DR) | |
printResult(diff) | |
rescue SyntaxError, TypeError => nullPointer | |
end | |
else | |
oddsregex = Regexp.new('^ .* \((.*)\)$') | |
if (m = oddsregex.match(lastline.downcase())) | |
if ($odds.include?(m[1].downcase())) | |
odd = $odds[m[1].downcase()] | |
diff = odd.to_i + $chaoslevel | |
printResult(diff) | |
end | |
elsif (lastline.downcase() == " random event:") | |
puts " " + getRandomEvent() | |
elsif (lastline.downcase() == " get theme:") | |
puts " " + $focus | |
elsif (lastline.downcase() == " create npc:") | |
roll1 = rand(100) | |
roll2 = rand(100) | |
puts " Description: " + $npc_adjectives[roll1] + ", " + $npc_nouns[roll2] | |
roll1 = rand(100) | |
roll2 = rand(100) | |
puts " Motivation: " + $npc_motivation_verbs[roll1] + ", " + $npc_motivation_nouns[roll2] | |
elsif (lastline.downcase() == " roll for random event:") | |
roll = 1 + rand(10) | |
puts " Result: " + roll.to_s | |
if (roll <= $chaoslevel + 5) | |
puts " Event: " + getRandomEvent() | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment