From ab0e0ed3d024ed55224de5a3a658a4d9824779a9 Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Tue, 27 Aug 2019 22:45:11 -0400 Subject: [PATCH] Added an intense amount of updates --- Cyberpunk.pl | 61 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index efc4f2e..a9a0a45 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -1,6 +1,7 @@ #!/usr/local/bin/perl use strict; use warnings; +use File::Random qw/:all/; use constant depth => 5; @@ -68,8 +69,8 @@ sub generate { }else{ printf $CHAR " twin"; } - my $ch = name(); - printf $CHAR " sibling, named " . substr($ch, 0, -1) . " who "; + my $ch = name($_[0],$_[1],depth+1,0); + printf $CHAR " sibling, named " . $ch . " who "; $var = roll(10,1); if(($var == 1)||($var == 2)){ printf $CHAR "dislikes you\n\n"; @@ -86,7 +87,6 @@ sub generate { if(($var == 9)||($var == 10)){ printf $CHAR "hates you\n\n"; } - #generate($_[0] . "/" . substr(join('_', split(/ /,$ch)),0,-1), substr($ch,0,-1)); $i = $i - 1; } } @@ -151,7 +151,7 @@ sub generate { last SWITCH; }; $var == 6 && do { - printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name() . ") "; + printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],0) . ") "; my $how = roll(10,1); if($how <= 5){ printf $CHAR "They died accidentally.\n\n"; @@ -228,18 +228,14 @@ sub generate { }elsif($var <= 6){ $var = roll(10,1); if($var <= 5){ - my $ch = name(); - printf $CHAR "You made a friend named [" . substr($ch,0,-1) . "](" . substr($ch,0,-1) . ".html).\n\n"; + #DEBUG + print "0: " . $_[0] . " 2: " . $_[2] . "\n"; + my $ch = name($_[0],$_[1],$_[2]); + printf $CHAR "You made a friend named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR table("They are like a big brother/sister to you.", "They are like a kid sister/brother to you.", "They are like a teacher or mentor.", "They are like a partner or co-worker.", "They're an old lover.", "They're an old enemy.", "They are like a foster parent to you.", "They're a relative.", "You've reconnected with an old childhood friend.", "You met through a common interest.", "Your relationship"); - if($_[2] < depth){ - generate($_[0], substr($ch,0,-1), $_[2]+1); - } }else{ - my $ch = name(); - printf $CHAR "You made an enemy named [" . substr($ch,0,-1) . "](" . substr($ch,0,-1) . ".html).\n\n"; - if($_[2] < depth){ - generate($_[0], substr($ch,0,-1), $_[2]+1); - } + my $ch = name($_[0],$_[1],$_[2]); + printf $CHAR "You made an enemy named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR table("Ex friend.", "Ex lover.", "Relative.", "Childhood enemy.", "Person working for you.", "Person you work for.", "Partner or co-worker.", "Booster gang member.", "Corporate Exec.", "Government official.", "Who are they"); my $why = roll(10,1); SWITCH: { @@ -298,12 +294,9 @@ sub generate { } } }elsif($var <= 8){ - my $ch = name(); - printf $CHAR "You had a romance! With someone named [" . substr($ch,0,-1) . "](" . substr($ch,0,-1) . ".html).\n\n"; + my $ch = name($_[0],$_[1],depth+1,0); + printf $CHAR "You had a romance! With someone named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR romance(); - if($_[2] < depth){ - generate($_[0], substr($ch,0,-1), $_[2]+1); - } }elsif($var <=10){ printf $CHAR "You have an uneventful year\n\n"; } @@ -334,9 +327,33 @@ sub roll{ } sub name{ - my $name = `notwhoami|head -n1`; - $name =~ s/ /_/g; - return $name + my $name; + my $flip; + my $named = 0; + if(scalar @_ > 3){ + $flip = $_[3]; + }else{ + $flip = roll(10,1); + } + print "Flip:" . $flip . "3:" . $_[3]; + if($flip >= 3){ + print " and entered\n"; + $name = File::Random::random_file(-dir=>"$ARGV[0]"); + $name =~ s/.md$//g; + print "Target: " . $name . " Source: " . $_[1] . "\n"; + if($name ne $_[1]){ + $named = 1; + } + } + if($named > 0 && $name eq "" ){ + $name = `notwhoami|head -n1`; + $name =~ s/ /_/g; + if($_[2] < depth){ + generate($_[0], $name, $_[2]+1); + } + } + print $name . "\n"; + return $name; } sub table{