solo-rpg-lib
Version:
A library to include several solo rpg systems and oracles to use to build bigger software to play solo rpg sessions
3 lines (2 loc) • 6.15 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>1+Math.floor(Math.random()*e),t=()=>e(6),a=()=>e(10),l=()=>e(100),s=e=>e%2,r={chaosFactor:4,setChaosFactor:function(e){const t=e>6?6:e<3?3:e;this.chaosFactor=t},increaseChaosFactor:function(){return this.setChaosFactor(this.chaosFactor+1)},decreaseChaosFactor:function(){return this.setChaosFactor(this.chaosFactor-1)},fateCheck:function(e){const t=a(),l=a(),r=a();console.log(t,l,e);let i=t+l+e<10?"No":"Yes",n=!1;return r<=this.chaosFactor&&(t===l||(s(t)&&s(l)?i=`Exceptional ${i.toLowerCase()}`:s(t)||s(l)||(n=!0,i+=" and random event - ",n=!0,i=`Exceptional ${i.toLowerCase()} and random event - `)),n&&(i+=this.eventCheck())),i},eventCheck:function(){const e=l();let t="";return e<8?t="Remove event: ":e>7&&e<29?t="NPC action: ":e>28&&e<36?t="Introduce a new NPC: ":e>35&&e<46?t="Move toward a thread: ":e>45&&e<53?t="Move away from a thread: ":e>52&&e<56?t="Close a thread: ":e>55&&e<68?t="PC negative: ":e>67&&e<76?t="PC positive: ":e>75&&e<84?t="Ambiguous event: ":e>83&&e<93?t="NPC negative: ":e>92&&e<100&&(t="NPC positive: "),t+=this.getEventMeaning(),t},getEventMeaning:function(){return`${this.getActions()}, ${this.getDescriptors()}`},getActions:function(){return a()>5?i[l()-1]:n[l()-1]},getDescriptors:function(){return a()>5?o[l()-1]:u[l()-1]},detailsCheck:function(){let e=a()+a();return e+=3===this.chaosFactor?2:6===this.chaosFactor?-2:0,e=e<4?4:e>18?18:e,console.log(e),`${y[e-4]}: ${this.getEventMeaning()}`}},i=["Attainment","Starting","Neglect","Fight","Recruit","Triumph","Violate","Oppose","Malice","Communicate","Persecute","Increase","Decrease","Abandon","Gratify","Inquire","Antagonize","Move","Waste","Truce","Expose","Haggle","Imprison","Release","Celebrate","Develop","Travel","Block","Harm","Debase","Overindulge","Adjourn","Adversity","Kill","Disrupt","Usurp","Create","Betray","Agree","Abuse","Excitement","Activity","Assist","Care","Negligence","Passion","Work","Control","Attract","Failure","Pursue","Vengeance","Proceedings","Dispute","Punish","Guide","Transform","Overthrow","Oppress","Change","Release","Befriend","Judge","Desert","Dominate","Procrastinate","Praise","Separate","Take","Break","Heal","Delay","Stop","Lie","Return","Imitate","Struggle","Inform","Bestow","Postpone","Oppress","Inspect","Ambush","Spy","Attach","Carry","Open","Carelessness","Ruin","Extravagance","Trick","Arrive","Propose","Divide","Refuse","Mistrust","Deceive","Cruelty","Intolerance","Trust"],n=["Goals","Dreams","Environment","Outside","Inside","Reality","Allies","Enemies","Evil","Good","Emotions","Opposition","War","Peace","Innocent","Love","Spirit","Intellect","Ideas","Joy","Advice","Plot","Competition","Prison","Illness","Food","Attention","Success","Failure","Travel","Jealousy","Dispute","Home","Investment","Suffering","Wishes","Tactics","Stalemate","Randomness","Misfortune","Victory","Dispute","Riches","Normal","Technology","Hope","Magic","Illusions","Portals","Danger","Weapons","Animals","Weather","Elements","Nature","Masses","Leadership","Fame","Anger","Information","Messages","Energy","Balance","Tension","Friendship","Physical","Project","Pleasures","Pain","Possessions","Benefits","Plans","Lies","Expectations","Legal","Bureaucracy","Business","Path","News","Exterior","Death","Disruption","Power","Burden","Intrigues","Fears","Ambush","Rumor","Wounds","Extravagance","Representative","Adversities","Opulence","Liberty","Military","Mundane","Trials","Masses","Vehicle","Art"],o=["Abnormally","Adventurously","Aggressively","Angrily","Anxiously","Awkwardly","Beautifully","Bleakly","Boldly","Bravely","Busily","Calmly","Carefully","Carelessly","Cautiously","Ceaselessly","Cheerfully","Combatively","Coolly","Crazily","Fully","Generously","Gently","Gladly","Gracefully","Gratefully","Happily","Hastily","Healthily","Helpfully","Helplessly","Hopelessly","Innocently","Intensely","Interestingly","Irritatingly","Jovially","Joyfully","Judgementally","Kindly","Peacefully","Perfectly","Playfully","Politely","Positively","Powerfully","Quaintly","Quarrelsomely","Quietly","Roughly","Rudely","Ruthlessly","Slowly","Softly","Swiftly","Threateningly","Very","Violently","Wildly","Yieldingly","Curiously","Daintily","Dangerously","Defiantly","Deliberately","Delightfully","Dimly","Efficiently","Energetically","Enormously","Enthusiastically","Excitedly","Fearfully","Ferociously","Fiercely","Foolishly","Fortunately","Frantically","Freely","Frighteningly","Kookily","Lazily","Lightly","Loosely","Loudly","Lovingly","Loyally","Majestically","Meaningfully","Mechanically","Miserably","Mockingly","Mysteriously","Naturally","Neatly","Nicely","Oddly","Offensively","Officially","Partially"],u=["Abandoned","Abnormal","Amusing","Ancient","Aromatic","Average","Beautiful","Bizarre","Classy","Clean","Cold","Colorful","Creepy","Cute","Damaged","Dark","Defeated","Delicate","Delightful","Dirty","Graceful","Hard","Harsh","Healthy","Heavy","Historical","Horrible","Important","Interesting","Juvenile","Lacking","Lame","Large","Lavish","Lean","Less","Lethal","Lonely","Lovely","Macabre","Remarkable","Rotten","Rough","Ruined","Rustic","Scary","Simple","Small","Smelly","Smooth","Soft","Strong","Tranquil","Ugly","Valuable","Warlike","Warm","Watery","Weak","Young","Disagreeable","Disgusting","Drab","Dry","Dull","Empty","Enormous","Exotic","Faded","Familiar","Fancy","Fat","Feeble","Feminine","Festive","Flawless","Fresh","Full","Glorious","Good","Magnificent","Masculine","Mature","Messy","Mighty","Military","Modern","Extravagant","Mundane","Mysterious","Natural","Nondescript","Odd","Pale","Petite","Poor","Powerful","Quaint","Rare","Reassuring"],y=["Anger","Sadness","Fear","Disfavors Thread","Disfavors PC","Focus NPC","Favors NPC","Focus PC","Disfavors NPC","Focus Thread","Favors PC","Favors Thread","Courage","Happiness","Calm"],c=1,g=0,h=-1,d=e=>{const a=t();return e<a?a:e},m={check:(e=g)=>{let a=t();e===c&&(a=d(a));let l=t();e===h&&(l=d(l));let s=a>l?"Yes":"No";return s+=a<4&&l<4?" but...":"",s+=a>3&&l>3?" and...":"",s=a===l?"The question was wrong! Why?":s,s}};exports.mythic=r,exports.recluse=m;
//# sourceMappingURL=cjs.min.cjs.map