Forked from XQYZ/Mythic Game Character Sheet Language
Created
May 27, 2012 15:53
Revisions
-
XQYZ revised this gist
Mar 23, 2012 . 1 changed file with 298 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,298 @@ #!/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 -
XQYZ revised this gist
Mar 23, 2012 . 3 changed files with 29 additions and 485 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ { 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 hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ { scopeName = 'mythic'; fileTypes = ( 'mythic' ); patterns = ( { name = 'comment.block.mythic'; match = '^ (.+)'; @@ -8,5 +9,9 @@ match = '^[=]+(.+)[=]+$'; captures = { 1 = { name = 'markup.heading.mythic'; }; }; }, { name = 'markup.heading.mythic'; match = '"(.*)"'; captures = { 1 = { name = 'string.mythic'; }; }; }, ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,485 +0,0 @@ -
XQYZ revised this gist
Mar 22, 2012 . 2 changed files with 118 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,5 +4,9 @@ match = '^ (.+)'; captures = { 1 = { name = 'comment.block.mythic'; }; }; }, { name = 'markup.heading.mythic'; match = '^[=]+(.+)[=]+$'; captures = { 1 = { name = 'markup.heading.mythic'; }; }; }, ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -238,18 +238,107 @@ "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 = { @@ -270,7 +359,8 @@ $chaoslevel = 0 chaosregex = Regexp.new('^ chaos level\: (\d+)$') focusregex = Regexp.new('^ theme\: (.+)$') newlinecache = "" @@ -292,9 +382,14 @@ 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 @@ -345,12 +440,12 @@ def printResult(diff) 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 @@ -366,7 +461,7 @@ def getRandomEvent() begin diff = rankToNumber(AR) - rankToNumber(DR) printResult(diff) rescue SyntaxError, TypeError => nullPointer end else oddsregex = Regexp.new('^ .* \((.*)\)$') @@ -378,6 +473,8 @@ def getRandomEvent() end elsif (lastline.downcase() == " random event:") puts " " + getRandomEvent() elsif (lastline.downcase() == " get theme:") puts " " + $focus elsif (lastline.downcase() == " roll for random event:") roll = 1 + rand(10) puts " Result: " + roll.to_s -
XQYZ revised this gist
Mar 15, 2012 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -24,12 +24,12 @@ '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 } $randomevent_meaning_action = [ -
XQYZ revised this gist
Mar 15, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -373,7 +373,7 @@ def getRandomEvent() 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:") -
XQYZ revised this gist
Mar 15, 2012 . 1 changed file with 230 additions and 229 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -32,220 +32,224 @@ 'sure thing' => 5 } $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", "Immitate", "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", "Rumor", "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", ] $randomevent_focus = { 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" } $fatetable = { @@ -339,6 +343,21 @@ def printResult(diff) end end def getRandomEvent() focus_roll = 1 + rand(100) meaning_roll_action = 1 + rand(100) meaning_roll_subject = 1 + rand(100) meaning_action = $randomevent_meaning_action[meaning_roll_action]; meaning_subject = $randomevent_meaning_subject[meaning_roll_subject]; focus = ""; $randomevent_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())) @@ -358,30 +377,12 @@ def printResult(diff) printResult(diff) end elsif (lastline.downcase() == " random event:") puts " " + getRandomEvent() 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 -
XQYZ created this gist
Mar 14, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ { scopeName = 'mythic'; patterns = ( { name = 'comment.block.mythic'; match = '^ (.+)'; captures = { 1 = { name = 'comment.block.mythic'; }; }; }, ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,387 @@ #!/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 } $randomevent_meaning = [ "Attainment of goals.", "The founding of a fellowship.", "Neglect of the environment.", "Blight.", "The beginning of an enterprise which may harm others.", "Ecstasy to the point of divorce from reality.", "Conquest by force.", "Macho excess.", "Willpower.", "The recruitment of allies.", "The triumph of an evil cause.", "Physical and emotional violation.", "Weakness in the face of opposition.", "Force applied with deliberate malice.", "A declaration of war.", "Persecution of the innocent.", "Love.", "Abandonment of the spiritual.", "Instant gratification.", "Intellectual inquiry.", "Antagonism towards new ideas.", "Joy and laughter.", "Written messages.", "Movement.", "Wasteful dispersal of energies.", "Truce.", "Balance disturbed.", "Tension released.", "Disloyalty.", "Friendship.", "Physical attraction.", "Love for the wrong reasons.", "Passion which interferes with judgment.", "A physical challenge.", "Desertion of a project.", "Domination.", "Procrastination.", "Acclaim.", "A journey which causes temporary separation.", "Loss.", "A matter concluded in plenty.", "Healing.", "Excessive devotion to the pleasures of the senses.", "Swiftness in bringing a matter to its conclusion.", "Delay in obtaining material possessions.", "Delay.", "Prosperity.", "Material difficulties.", "Cessation of benefits.", "Temporary companionship.", "Loss due to the machinations of another.", "Lies made public.", "Spite.", "A situation does not live up to expectations.", "Defeat.", "Return of an old friend.", "New alliances.", "Imitation of reality.", "Confusion in legal matters.", "Bureaucracy.", "Unfairness in a business matter.", "Journey by water.", "A path away from difficulties.", "A temporary respite in struggle.", "Stalemate.", "Publicity.", "Public recognition for one's efforts.", "Good news.", "Bad news.", "Indefinite postponement by another of a project.", "Cause for anxiety due to exterior factors.", "Delay in achieving one's goal.", "Theft.", "A journey by land.", "Good advice from an expert.", "The exposure and consequent failure of a plot.", "A project about to reach completion.", "Intellectual competition.", "Haggling.", "Imprisonment.", "Illness.", "Release.", "Opposition collapses.", "A matter believed to be of great importance is actually of small consequence.", "Loss of interest.", "Celebration of a success.", "Rapid development of an undertaking.", "Travel by air.", "Non-arrival of an expected communication.", "Jealousy.", "Dispute among partners.", "A project does not work out.", "The possible loss of home.", "An investment proves worthless.", "Suffering.", "Mental imprisonment.", "Debasement.", "Material desires are wholly fulfilled.", "Overindulgence.", "Wishes fall short.", "Delaying tactics.", "Stalemate leading to adjournment.", "Adversity, but not insurmountable.", "Gambling.", "Lack of solidity.", "Misfortune.", "The death of a dream.", "Disruption.", "Temporary success.", "Usurped power.", "A balance is made, but it is temporary.", "Failure of a partnership.", "Possible loss of friendship.", "Betrayal.", "Abuse of power.", "Becoming a burden to another.", "Oppression of the few by the many.", "Intrigues.", "Resentment.", "Fears realized.", "A student.", "Messages.", "The bearer of bad news.", "Fears proven unfounded.", "A sentinel.", "Inspection or scrutiny.", "Ambush.", "Spying.", "Mutiny.", "News.", "Attachment to the point of obsession.", "The affairs of the world.", "Unexpected aid.", "A bearer of intelligence.", "Rumor.", "Old wounds reopened.", "Carelessness.", "Friendship strained.", "Guerrilla warfare.", "Ruin.", "Unwise extravagance.", "Dirty tricks.", "Arrival of a friend.", "Propositions.", "Fraud.", "Rivalry.", "A spiritual representative.", "Triumph over adversities.", "Travel by air.", "Frustration.", "Division.", "The refusal to listen to views at variance to one's own.", "Motherly figure.", "Opulence.", "Ill-natured gossip.", "Mistrust of those near.", "Liberty.", "Deceit.", "Cruelty from intolerance.", "A person not to be trusted.", "Excitement from activity.", "Someone of assistance.", "Father figure.", "A dull individual.", "Military.", "A judge.", "A wise counselor.", "The mundane.", "A teacher.", "Trials overcome.", "Frenzy.", "Negligence.", "Duality.", "Passion", "Hard work.", "The control of masses.", "Alliance as a formality, not sincere.", "Attraction to an object or person.", "Travel by vehicle.", "Success in an artistic or spiritual pursuit.", "Vengeance.", "An unethical victory.", "Judicial proceedings.", "Dispute.", "Legal punishment.", "Guidance from an elder.", "A journey.", "Good fortune.", "Too much of a good thing.", "The spiritual over the material.", "The material over the spiritual.", "Transformation and change.", "Disunion.", "Amassment of riches.", "Overthrow of the existing order.", "Communication by technological means.", "Oppression.", "Hope.", "Hope deceived, daydreams fail.", "Change of place." ]; $randomevent_focus = { 1 => "Remote event", 8 => "Character Action", 23 => "Introduce a new character", 31 => "Thread related event", 43 => "Close or open a thread", 48 => "Player character negative", 56 => "Player character positive", 64 => "Neutral event", 89 => "NPC negative", 95 => "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+)$') 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)) $chaoslevel = m[1].to_i - 5 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 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 => 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:") focus_roll = 1 + rand(100) meaning_roll = 1 + rand(100) meaning = $randomevent_meaning[meaning_roll]; focus = ""; $randomevent_focus.each { |mi, fo| if (mi <= focus_roll) focus = fo end } puts " [Focus '" + focus + "', Meaning '" + meaning + "']" elsif (lastline.downcase() == " roll for random event:") roll = 1 + rand(10) puts " Result: " + roll.to_s if (roll <= $chaoslevel + 5) focus_roll = 1 + rand(100) meaning_roll = 1 + rand(100) meaning = $randomevent_meaning[meaning_roll]; focus = ""; $randomevent_focus.each { |mi, fo| if (mi <= focus_roll) focus = fo end } puts " Event: [Focus '" + focus + "', Meaning '" + meaning + "']" end end end