#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use CGI; use CGI::Carp qw(fatalsToBrowser); use Games::Dice qw(roll); use HTML::Template; use Lingua::EN::Numbers::Ordinate; =pod =head1 NAME F<rg_mutate.pl> =head1 AUTHOR Lady_Aleena =head1 ACKNOWLEDGEMENTS Perl Monks: Anno, bradenshep, Corion, Limbic~Region, Petruchio, Sidhek +in, wfsp and the rest of the community that has been so kind to me. =head1 SYNOPSIS This script randomly generates mutations of player characters. =cut print "content-type: text/html \n\n"; #Data# my @AbilityName = qw(strength dexterity constitution intelligence wisd +om charisma); my @Align = qw(lawful chaotic good evil neutral); my @BodyPart = ('eye','lip','nail','nose','hair','skin','entire body') +; my @Class = qw(Warrior Rogue Priest Wizard Psionisist); my @ClericSphere = qw(Air All Animal Astral Chaos Charm Combat Creatio +n Divination Earth Fire Guardian Healing Law Necromatic Numbers Plant + Protection Summoning Sun Thought Time Travelers War Wards Water Weat +her); my @Dice = qw(1d4 1d6 1d8 1d10 1d12 1d20); my @Divine = ('Demi-','Lesser ','Intermediate ','Greater '); my @Effect1 = qw(Acid Cold Electricity Fire Gas Sonic); my @Effect2 = qw(Acid Cold Electricity Fire Poison Energy Drain); my @Effect3 = qw(Acid Cold Electricity Fire Energy Drain Gas Poison So +nic); my @Emotion = qw(joy sorrow trust fear love hate indifference); my @Gaze = qw(Paralysis Stone Stun Death); my @Gem = qw(diamond ruby sapphire emerald amethyst garnet spinel zirc +on crystal quartz); my @ImDm = ('immune to','takes ×2 dmg from'); my @LNW = ('language','non-weapon proficiency','weapon'); my @MagicItemType = ('Magical Liquids','Scrolls','Rings','Rods','Stave +s','Wands','Books','Gems & Jewelry','Clothing','Boots & Gloves','Gird +les & Helms','Bags & Bottles','Dust & Stones','Household Items','Musi +cal Instruments','Weird Stuff','Humorous Items','Armor and Shields',' +Weapons','Artifacts'); my @Metal = qw(platinum gold silver copper nickel bronze tin iron stee +l lead aluminum); my @PM = qw(+ -); my @Radius = ("1' or Touch","5'","10'","20'","50'","100"); my @SavThrow = ('Paralyzation','Poison','Death Magic','Rods','Staves', +'Wands','Petrifaction','Polymorph','Breath Weapon','Spells'); my @Size = qw(taller shorter); my @Size2 = qw(longer shorter); my @SpellFreq = ('common','uncommon','rare','very rare'); my @Things = ('animals','plants','constructs','dragons','lycenthropes' +,'undead','inanimate objects'); my @Time = qw(round turn hour day week month year); my @Touch =('befouls','purifies','nullifies holy water','nullifies unh +oly water'); my @Vocal = qw(Deafen Fear Terror Flight); my @WeapMag = ('non-',''); my @WeapMat = qw(bone metal stone wooden); my @WeapType = qw(bludgeoning piercing slashing missile); my @WizardSchool = qw(Abjuration Air Alteration Conjuration/Summoning +Divination Earth Enchantment/Charm Fire Illusion/Phantasm Invocation/ +Evocation Necromancy Water); my @WMS = ('all crtical misses','failed backstabs','failed saving thro +ws'); #Code# my $radius = "in a $Radius[rand @Radius] radius"; my @Resist = ( "immune", "is ".roll('1d100')."% magic resistant", "has no resistance" ); my @MagicItemGroup = ( "magic items in the $MagicItemType[rand @MagicItemType] group", "all magic items" ); my @MagicItems = ( "can use all magic items", "can not use any magic items", "can only use magic items in the $MagicItemType[rand @MagicItemType] g +roup", "can not use magic items in the $MagicItemType[rand @MagicItemType] gr +oup", "causes $MagicItemGroup[rand @MagicItemGroup] to dysfunction $radius", "causes $MagicItemGroup[rand @MagicItemGroup] to loose their power $ra +dius", "attracts $MagicItemGroup[rand @MagicItemGroup] $radius", "repels $MagicItemGroup[rand @MagicItemGroup] $radius", "destroys $MagicItemGroup[rand @MagicItemGroup] $radius" ); my @OtherMagic = ( "magic dead", "a $Radius[rand @Radius] radius Wild Magic zone", "a magic attracter", "addicted to magic energies" ); my @Weapon = ( "$WeapType[rand @WeapType]", "$WeapMat[rand @WeapMat]", "$WeapMag[rand @WeapMag]magical" ); my @NWPlearn = ( "$AbilityName[rand @AbilityName] based", "$Class[rand @Class] specific" ); my @SATS = ( "to saving throws vs. $SavThrow[rand @SavThrow]", "Armor Class", "THAC0 modifier", "to Surprise" ); my @Attack =( "Breath Weapon - $Effect1[rand @Effect1] for $Dice[rand @Dice] damage" +, "Gaze Attack - $Gaze[rand @Gaze]", "Touch Attack - $Effect2[rand @Effect2] for $Dice[rand @Dice] damage", "Vocal Attack - $Vocal[rand @Vocal]" ); my @Spells = ( "all Wizard spells", "all Priest spells", "the $WizardSchool[rand @WizardSchool] school of wizard spells", "the $ClericSphere[rand @ClericSphere] sphere of priest spells", "$Effect3[rand @Effect3] spells and spell-like effects", "all spells" ); my @SpellsT = ( "$WizardSchool[rand @WizardSchool] school", "$ClericSphere[rand @ClericSphere] sphere" ); sub color { my %color_info = (red=>'f00',yellow=>'ff0',green=>'0f0',cyan=>'0ff',bl +ue=>'00f',magenta=>'f0f',white=>'fff',black=>'000'); my $color_choice = (keys %color_info)[rand keys %color_info]; return '<span class="mut" style="color:'.$color_info{$color_choice}.'; +">'.$color_choice.'</span>'; } my @Aura = ( "visible &color", "$Emotion[rand @Emotion]", "$Align[rand @Align]" ); my @Animal = ( "amphibian", "insetoid", &mammal, "reptilian" ); sub mammal { my %mammal_info = (bovine=>'cattle',canine=>'dog',caprine=>'goat',equi +ne=>'horse',feline=>'cat',leporine=>'rabbit',lupine=>'wolf',ovine=>'s +heep',porcine=>'pig',ursine=>'bear',vulpine=>'fox'); my $mammal_choice = (keys %mammal_info)[rand keys %mammal_info]; return '<a title="'.$mammal_info{$mammal_choice}.'">'.$mammal_choice.' +</a>'; } my @Animal2 = qw(amphibian insetoid mammallian reptilian); my @Head = ( "an enlarged head", "a shrunken head", "horns" ); # bradenshep: can't assign a new variable in the array like that. so d +o it first, then use it below. my $clrbld = (roll('1d100')>80?'green':'red'); my @Eyes = ( "glowing eyes", "the appearance of no eyes", "&color eyes", "eyes in an odd position", "only one eye", roll('1d4+2')." eyes", "infravision<p>&#0134; ultravision if infravision is already present</ +p>", "$clrbld-weakness color blindness", "photo-sensitivity" ); my @Ears = ( "lobeless ears", "only ear holes", "no ears", "extra-sensitive hearing", roll('1d10*10')."% deafness", roll('1d4+2')." ears" ); my @Nose = ( "an oversized nose", "only nose holes", "no nose", "a nose with an $Animal[rand @Animal] appearance", "an extra-sensitive nose", "no sense of smell" ); my @Mouth = ( "&color lips", "no lips", "an oversized mouth", roll('1d2+1')." mouths", ); my @Arms = ( "arms that are ".roll('1d50')."% $Size2[rand @Size2] than average", "no elbow joint", "no wrist joint", roll('1d4+2')." arms (all arms above triple the normal amount are vest +igial)", "$Animal[rand @Animal]-like arms" ); my @Hands = ( "elongated fingers", "one less finger on each hand", "double jointed fingers", "animal claws", "snake fingers", "webbed fingers" ); my @Legs = ( "legs that are ".roll('1d50')."% $Size2[rand @Size2] than average", "no knee joint", "no ankle joint", roll('1d4+2')." legs (all legs above double the normal amount are vest +igial)", "$Animal[rand @Animal] legs" ); my @Feet = ( "elongated toes", "one less toe on each foot", "no toes", "animal paws", "claws for toes", "webbed toes" ); my @Skin = ( "fur covered skin", "$Animal[rand @Animal] skin", "fish scales", "feathers", "invisible skin", "&color skin", "ultra-sensitive skin" ); my @Bones = ( "wooden bones", "$Gem[rand @Gem] bones", "$Metal[rand @Metal] bones", "fragile bones", "unbreakable bones" ); my @Teeth = ( "enlarged teeth", "fangs", "fangs with venom", "$Gem[rand @Gem] teeth", "$Metal[rand @Metal] teeth", "two sets of teeth" ); my @Hair = ( "&color hair", "odd textured hair", "uncuttable hair", "no hair anywhere", "invisible hair", "$Metal[rand @Metal] hair" ); my @Nails = ( "$Gem[rand @Gem] nails", "$Metal[rand @Metal] nails", "no nails", "unbreakable nails" ); my @Blood = ( "icor for blood", "poisonous blood", "&color blood" ); my @Body = ( "$Skin[rand @Skin]", "$Bones[rand @Bones]", "$Blood[rand @Blood]", "$Head[rand @Head]", "$Hair[rand @Hair]", "$Eyes[rand @Eyes]", "$Ears[rand @Ears]", "$Nose[rand @Nose]", "$Mouth[rand @Mouth]", "$Teeth[rand @Teeth]", "$Arms[rand @Arms]", "$Hands[rand @Hands]", "$Legs[rand @Legs]", "$Feet[rand @Feet]", "$Nails[rand @Nails]", "$Animal2[rand @Animal2] wings", "$Animal[rand @Animal] tail", "gills" ); my @Sleep = ( 'hardly ever wakes up', 'needs twice as much sleep', 'needs half as much sleep', 'does not need sleep', 'is an insomniac', 'is a narcoleptic', 'is unable to remember the past after sleeping' ); my @Eat = ( 'can\'t stop eating', 'needs twice as much food', 'needs half as much food', 'does not need to eat', 'is carnivorous', 'is herbivorous', 'is lethargic after eating any amount of food' ); my @Drink = ( 'can\'t stop drinking', 'needs twice as much liquid', 'needs half as much liquid', 'does not need liquids', 'is an alcoholic', 'can not get drunk', 'is intoxicated after injesting any liquid' ); my @SED = ( "$Sleep[rand @Sleep]", "$Eat[rand @Eat]", "$Drink[rand @Drink]", "$Sleep[rand @Sleep] and $Eat[rand @Eat]", "$Sleep[rand @Sleep] and $Drink[rand @Drink]", "$Eat[rand @Eat] and $Drink[rand @Drink]", "$Sleep[rand @Sleep], $Eat[rand @Eat], and $Drink[rand @Drink]" ); my @Mutation = ( "no unusual effect", "General ability", #See note 1 "Sub-ability", #See note 2 "casts up to $SpellFreq[rand @SpellFreq] $SpellsT[rand @SpellsT] schoo +l spells as a natural ability ".roll($Dice[rand @Dice])." (See note 3 +) (AorAn) $Time[rand @Time] (See the spell progession for maximum spe +ll level.)", "$Resist[rand @Resist] to $Spells[rand @Spells]", "$MagicItems[rand @MagicItems]", "is $OtherMagic[rand @OtherMagic]", "$ImDm[rand @ImDm] $Weapon[rand @Weapon] weapons", "takes only magical damage", "knows one $LNW[rand @LNW] that parent knows", "knows all {Plural~$LNW[rand @LNW]} that parent knows", # See note 4 "unable to learn {Plural~$LNW[rand @LNW]} parent knows", # See note 4 "unable to learn any language other than racial language", "$PM[rand @PM]".roll('1d4')." on all non-weapon proficiency checks", "unable to learn $NWPlearn[rand @NWPlearn] non-weapon proficiencies", "unable to learn $WeapType[rand @WeapType] weapons", "can not use $WeapMat[rand @WeapMat] weapons", "born already at ".ordinate(roll($Dice[rand @Dice]))." level", "unable to advance past ".ordinate(roll('5d6'))." level", "$PM[rand @PM]".roll('1d10')." $SATS[rand @SATS]", "a Wild Magic Surge accompanies $WMS[rand @WMS]", "attacks as a Warrior of the same level. If already a Warrior, attacks + at 1 level higher.", "can not make a Critical Hit", "attracts these followers: <ul>(RangerFollowers.pl)</ul>", # See note +5 "repels all animals $radius", "backstabs as a thief of the same level. If already a thief, backstabs + at 1 level higher.", "turns undead as a priest of the same level. If already a priest, turn +s at 1 level higher.", "Wild Psionic Talent: (Psionics.pl)", ##Psionics.pl will be in a seper +ate script. "unable to use Psionics", "Special Attack: $Attack[rand @Attack] ".roll($Dice[rand @Dice])." (Se +e note 3) (AorAn) $Time[rand @Time])", "is ".roll('1d50')."% $Size[rand @Size] than average", "has $Body[rand @Body]", "can change $BodyPart[rand @BodyPart] color at will to &color", $BodyPart[roll('1d3-1')]."s turn &color when magic is used $radius", $BodyPart[roll('3d2+1')]." turns &color when magic is used $radius", "has (AorAn) $Aura[rand @Aura] aura", "communicates with $Things[rand @Things] $radius", "knows history of $Things[rand @Things] $radius", "is blessed", "is cursed", "touch $Touch[rand @Touch]", $SED[roll('1d3-1')], "(Insane.pl)", #See note 5 "has characteristics of (AorAn) (AllMonsters.pl)", #See note 5 "has lycanthropy as a (Lycanthrope.pl)", #See note 5 "$SED[rand @SED] after seeing (AorAn) (AllMonsters.pl) for a ".$Time[r +oll('1d4+2')], #See note 5 "is $Divine[rand @Divine]power - character should be retired" ); print "<p>All effects are cumulative, and one can be cancelled out by +another.</p><ol>"; for(roll($Dice[rand @Dice])){print "<li>$Mutation[rand @Mutation]</li> +"}; print "</ol></div>"; #NOTES: # - a couple of times you had "some string ." code here ." more string +" # that's close, but you need the periods between the strings and the + code, not inside the quotes: # "some string " . code here . " more string" # - do a search for a comment tagged "bradenshep:".
[download]