Merge branch 'pinebook' of silverwizard/Cyberpunk.enhanced into master

master
silverwizard 5 years ago committed by Gitea
commit 43d21863fe
  1. 167
      Cyberpunk.pl
  2. 4
      tohtml.sh

@ -1,13 +1,19 @@
#!/usr/local/bin/perl
use strict;
use warnings;
use File::Random qw/:all/;
use constant depth => 5;
$ARGV[0] =~ s/ /_/g;
$ARGV[1] =~ s/ /_/g;
our @SEXES = ("Male", "Female", "Nonbinary", "Cyborg");
mkdir $ARGV[0], 0755 unless -d $ARGV[0];
generate($ARGV[0], $ARGV[0], 1);
foreach my $item (@SEXES){
mkdir $ARGV[0] . "/" . $item unless -d $ARGV[0] . "/" . $item;
}
generate($ARGV[0], $ARGV[1], 1,\@SEXES);
sub generate {
my $CHAR;
@ -22,32 +28,18 @@ sub generate {
my $MA = roll(8,3);
my $EMP = roll(8,3);
my $BT = roll(8,3);
my $GENDER = table("Male", "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Nonbinary", "Cyborg", "Gender");
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;
foreach my $item ("Male", "Female", "Nonbinary", "Cyborg"){
foreach my $item (@SEXES){
if(roll(2,1)>1){
push(@ORIENTATION, $item);
}
}
printf $CHAR "Name: " . $_[1] . "\n\n";
printf $CHAR "INT: " . $INT . "\n";
printf $CHAR "REF: " . $REF . "\n";
printf $CHAR "CL: " . $CL . "\n";
printf $CHAR "TECH: " . $TECH . "\n";
printf $CHAR "LK: " . $LK . "\n";
printf $CHAR "ATT: " . $ATT . "\n";
printf $CHAR "MA: " . $MA . "\n";
printf $CHAR "EMP: " . $EMP . "\n";
printf $CHAR "BT: " . $BT . "\n\n";
printf $CHAR $GENDER;
printf $CHAR $SEX;
printf $CHAR "Orientation: ";
foreach my $item (@ORIENTATION) {
printf $CHAR $item . " ";
}
printf $CHAR "\n\n";
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");
@ -78,8 +70,8 @@ sub generate {
}else{
printf $CHAR " twin";
}
my $ch = name();
printf $CHAR " sibling, named " . substr($ch, 0, -1) . " who ";
my $ch = name($_[0],$_[1],$_[2],\@SEXES,1);
printf $CHAR " sibling, named " . $ch . " who ";
$var = roll(10,1);
if(($var == 1)||($var == 2)){
printf $CHAR "dislikes you\n\n";
@ -96,7 +88,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;
}
}
@ -107,7 +98,7 @@ sub generate {
printf $CHAR table("A weapon", "A tool", "A piece of clothing", "A photograph", "A book or diary", "A recording", "A musical instrument", "A piece of jewelery", "A toy", "A letter", "Most Valued Possession");
printf $CHAR "AGE: ";
my $age = roll(6,1)+roll(6,1);
print $CHAR $age+16;
printf $CHAR $age+16;
printf $CHAR "\n\n";
while($age >= 0){
@ -161,7 +152,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],\@SEXES,1) . ") ";
my $how = roll(10,1);
if($how <= 5){
printf $CHAR "They died accidentally.\n\n";
@ -238,18 +229,12 @@ 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";
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");
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],\@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);
SWITCH: {
@ -308,17 +293,30 @@ 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],$_[2],\@ORIENTATION);
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";
}
$age = $age-1;
}
printf $CHAR "Name: " . $_[1] . "\n\n";
printf $CHAR "INT: " . $INT . "\n";
printf $CHAR "REF: " . $REF . "\n";
printf $CHAR "CL: " . $CL . "\n";
printf $CHAR "TECH: " . $TECH . "\n";
printf $CHAR "LK: " . $LK . "\n";
printf $CHAR "ATT: " . $ATT . "\n";
printf $CHAR "MA: " . $MA . "\n";
printf $CHAR "EMP: " . $EMP . "\n";
printf $CHAR "BT: " . $BT . "\n\n";
printf $CHAR "Gender: " . $GENDER . "\n";
printf $CHAR $SEX;
printf $CHAR "Orientation: ";
foreach my $item (@ORIENTATION) {
printf $CHAR $item . " ";
}
printf $CHAR "\n\n";
close($CHAR);
}
@ -328,63 +326,50 @@ sub roll{
}
sub name{
my $name = `notwhoami|head -n1`;
$name =~ s/ /_/g;
return $name
my $name;
my $flip;
my $named = 0;
my @POSSEX = @{ $_[3] };
if (scalar @POSSEX == 0){
@POSSEX = @SEXES;
}
my $genderroll = roll(scalar @POSSEX-1,0);
my $GENDER = $POSSEX[$genderroll];
$flip = roll(depth*1.5,1);
if($flip <= $_[2] && $_[2] < depth && !defined $_[4] ){
my $dir = "./" . $ARGV[0] . "/" . $GENDER;
$name = File::Random::random_file(
-dir => "$dir",
-follow => 1,
-recursive => 1
);
if($name ne $_[1] && $name ne ""){
$named = 1;
}
}
if($named == 0){
$name = `notwhoami|head -n1`;
$name =~ s/ /_/g;
chomp($name);
if($_[2] < depth && !defined $_[4]){
generate($_[0], $name, $_[2]+1,\@POSSEX);
}
}
$name =~ s/.md$//g;
return $name;
}
sub table{
my $return;
$return = $_[10] . ": ";
my $var = roll(10,1);
SWITCH: {
$var == 1 && do {
$return = $return . $_[0];
last SWITCH;
};
$var == 2 && do {
$return = $return . $_[1];
last SWITCH;
};
$var == 3 && do {
$return = $return . $_[2];
last SWITCH;
};
$var == 4 && do {
$return = $return . $_[3];
last SWITCH;
};
$var == 5 && do {
$return = $return . $_[4];
last SWITCH;
};
$var == 6 && do {
$return = $return . $_[5];
last SWITCH;
};
$var == 7 && do {
$return = $return . $_[6];
last SWITCH;
};
$var == 8 && do {
$return = $return . $_[7];
last SWITCH;
};
$var == 9 && do {
$return = $return . $_[8];
last SWITCH;
};
$var == 10 && do {
$return = $return . $_[9];
last SWITCH;
};
}
$return = $return . "\n\n";
my $length = scalar @_;
$return = $_[$length-1] . ": ";
my $var = roll($length-2,1);
$return = $return . $_[$var] . "\n\n";
return $return;
}
sub win{
my $return;
$return = $return . "You had a big win!\n\n";
$return = "You had a big win!\n\n";
my $win = roll(10,1);
SWITCH: {
$win == 1 && do {
@ -443,7 +428,7 @@ sub win{
}
sub romance{
my $return;
my $return = "";
my $workedout = roll(10,1);
if($workedout <= 4){
$return = $return . "You had a happy love affair, it worked out well\n\n";

@ -1,4 +1,4 @@
for char in `ls $1`
for char in `find $1 -maxdepth 1 -type f`
do
markdown $1/$char > $1/`echo $char |sed 's/.md$/.html/'`
markdown $char > `echo $char |sed 's/.md$/.html/'`
done

Loading…
Cancel
Save