user-avatar
Today is Tuesday
February 7, 2012

May 29, 2008

Updated Bestiary Script

by John Payne — Categories: Electrum Pieces, Mnemosyne and MUSEComments Off

I updated the perl script to have a third option. If you type ‘muse’ as the third option, the stats will print in MUSE format (BODY, MIND, AURA) instead of Mnemosyne format (9 stats). To print Mnemosyne format, do not enter a third option (or you can enter anything else except muse.)

New feature is that instead of Natural or Weapon for attack type, the results will show Bite, Claw, Bludgeoning, or Constriction attack. I plan on adding special attacks, soon.

As always, the code follows:
#!/usr/bin/perl
srand(time ^ $$ ^ unpack "%L*", 'ps axww | gzip');
$usage="usage: $0 number maxsize\n";
$ARGV[0]=~/^(\d+)$/ && ($numb = $1) || die $usage;
$ARGV[1]=~/^(\d+)$/ && ($smass = $1) || die $usage;
$pr = $ARGV[2];
%rule = (
'W','VF YF YF YXF YXF YXYF B',
'B','PB YNF YNXF YNXF YNXYF YXYNF',
'P','a ambi ante circum cis co de dis ob per prae se sine sub',
'Y','Ca Ce Ci Co Cu Cy Da De Di Do Dy',
'X','Ce Ci Co o',
'V','a e i o u',
'F','Ca Ca Ca Cae Cos Com Cus Cus Cus Cus Cus Cium Cium Ces',
'C','b b c c ch ch d d d g g l l m m n n p p ph r r r s s s t t th th v x z Rr sH Ll',
'D','b b c c ch ch d d g g l l m m n n p p ph r r r s s s t t t th th v x z Rr sH Ll h qu gn pt',
'R','b b c c c ch ch g g p p ph t t th th',
'L','c ch p g f',
'H','c ch cl m n p ph pl pr qu t th',
'N','n c l r'
);

for (1..$numb) { print &parse('W'), " : ", &stats, "\n\n"; }

sub parse {
$_=pop(@_);
/[^A-Z]/ && return $_;
@TMP=split(/\s+/, $rule{$_});
$_=splice(@TMP, rand @TMP, 1);
for (split('')) { print &parse($_); }
}

sub stats {
$scl = (rand>0.333? 0: int(rand()*$smass)-2);
# $tst = int(114*(log($scl)));
$tst = int(rand()*8)+1;
$scfl = $scl<0? int(62*(1/(1.5**(abs($scl))))): int(62*(1.5**$scl));
$scfh = $scl<0? int(123*(1/(1.5**(abs($scl))))): int(123*(1.5**$scl));
$scm = (int(rand()*$scfl)+$scfh);
$wgfl = int(41*(exp($scl)));
$wgfh = int(72*(exp($scl)));
$wgh = (int(rand()*$wgfl)+$wgfh);
$str = int(rand()*8)+3 + ($scl*2);
$ref = int(rand()*8)+3;
$hlt = int(rand()*8)+3;
$inq = int(rand()*8)+3;
$wil = int(rand()*8)+3;
$pre = int(rand()*8)+3;
$psi = int(rand()*8)+3;
$def = 10+$ref;
$ini = int(($ref+$inq)/2);
$tgh = int(($str+$wil)/2);
$lif = ($hlt*3)+($wil*2)+($scl*5);
$av = int(rand()*(20-$scl));
$mov = int(($str+$ref+$hlt)/3);
$mind = int(($inq+$wil+$pre)/3);
# $dmg = int(rand()*3)+$str . 'd6';
# $type = (rand>0.6?"By weapon":"Natural");
%weapon = ( '1' => 'Bite',
'2' => 'Claw',
'3' => 'Claw',
'4' => 'Claw',
'5' => 'Claw',
'6' => 'Bludgeon',
'7' => 'Bludgeon',
'8' => 'Constriction');
$type = $weapon{$tst};
$damage{'Bite'} = $str . 'd6';
$scl<3? $damage{'Claw'} = '1d6': $damage{'Claw'} = $str-2 . 'd6';
$damage{'Bludgeon'} = $str+2 . 'd6';
$damage{'Constriction'} = $str+1 . 'd6';

if ($pr eq "muse") {
return "Size $scl\n Height $scm cm\t Weight $wgh kg\n BODY $mov\t MIND $mind\t AURA $psi\n DEF $def\t INI $ini\t TGH $tgh\n LIF $lif\t AV $av\t MOV $mov\n $type attack $damage{$type}"
} else {
return "Size $scl\n Height $scm cm\t Weight $wgh kg\n STR $str\t INT $inq\t AURA $psi\n REF $ref\t WIL $wil\n HLT $hlt\t PRE $pre\n DEF $def\t INI $ini\n TGH $tgh\t LIF $lif\t AV $av\n MOV $mov\n $type attack $damage{$type}";
}
}

© 2012 Sycarion Diversions All rights reserved - Wallow theme v0.46.4 by ([][]) TwoBeers - Powered by WordPress - Have fun!