From 67845b9211eb0ca29a5357f7f5100049569c876b Mon Sep 17 00:00:00 2001 From: silverwizard Date: Wed, 20 Nov 2019 13:45:46 -0500 Subject: [PATCH] Bring main code base into git and add license --- LICENSE | 9 + Paranoia | 520 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 529 insertions(+) create mode 100644 LICENSE create mode 100755 Paranoia diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2d787bf --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 + +Copyright (C) 2004 Sam Hocevar + +Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. + +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/Paranoia b/Paranoia new file mode 100755 index 0000000..8ba3672 --- /dev/null +++ b/Paranoia @@ -0,0 +1,520 @@ +#!/usr/bin/perl +use strict; +use warnings; +use POSIX; +use PDF::API2; +use PDF::Table; +use List::Util 'shuffle'; + +generate(); + +sub generate { + my $CHAR; + my $var; + my $name = name() . "-" . "R" . "-" . letter() . letter() . letter(); + #simple setup of ability, and checks to make sure they're the right size + my $MAN = ceil((roll(20,1))/2); + my $VIO = ceil((roll(20,1))/2); + my $STE = ceil((roll(20,1))/2); + my $HARD = ceil((roll(20,1))/2); + my $SOFT = ceil((roll(20,1))/2); + my $WET = ceil((roll(20,1))/2); + + if ($MAN < 4){$MAN = 4;} + if ($VIO < 4){$VIO = 4;} + if ($STE < 4){$STE = 4;} + if ($HARD < 4){$HARD = 4;} + if ($SOFT < 4){$SOFT = 4;} + if ($WET < 4){$WET = 4;} + + my $manspecs = ""; + my $viospecs = "Energy Weapons"; + my $stespecs = ""; + my $hardspecs = ""; + my $softspecs = ""; + my $wetspecs = ""; + + my $manweak = ""; + my $vioweak = ""; + my $steweak = ""; + my $hardweak = ""; + my $softweak = ""; + my $wetweak = ""; + + my @mantypes = (" Bootlicking", " Chutzpah", " Con Games", " Hygiene", " Interrogation", " Intimidation", " Moxie", " Oratory"); + my @stetypes = (" Concealment", " Disguise", " Scam Radar", " Security Systems", " Shadowing", " Sleight of Hand", " Sneaking", " Surveillance"); + my @viotypes = (" Agility", " Demolitions", "Field Weapons", " Fine Manipulations", " Hand Weapons", " Projectile Weapons", " Thrown Weapons", " Unarmed Combat", " Vehicular Combat"); + my @hardtypes = (" Bot Ops and Maintenance", " Chemical Engineering", " Electronic Engineering", " Habitat Engineering", " Mechanical Engineering", " Nuclear Energy", " Operate Heavy Machinery", " Vehicle Ops and Maintance"); + my @softtypes = (" Bot Programing", " C-Bay", " Cryptography", " Data Analysis", " Data Search", " Financial Systems", " Hacking", " Multicorder Operations", " Vehicle Programming"); + my @wettypes = (" Biosciences", " Bioweapons", " Cloning", " Medical", " Outdoor Life", " Pharmatherapy", " Psychotherapy", " Suggestion"); + + @mantypes = shuffle(@mantypes); + @stetypes = shuffle(@stetypes); + @viotypes = shuffle(@viotypes); + @hardtypes = shuffle(@hardtypes); + @softtypes = shuffle(@softtypes); + @wettypes = shuffle(@wettypes); + + my $manval = 0; + my $steval = 0; + my $vioval = 0; + my $softval = 0; + my $hardval = 0; + my $wetval = 0; + + for my $i (1 .. 6){ + $var = roll(5,0); + if($var == 0){ + $manspecs = $manspecs . pop(@mantypes); + $manweak = $manweak . pop(@mantypes); + }elsif($var == 1){ + $stespecs = $stespecs . pop(@stetypes); + $steweak = $steweak . pop(@stetypes); + }elsif($var == 2){ + $viospecs = $viospecs . pop(@viotypes); + $vioweak = $vioweak . pop(@viotypes); + }elsif($var == 3){ + $hardspecs = $hardspecs . pop(@hardtypes); + $hardweak = $hardweak . pop(@hardtypes); + }elsif($var == 4){ + $softspecs = $softspecs . pop(@softtypes); + $softweak = $softweak . pop(@softtypes); + }elsif($var == 5){ + $wetspecs = $wetspecs . pop(@wettypes); + $wetweak = $wetweak . pop(@wettypes); + } + } + + + #create a service group, and keep the value to generate the secret society! + $var = roll(20,1); + my $group = group($var); + + #generate secret society + my $secret = society($var); + + #make a mutant power + my $mutation; + $var = roll(20,1); + if($var < 11){ + $mutation = table("Not A Mutant!", "Charm", "Detect Mutant Power", "Empathy", "Hypersenses", "Uncanny Luck", "Puppeteer", "Ventriloquist", "Bureaucratic Intuition", "Death Simulation", "Deep Thought", "Mechanical Intuition", "Push Mutant Power", "Doom Magnet", "Psychic Flash", "Evil Twin", "Surveillance Intuition", "Empathic Liar", "Copy Mutant Power", "Machine Empathy"); + }elsif($var > 10 && $var < 16) { + $mutation = table("Corrosion", "Electroshock", "Energy Field", "Mental Blast", "Pyrokinesis", "Telekinesis", "X-Ray Vision", "Absorption", "Adrenalin Control", "Bouncy", "Haze", "Magnetise", "Cryokinesis", "Teleportation", "Laser Reflection", "Hyperspeed", "Infravision", "Invisibility", "Energy Substitution", "Machine Empathy"); + }elsif($var > 15 && $var < 21){ + $mutation = table(" Levitation", "Matter Eater", "Polymorphism", "Slippery Skin", "Regeneration", "Vampire", "Shrinking", "Transmution", "Growth", "Chameleon", "Desolidity", "Toxic Metabolism", "Adhesive Skin", "Rubbery Bones", "Stench", "Stretchy", "Acidic Blood", "Ink Spray", "Hurricane Lungs", "Machine Empathy"); + } + + #final print of the stats + my $text; + my $first; + my $char; + my $font; + + $char = PDF::API2->new(); + $first = $char->page(); + my $table = PDF::Table->new; + $first->mediabox('Letter'); + $font = $char->corefont('Courier'); + + my $attributes = [ + [ "Attribute", "Specializations", "Weakness" ], + [ "Management: " . $MAN, $manspecs, $manweak ], + [ "Violence: " . $VIO, $viospecs, $vioweak ], + [ "Stealth: " . $STE, $stespecs, $steweak ], + [ "Hardware: " . $HARD, $hardspecs, $hardweak ], + [ "Software: " . $SOFT, $softspecs, $softweak ], + [ "Wetware: " . $WET, $wetspecs, $wetweak ], + ]; + + $text = $first->text(); + $text->font($font,20); + $text->translate(100,700); + $text->text("DESIGATION: " . $name . " 1 2 3 4 5 6"); + $text->font($font,12); + $text->translate(100,670); + $text->text("SERVICE GROUP:_______" . $group . "_______"); + $text->translate(100,220); + $text->text("MUTATION:_______" . $mutation . "_______"); + $text->translate(100,200); + $text->text("SECRET SOCIETY:_________" . $secret . "_________"); + + $table->table( $char, $first, $attributes, + x => 50, + w => 495, + start_y => 650, + next_y => 700, + start_h => 300, + next_h => 500, + ); + + my $equipment = [ + [ "Common Items", "Controversial Items", "Contraband" ], + [ common(), contro(), contra() ], + [ common(), contro(), contra() ], + [ common(), contro(), contra() ], + ]; + + $table->table( $char, $first, $equipment, + x => 50, + w => 495, + start_y => 500, + next_y => 700, + start_h => 300, + next_h => 500, + ); + + $char->saveas($name . '.pdf'); + +} + +sub roll{ + return int(rand()*$_[0]+$_[1]); +} + +sub name{ + my $n = `notwhoami|head -n1|cut -d' ' -f1`; + chomp $n; + return $n; +} + +sub table{ + my $return; + my $var = roll(int(@_),1); + return $_[$var-1]; +} + +sub letter{ + my @chars = ('A'..'Z'); + return $chars[rand @chars]; +} + +sub group{ + my $var = $_[0]; + SWITCH: { + $var == 1 && do { + return "Armed Forces"; + last SWITCH; + }; + $var == 2 && do { + return "Armed Forces"; + last SWITCH; + }; + $var == 3 && do { + return "Central Processing Unit"; + last SWITCH; + }; + $var == 4 && do { + return "Central Processing Unit"; + last SWITCH; + }; + $var == 5 && do { + return "HPD & Mind Control"; + last SWITCH; + }; + $var == 6 && do { + return "HPD & Mind Control"; + last SWITCH; + }; + $var == 7 && do { + return "Internal Security"; + last SWITCH; + }; + $var == 8 && do { + return "Interal Security"; + last SWITCH; + }; + $var == 9 && do { + return "Interal Security (" . group(roll(20,1)) . ")"; + last SWITCH; + }; + $var == 10 && do { + return "Interal Security (" . group(roll(20,1)) . ")"; + last SWITCH; + }; + $var == 11 && do { + return "Production, Logistics, and Commissary"; + last SWITCH; + }; + $var == 12 && do { + return "Production, Logistics, and Commissary"; + last SWITCH; + }; + $var == 13 && do { + return "Production, Logistics, and Commissary"; + last SWITCH; + }; + $var == 14 && do { + return "Power Services"; + last SWITCH; + }; + $var == 15 && do { + return "Power Services"; + last SWITCH; + }; + $var == 16 && do { + return "Research and Design"; + last SWITCH; + }; + $var == 17 && do { + return "Research and Design"; + last SWITCH; + }; + $var == 18 && do { + return "Technical Services"; + last SWITCH; + }; + $var == 19 && do { + return "Technical Services"; + last SWITCH; + }; + $var == 20 && do { + return group(roll(20,1)) . " spying on behalf of " . group(roll(20,1)); + last SWITCH; + } + } + + sub society{ + my $var = roll(20,1); + if($_[0] < 3){ + if($var == 1){"Anti Mutant"; + }elsif($var == 2){"Anti Mutant"; + }elsif($var == 3){"Anti Mutant"; + }elsif($var == 4){ "Death Leopard"; + }elsif($var == 5){ "Death Leopard"; + }elsif($var == 6){ "Death Leopard"; + }elsif($var == 7){ "Frankenstein Destroyers"; + }elsif($var == 8){ "Frankenstein Destroyers"; + }elsif($var == 9){ "Frankenstein Destroyers"; + }elsif($var == 10){ "PURGE"; + }elsif($var == 11){ "PURGE"; + }elsif($var == 12){ "PURGE"; + }elsif($var == 13){ "Communists"; + }elsif($var == 14){ "FCCC-P"; + }elsif($var == 15){ "Free Enterprise"; + }elsif($var == 16){ "Pro Tech"; + }elsif($var == 17){ "Psion"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]); } + }elsif($_[0] > 2 && $_[0] < 5){ + if($var == 1){"Computer Phreaks"; + }elsif($var == 2){ "Computer Phreaks"; + }elsif($var == 3){ "Computer Phreaks"; + }elsif($var == 4){ "Computer Phreaks"; + }elsif($var == 5){ "Copore Metal"; + }elsif($var == 6){ "Copore Metal"; + }elsif($var == 7){ "Copore Metal"; + }elsif($var == 8){ "Copore Metal"; + }elsif($var == 9){ "FCCC-P"; + }elsif($var == 10){ "FCCC-P"; + }elsif($var == 11){ "Sierra Club"; + }elsif($var == 12){ "Sierra Club"; + }elsif($var == 13){ "Anti-Mutant"; + }elsif($var == 14){ "Communists"; + }elsif($var == 15){ "Pro Tech"; + }elsif($var == 16){ "Psion"; + }elsif($var == 17){ "PURGE"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]);} + }elsif($_[0] > 4 && $_[0] < 7){ + if($var == 1){"Anti Mutant"; + }elsif($var == 2){ "Anti Mutant"; + }elsif($var == 3){ "FCCC-P"; + }elsif($var == 4){ "FCCC-P"; + }elsif($var == 5){ "Humanists"; + }elsif($var == 6){ "Humanists"; + }elsif($var == 7){ "Humanists"; + }elsif($var == 8){ "Romantics"; + }elsif($var == 9){ "Romantics"; + }elsif($var == 10){ "Romantics"; + }elsif($var == 11){ "Romantics"; + }elsif($var == 12){ "Sierra Club"; + }elsif($var == 13){ "Sierra Club"; + }elsif($var == 14){ "Communists"; + }elsif($var == 15){ "Mystics"; + }elsif($var == 16){ "Psion"; + }elsif($var == 17){ "PURGE"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]); } + }elsif($_[0] > 6 && $_[0] < 11){ + if($var == 1){"Anti Mutant"; + }elsif($var == 2){ "Anti Mutant"; + }elsif($var == 3){ "Anti Mutant"; + }elsif($var == 4){ "Death Leopard"; + }elsif($var == 5){ "Death Leopard"; + }elsif($var == 6){ "Death Leopard"; + }elsif($var == 7){ "FCCC-P"; + }elsif($var == 8){ "FCCC-P"; + }elsif($var == 9){ "FCCC-P"; + }elsif($var == 10){ "Frankenstein Destroyers"; + }elsif($var == 11){ "Frankenstein Destroyers"; + }elsif($var == 12){ "Frankenstein Destroyers"; + }elsif($var == 13){ "Communists"; + }elsif($var == 14){ "Free Enterprise"; + }elsif($var == 15){ "Pro Tech"; + }elsif($var == 16){ "Psion"; + }elsif($var == 17){ "PURGE"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]);} + }elsif($_[0] > 10 && $_[0] < 14){ + if($var == 1){"Free Enterprise"; + }elsif($var == 2){ "Free Enterprise"; + }elsif($var == 3){ "Free Enterprise"; + }elsif($var == 4){ "Free Enterprise"; + }elsif($var == 5){ "Free Enterprise"; + }elsif($var == 6){ "Humanists"; + }elsif($var == 7){ "Humanists"; + }elsif($var == 8){ "Humanists"; + }elsif($var == 9){ "Humanists"; + }elsif($var == 10){ "Mystics"; + }elsif($var == 11){ "Mystics"; + }elsif($var == 12){ "Romantics"; + }elsif($var == 13){ "Romantics"; + }elsif($var == 14){ "Communists"; + }elsif($var == 15){ "Pro Tech"; + }elsif($var == 16){ "Psion"; + }elsif($var == 17){ "Sierra Club"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]);} + }elsif($_[0] > 13 && $_[0] < 16){ + if($var == 1){"Computer Phreaks"; + }elsif($var == 2){ "Computer Phreaks"; + }elsif($var == 3){ "Death Leopard"; + }elsif($var == 4){ "Death Leopard"; + }elsif($var == 5){ "FCCC-P"; + }elsif($var == 6){ "FCCC-P"; + }elsif($var == 7){ "Frankenstein Destroyers"; + }elsif($var == 8){ "Frankenstein Destroyers"; + }elsif($var == 9){ "Free Enterprise"; + }elsif($var == 10){ "Free Enterprise"; + }elsif($var == 11){ "Mystics"; + }elsif($var == 12){ "Mystics"; + }elsif($var == 13){ "Pro Tech"; + }elsif($var == 14){ "Pro Tech"; + }elsif($var == 15){ "PURGE"; + }elsif($var == 16){ "PURGE"; + }elsif($var == 17){ "Communists"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]);} + }elsif($_[0] > 15 && $_[0] < 18){ + if($var == 1){"Computer Phreaks"; + }elsif($var == 2){ "Computer Phreaks"; + }elsif($var == 3){ "Computer Phreaks"; + }elsif($var == 4){ "Copore Metal"; + }elsif($var == 5){ "Copore Metal"; + }elsif($var == 6){ "Copore Metal"; + }elsif($var == 7){ "Pro Tech"; + }elsif($var == 8){ "Pro Tech"; + }elsif($var == 9){ "Pro Tech"; + }elsif($var == 10){ "Psion"; + }elsif($var == 11){ "Psion"; + }elsif($var == 12){ "Psion"; + }elsif($var == 13){ "PURGE"; + }elsif($var == 14){ "PURGE"; + }elsif($var == 15){ "PURGE"; + }elsif($var == 16){ "FCCC-P"; + }elsif($var == 17){ "Communists"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]);} + }elsif($_[0] > 17 && $_[0] < 20){ + if($var == 1){"Computer Phreaks"; + }elsif($var == 2){ "Computer Phreaks"; + }elsif($var == 3){ "Copore Metal"; + }elsif($var == 4){ "Copore Metal"; + }elsif($var == 5){ "Death Leopard"; + }elsif($var == 6){ "Death Leopard"; + }elsif($var == 7){ "Frankenstein Destroyers"; + }elsif($var == 8){ "Frankenstein Destroyers"; + }elsif($var == 9){ "Mystics"; + }elsif($var == 10){ "Mystics"; + }elsif($var == 11){ "Pro Tech"; + }elsif($var == 12){ "Pro Tech"; + }elsif($var == 13){ "Psion"; + }elsif($var == 14){ "Psion"; + }elsif($var == 15){ "Sierra Club"; + }elsif($var == 16){ "Sierra Club"; + }elsif($var == 17){ "Communists"; + }elsif($var == 18){ "Illuminati working for the " . society($_[0]); + }elsif($var == 19){ "See GM For Details"; + }elsif($var == 20){ "Spy for the " . society($_[0]) . "on the " . society($_[0]);} + }else{ + return society(roll(20,1)); + } + } + sub common{ + my $var = roll(20,1); + if($var == 1){ return "Teela-O fanclub badge"; + }elsif($var == 2){ return "A pack of rubber bands"; + }elsif($var == 3){ return "Folder of very dull documents"; + }elsif($var == 4){ return "Can of Boot Polish"; + }elsif($var == 5){ return "Assorted lengths of wire"; + }elsif($var == 6){ return "Can of Bouncy Bubble Beverage"; + }elsif($var == 7){ return "Transtube Ticket Stub (used)"; + }elsif($var == 8){ return "Plastic Spork"; + }elsif($var == 9){ return "Red Balloon"; + }elsif($var == 10){ return "Packet of algae chips"; + }elsif($var == 11){ return "Visomorpain (happy) tablets"; + }elsif($var == 12){ return "Rubber Gloves"; + }elsif($var == 13){ return "\`Refer to Comittee\` Rubber Stamp"; + }elsif($var == 14){ return "I Love The Computer badge"; + }elsif($var == 15){ return "Safety pin"; + }elsif($var == 16){ return "Xanitrick (wakey) tablet"; + }elsif($var == 17){ return "Information leaflet about the dangers of mutants"; + }elsif($var == 18){ return "Plasticreds: " . (roll(20,1)+roll(20,1)); + }elsif($var == 19){ return "Secret Society Propaganda"; + }elsif($var == 20){ return common() . ", " . common();} + } + + sub contro{ + my $var = roll(20,1); + if($var == 1){ return "RED Laser Barrel"; + }elsif($var == 2){ return "Gelgernine (very happy) tablet"; + }elsif($var == 3){ return "Spanner"; + }elsif($var == 4){ return "\'DENIED\' Rubber Stamp"; + }elsif($var == 5){ return "Plastic Knife"; + }elsif($var == 6){ return "Shaken can of Bouncy Bubble Beverage"; + }elsif($var == 7){ return "Sandallathon (sleepy) tablet" + }elsif($var == 8){ return "Genuine REALFOOD apple"; + }elsif($var == 9){ return "Electric Drill"; + }elsif($var == 10){ return "Can of Black Spraypaint"; + }elsif($var == 11){ return "Tube of Cold Fun"; + }elsif($var == 12){ return "Gas Mask"; + }elsif($var == 13){ return "Sticky Bandage"; + }elsif($var == 14){ return "IntSec \'report on your friends\' loyalty card \(three more terminations and you get a free PetBot!\)"; + }elsif($var == 15){ return "Whistle"; + }elsif($var == 16){ return "Corrective Glasses"; + }elsif($var == 17){ return "Biohazard sign sticker"; + }elsif($var == 18){ return "Communist Propaganda"; + }elsif($var == 19){ return "Secret Society Propaganda"; + }elsif($var == 20){ return contro() . ", " . contro();} + } + sub contra{ + my $var = roll(20,1); + if($var == 1){ return "YELLOW Laser Barrel"; + }elsif($var == 2){ return "Illegal black-market hallucinogenic tablet"; + }elsif($var == 3){ return "plans of nuclear reactor"; + }elsif($var == 4){ return "Can of toxic waste"; + }elsif($var == 5){ return "ME card belonging to another citizen"; + }elsif($var == 6){ return "Uranium fuel rod"; + }elsif($var == 7){ return "Plasticreds " . roll(20,1)*50; + }elsif($var == 8){ return "\`APPROVED\` rubber stamp"; + }elsif($var == 9){ return "Geiger Counter (CLEARANCE BLUE)"; + }elsif($var == 10){ return "Frag Grenade"; + }elsif($var == 11){ return "Rolactin (VERY VERY happy) tablet (CLEARANCE BLUE)"; + }elsif($var == 12){ return "Smoke Grenade"; + }elsif($var == 13){ return "Telescopalmine (truth) pill (CLEARANCE GREEN)"; + }elsif($var == 14){ return "Old Reckoning literature" + }elsif($var == 15){ return "Stolen Gadget"; + }elsif($var == 16){ return "Suicide Pill"; + }elsif($var == 17){ return "Communist Party Membership Card"; + }elsif($var == 18){ return "10 Foot Pole"; + }elsif($var == 19){ return "Secret Society IOU"; + }elsif($var == 20){ return contra() . ", " . contra();} + } +}