From 0d185b281eba06bbaf8e597e088335a96ec07062 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Sun, 1 Sep 2019 23:46:07 -0400 Subject: [PATCH] ok! I did the needful! --- Cyberpunk.pl | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index 313668a..a4f9aa5 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -3,7 +3,7 @@ use strict; use warnings; use File::Random qw/:all/; -use constant depth => 10; +use constant depth => 5; $ARGV[0] =~ s/ /_/g; $ARGV[1] =~ s/ /_/g; @@ -28,8 +28,9 @@ sub generate { my $MA = roll(8,3); my $EMP = roll(8,3); my $BT = roll(8,3); - my @POSSEX = $_[3]->[0]; - my $genderroll = roll(scalar @POSSEX-1,0); + my @POSSEX = @{ $_[3] }; + my $genderroll = roll(scalar @POSSEX,1); + $genderroll = $genderroll -1; my $GENDER = $POSSEX[$genderroll]; my $SEX = table($GENDER, $GENDER, $GENDER, "Male", "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Nonbinary", "Cyborg", "Sex"); my @ORIENTATION; @@ -38,10 +39,6 @@ sub generate { push(@ORIENTATION, $item); } } - - $GENDER =~ s/^.*: //; - chomp($GENDER); - chomp($GENDER); 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"); @@ -73,10 +70,8 @@ sub generate { }else{ printf $CHAR " twin"; } - #my $ch = name($_[0],$_[1],0,0); my $ch = name($_[0],$_[1],$_[2],\@SEXES,1); - #printf $CHAR " sibling, named " . $ch . " who "; - printf $CHAR " sibling, named [" . $ch . "](" . $ch . ".html) who "; + printf $CHAR " sibling, named " . $ch . " who "; $var = roll(10,1); if(($var == 1)||($var == 2)){ printf $CHAR "dislikes you\n\n"; @@ -334,21 +329,21 @@ sub name{ my $name; my $flip; my $named = 0; - my @POSSEX = $_[3]->[0]; + my @POSSEX = @{ $_[3] }; + if (scalar @POSSEX == 0){ + @POSSEX = @SEXES; + } my $genderroll = roll(scalar @POSSEX-1,0); my $GENDER = $POSSEX[$genderroll]; - $flip = roll(depth*2,1); - if($flip <= $_[2] || $_[2] > depth || defined $_[4] ){ + $flip = roll(depth*1.5,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]){ + if($name ne $_[1] && $name ne ""){ $named = 1; } } @@ -356,10 +351,11 @@ sub name{ $name = `notwhoami|head -n1`; $name =~ s/ /_/g; chomp($name); - if($_[2] < depth){ + if($_[2] < depth && !defined $_[4]){ generate($_[0], $name, $_[2]+1,\@POSSEX); } } + $name =~ s/.md$//g; return $name; }