From 171483672fd49738920323cffe24c9dd0c5681af Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Fri, 30 Aug 2019 22:29:52 -0400 Subject: [PATCH] Last bug seems to be that asexual people can't have romances, fix this --- Cyberpunk.pl | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index 4c8876a..313668a 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -13,7 +13,7 @@ mkdir $ARGV[0], 0755 unless -d $ARGV[0]; foreach my $item (@SEXES){ mkdir $ARGV[0] . "/" . $item unless -d $ARGV[0] . "/" . $item; } -generate($ARGV[0], $ARGV[1], 1,@SEXES); +generate($ARGV[0], $ARGV[1], 1,\@SEXES); sub generate { my $CHAR; @@ -28,7 +28,9 @@ sub generate { my $MA = roll(8,3); my $EMP = roll(8,3); my $BT = roll(8,3); - my $GENDER = $_[3][roll(scalar @_[3]-1,0)]; + my @POSSEX = $_[3]->[0]; + my $genderroll = roll(scalar @POSSEX-1,0); + my $GENDER = $POSSEX[$genderroll]; my $SEX = table($GENDER, $GENDER, $GENDER, "Male", "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Nonbinary", "Cyborg", "Sex"); my @ORIENTATION; foreach my $item (@SEXES){ @@ -40,7 +42,7 @@ sub generate { $GENDER =~ s/^.*: //; chomp($GENDER); chomp($GENDER); - symlink($_[0] . "/" . $_[1] . ".md", $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); + symlink("../" . "/" . $_[1] . ".md", "./" . $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); printf $CHAR table("Biker Leathers", "Blue Jeans", "Corporate Suits", "Jumpsuits", "Miniskirts", "High Fashion", "Cammos", "Normal Clothes", "Nude", "Bag Lady Chic", "Generally Wears"); printf $CHAR table("Mohawk", "Long & Ratty", "Short & Spiked", "Wild & all over", "Bald", "Stripped", "Tinted", "Neat, short", "Short, curly", "Long, straight", "Hair"); @@ -72,7 +74,7 @@ sub generate { printf $CHAR " twin"; } #my $ch = name($_[0],$_[1],0,0); - my $ch = name($_[0],$_[1],$_[2],@SEXES,0); + my $ch = name($_[0],$_[1],$_[2],\@SEXES,1); #printf $CHAR " sibling, named " . $ch . " who "; printf $CHAR " sibling, named [" . $ch . "](" . $ch . ".html) who "; $var = roll(10,1); @@ -155,7 +157,7 @@ sub generate { last SWITCH; }; $var == 6 && do { - printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],@SEXES,0) . ") "; + printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],\@SEXES,1) . ") "; my $how = roll(10,1); if($how <= 5){ printf $CHAR "They died accidentally.\n\n"; @@ -232,11 +234,11 @@ sub generate { }elsif($var <= 6){ $var = roll(10,1); if($var <= 5){ - my $ch = name($_[0],$_[1],$_[2],@SEXES); + my $ch = name($_[0],$_[1],$_[2],\@SEXES); 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"); }else{ - my $ch = name($_[0],$_[1],$_[2],@SEXES); + my $ch = name($_[0],$_[1],$_[2],\@SEXES); 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); @@ -296,7 +298,7 @@ sub generate { } } }elsif($var <= 8){ - my $ch = name($_[0],$_[1],$_[2],@ORIENTATION); + my $ch = name($_[0],$_[1],$_[2],\@ORIENTATION); printf $CHAR "You had a romance! With someone named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR romance(); }elsif($var <=10){ @@ -332,13 +334,19 @@ sub name{ my $name; my $flip; my $named = 0; - if(scalar @_ > 4){ - $flip = $_[4]; - }else{ - $flip = roll(depth*2,1); - } - if($flip <= $_[2] || $_[2] > depth){ - $name = File::Random::random_file(-dir=>"$ARGV[0]"); + my @POSSEX = $_[3]->[0]; + my $genderroll = roll(scalar @POSSEX-1,0); + my $GENDER = $POSSEX[$genderroll]; + $flip = roll(depth*2,1); + if($flip <= $_[2] || $_[2] > depth || defined $_[4] ){ + my $dir = "./" . $ARGV[0] . "/" . $GENDER; + print "Dir: ". $dir . "\n"; + $name = File::Random::random_file( + -dir => "$dir", + -follow => 1, + -recursive => 1 + ); + print "Name: " . $name . "\n"; $name =~ s/.md$//g; if($name ne $_[1]){ $named = 1; @@ -349,7 +357,7 @@ sub name{ $name =~ s/ /_/g; chomp($name); if($_[2] < depth){ - generate($_[0], $name, $_[2]+1,@SEXES); + generate($_[0], $name, $_[2]+1,\@POSSEX); } } return $name;