Главная | Обратная связь | Поможем написать вашу работу!
МегаЛекции

Apendix B: Random Generator Sourcecodes




Apendix B: Random Generator Sourcecodes

 

Surely, you can do the generators differently. But I did them this way. Feel free to do your own and send them in (go to http: //rpg-uni. de-4u. com/conatct. php)

 

Periodical Names

 

<! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4. 0 Transitional//EN" >

< html>

< head>

< title> Periodical Generator< /title>

< script language=" JavaScript" >

<! --

var race = new Array(" Bugbear", " Drow Elf", " Gully Dwarf", " Ettin", " Gnoll", " Goblin", " Hag", " Half-Orc", " Harpy", " Human", " Hill Giant", " Hobgoblin", " Kobold", " Lizard Man", " Mongrelman", " Orc", " Ogre", " Troglodyte", " Were-Rat" );

var adjective = new Array(" Arousing", " Big", " Delectable", " Erotic", " Fleshy", " Greasy", " Hard", " Hefty", " Hors d'oeuvre", " Jiggling", " Juicy", " Large", " Luscious", " Moist", " Oily", " Profuse", " Savory", " Scrumptious", " Sensual", " Slimy", " Sticky", " Stimulating", " Succulent", " Sumptuous", " Swollen", " Tantalizing", " Tender", " Titillating", " Voluptuous", " Warted" );

var nouns = new Array(" Balls", " Bolas", " Butts", " Caves", " Clubs", " Dungeons", " Holes", " Hooters", " Jugs", " Knockers", " Lingerie", " Mounds", " Pits", " Rods", " Staves", " Strongholds", " Stuff", " Swords", " Wands of Wonder", " Wankers" );

var adjectiveR2 = adjective. length+1;

var twoFold = Math. round(Math. random()*4);

var adjectiveR = adjectiveR2;

 

var printer = " ";

if ( twoFold == 2 ) {

adjectiveR2 = Math. floor(Math. random()*adjective. length);

printer += adjective[adjectiveR2] + " ";

adjectiveR = adjectiveR2;

}

if ( twoFold > = 1 ) {

while ( adjectiveR2 == adjectiveR ) {

       adjectiveR = Math. floor(Math. random()*adjective. length);

}

printer += adjective[adjectiveR] + " ";

}

 

printer += race[Math. floor(Math. random()*race. length)] + " " + nouns[Math. floor(Math. random()*nouns. length)];

document. writeln(" < div align=\" center\" > < br> " +printer);

 

//-->

< /script>

< /head>

< body>

< br> < br>

< a href=" javascript: location. reload()" > Again< /a> < br>

< a href=" /generators. php" > Back to Mainpage< /a>

< /div>

< /body>

< /html>

 

 

Prostitute Generator

 

<! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4. 0 Transitional//EN" >

< html>

< head>

< title> Unbenannt< /title>

< script language=" JavaScript" >

<! --

 

var abilityScoreBonus = new Array ( -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5);

var sizeM = new Array ( 43, 55, 38, 60, 32, 60, 60 );

var sizeF = new Array ( 41, 50, 36, 58, 30, 59, 60 );

var sizeMod = new Array (10, 10, 6, 12, 16, 20, 30 );

 

var weightM = new Array (120, 90, 72, 110, 52, 140, 160 );

var weightF = new Array (105, 70, 68, 85, 48, 100, 130 );

var weightMod = new Array (40, 30, 20, 36, 20, 60, 70 );

 

var ageB = new Array ( 40, 100, 60, 15, 20, 15, 10 );

var ageMod = new Array ( 60, 120, 60, 20, 30, 20, 30 );

var costA = new Array ( 3, 5, 3, 1, 4, 1, 0. 7 );

 

var raceA = new Array ( " Dwarf", " Elf", " Gnome", " Half-Elf", " Halfling", " Human", " Half-Orc" );

var hairA = new Array (" Brunette", " Blonde", " Auburn", " Sable", " Crimson", " Silver", " White", " Sky Blue", " Lt. Green", " Lilac", " Iridescent", " Bald" );

var eyesA = new Array (" Lt. Blue", " Dk Green", " Hazel", " Brown", " Crimson", " Silver", " Lt. Green", " Dk. Blue", " Pink", " Brown", " Brown", " Each Eye Different" );

var complexionA = new Array (" Dusky Olive", " Bronze", " Milky White", " Ebony", " Lt. Red", " Yellow", " Brown", " Golden" );

var waistM = 0;

var hipsM = 0;

 

 

function d100sub (randomizer) {

var randN = Math. floor(Math. random()*randomizer);

if ( randN < 13 ) { return 0; }

else if ( randN < 26 ) { return 1; }

else if ( randN < 34 ) { return 2; }

else if ( randN < 42 ) { return 3; }

else if ( randN < 50 ) { return 4; }

else if ( randN < 58 ) { return 5; }

else if ( randN < 67 ) { return 6; }

else if ( randN < 75 ) { return 7; }

else if ( randN < 83 ) { return 8; }

else if ( randN < 91 ) { return 9; }

else if ( randN < 99 ) { return 10; }

else if ( randN < 100 ) { return 11; }

}

function dX (die) {

var num = 0;

num += Math. ceil(Math. random()*die);

return num;

}

function d6 (times) {

var num = 0;

for ( i = 0; i < times; i++ ) {

       num += dX(6);

}

return num;

}

// Main function

function calculateThePro () {

if ( document. forms[0]. elements[" charisma" ]. value==" " || document. forms[0]. elements[" charisma" ]. value. NaN ) {

       var one = d6(3);

       var two = d6(3);

       var charisma = (one> two)? one: two;

} else {

       charisma = document. forms[0]. elements[" charisma" ]. value;

}

one = d6(3);

two = d6(3);

var constitution = (one> two)? one: two;

// get vital statistics

var randN = Math. floor(Math. random()*100);

var vc = " ";

if ( randN < 30 ) { vc = 22; }

else if ( randN < 50 ) { vc = 23; }

else if ( randN < 65 ) { vc = 24; }

else if ( randN < 77 ) { vc = 25; }

else if ( randN < 82 ) { vc = 26; }

else if ( randN < 85 ) { vc = 27; }

else if ( randN < 90 ) { vc = 28; }

else if ( randN < 94 ) { vc = 29; }

else if ( randN < 97 ) { vc = 30; }

else if ( randN < 99 ) { vc = 31; }

// get race and gender 

var raceNum = document. forms[0]. elements[" race" ]. options[document. forms[0]. elements[" race" ]. selectedIndex]. value;

var genderNum = " female";

if ( document. forms[0]. gender[1]. checked ) { genderNum = " male"; }

if ( raceNum == 0 ) { constitution += 2; }

if ( raceNum == 6 ) { charisma -= 2; }

vc += Math. ceil( (abilityScoreBonus[constitution]/2));

if ( raceNum == 10 ) {

       raceNum = Math. floor(Math. random()*raceA. length);

}

var raceName = raceA[raceNum];

// calculating size and wight

if ( genderNum == " female" ) {

       var weight = weightF[raceNum] + dX(weightMod[raceNum]);

       var size = sizeF[raceNum] + dX(sizeMod[raceNum]);

} else {

       var weight = weightM[raceNum] + dX(weightMod[raceNum]);

       var size = sizeM[raceNum] + dX(sizeMod[raceNum]);

}

// age and looks

var age = ageB[raceNum] + dX(ageMod[raceNum]);

var hair = hairA[d100sub (100)];

var complexion = complexionA[d100sub (75)];

var eyes = eyesA[d100sub (100)];

var bust = abilityScoreBonus[charisma] + 7 + dX(3) + vc;

 

if ( charisma < 4 ) { waistM = d6(5); hipsM = d6(6); }

else if ( charisma < 6 ) { waistM = d6(2); hipsM = d6(2); }

else if ( charisma < 9 ) { waistM = dX(4); }

else if ( charisma < 12 ) { waistM = dX(2); }

else if ( charisma < 15 ) {}

else if ( charisma < 18) { hipsM = -1; }

else { hipsM = -2; }

     

var hips = vc + hipsM;

var waist = vc + waistM;

if ( raceNum == 0 || raceNum == 2 || raceNum ==4 ) {

       hips -= 2;

       bust -= 2;

}

 

// putting it out

var putOut = genderNum + " " + raceName + " prostitute\n";

putOut += " Charisma: " + charisma;

putOut += " \nConstitution: " + constitution;

putOut += " \nHeight: " +size+ " \" ";

putOut += " \nWeight: " +weight;

putOut += " \nRace: " +raceName;

putOut += " \nAge: " +age;

putOut += " \nHair: " +hair;

putOut += " \nEyes: " +eyes;

putOut += " \nComplexion: " +complexion;

putOut += " \nBust: " +bust+ " \" ";

putOut += " \nWaist: " +waist+ " \" ";

putOut += " \nHips: " +hips + " \" ";

     

// Prostitutie Extras

     

var putOutW = " ";

for ( i = 0; i< 1; i++) {

       randN = Math. floor(Math. random()*100);

       if ( randN < 50 ) { putOutW += " " }

       else if ( randN < 79 ) { putOutW += " Natural Disease; " }

       else if ( randN < 89 ) { putOutW += " Magical Disease; " }

       else if ( randN < 99 ) { putOutW += " Insanity; " }

       else if ( randN < 101 ) { i-- }

}

if ( putOutW! = " " ) {

       putOut += " \nProstitute Extras: " +putOutW + " \nA prostitute may have more than one extra of each category. Same result indicates two different diseases or insanities. ";

}

// Prostitute Specialties

var costPer = 0;

putOutW = " ";

var indicator = new Array ( " ", " ", " ", " ", " " );

     

for ( i = 0; i< 1; i++) {

       randN = Math. floor(Math. random()*100);

       if ( randN < 50 ) { putOutW += " " }

       else if ( randN < 70 ) { if ( indicator[0] == " " ) { putOutW += " Massage; "; costPer += 10; indicator[0] = " 1" } else { i--; } }

       else if ( randN < 80 ) { if ( indicator[1] == " " ) { putOutW += " Anal Sex; "; costPer += 20; indicator[1] = " 1" } else { i--; } }

       else if ( randN < 90 ) { if ( indicator[2] == " " ) { putOutW += " Oral Sex; "; costPer += 40; indicator[2] = " 1" } else { i--; } }

       else if ( randN < 99 ) { if ( indicator[3] == " " ) { putOutW += " Bondage; "; costPer += 60; indicator[3] = " 1" } else { i--; } }

       else if ( randN < 89 ) { i--; }

       else if ( randN < 101 ) { i = -2 }

}

if ( putOutW! = " " ) {

       putOut += " \nProstitute Specialties: " +putOutW + " \n";

}

// Prostitute Disposition

var inclinationMod = abilityScoreBonus[document. forms[0]. elements[" clCharisma" ]. value];

putOut += " \nDisposition: ";

randN = Math. floor(Math. random()*20);

if ( randN < 3) { putOut += " Angry"; inclinationMod = -3 }

else if ( randN < 5 ) { putOut += " Jealous"; inclinationMod = -2 }

else if ( randN < 8 ) { putOut += " Pensive"; inclinationMod = -1 }

else if ( randN < 11 ) { putOut += " Tired"; inclinationMod = 0}

else if ( randN < 14 ) { putOut += " Tender"; inclinationMod = +1}

else if ( randN < 16 ) { putOut += " Excited"; inclinationMod = +2}

else if ( randN < 18 ) { putOut += " Ardent"; inclinationMod = +3 }

else if ( randN < 20 ) { putOut += " Erotic"; inclinationMod = +5 }

else if ( randN < 21 ) { putOut += " Obsessed"; inclinationMod = +6 }

     

//Prostitute Inclination

putOut += " \nInclination: ";

randN = Math. floor(Math. random()*20)+ inclinationMod;

if ( randN < 2) { putOut += " Loathe"; costPer += 100; }

else if ( randN < 5 ) { putOut += " Hate"; costPer += 75; }

else if ( randN < 8 ) { putOut += " Dislike"; costPer += 50; }

else if ( randN < 7 ) { putOut += " Aloof"; costPer += 25; }

else if ( randN < 9 ) { putOut += " Sympathetic"; costPer -= 30; }

else if ( randN < 12 ) { putOut += " Interested"; costPer -= 40; }

else if ( randN < 14 ) { putOut += " Playful"; costPer -= 50; }

else if ( randN < 17 ) { putOut += " Capacious"; costPer -= 60; }

else if ( randN < 19 ) { putOut += " Fondness"; costPer -= 70; }

else if ( randN < 20 ) { putOut += " Infatuation"; costPer -= 80; }

else { putOut += " Passionate"; costPer -= 90; }

// calculate Price

var numOP = document. forms[0]. elements[" numOP" ]. value;

var price = 1000/numOP;

putOut += " \nAverage Cost of Prostitutes: " +Math. ceil(price);

var perCalc = 0;

     

var percentage = price/100;

if ( costPer < 0 ) {

       costPer *= -1;

       price = price - percentage*costPer;

} else {

       price = price + percentage*costPer;

}

putOut +=" \nCost of this Prostitute: " +Math. ceil(price);

document. forms[0]. elements[" view" ]. value=putOut;

}

 

//-->

< /script>

< /head>

< body>

< div align=" center" >

< form>

< table border=" 0" bgcolor=" #c9c9c9" cellpadding=" 0" >

< tr> < td> < select name=" race" > < option value=" 10" > RACE: Does not Matter< /option>

< option value=" 0" > Dwarf< /option>

< option value=" 1" > Elf< /option>

< option value=" 2" > Gnome< /option>

< option value=" 3" > Half-Elf< /option>

< option value=" 4" > Halfling< /option>

< option value=" 5" > Human< /option>

< option value=" 6" > Half-Orc< /option>

< /select> < /td> < td> female < input type=" radio" name=" gender" value=" female" checked> & nbsp; & nbsp; male < input type=" radio" name=" gender" value=" male" > < /td> < /tr>

< tr> < td> < select name=" clRace" > < option value=" 5" > CLIENT RACE: Does not Matter< /option>

< option value=" 0" > Dwarf< /option>

< option value=" 1" > Elf< /option>

< option value=" 2" > Gnome< /option>

< option value=" 3" > Half-Elf< /option>

< option value=" 4" > Halfling< /option>

< option value=" 5" > Human< /option>

< option value=" 6" > Half-Orc< /option>

< /select> < /td> < td> Charisma: < input type=" text" name=" clCharisma" size=" 2" maxlength=" 2" value=" 10" > < /td> < /tr>

< tr> < td> Charisma: < input type=" text" name=" charisma" size=" 2" maxlength=" 2" value=" " > & nbsp; Num of Pros. in Town: < input type=" text" name=" numOP" size=" 4" maxlength=" 4" value=" 15" > < /td> < td> < input type=" button" name=" submit" value=" Generate a Prostitute" onclick=" calculateThePro()" > < /td> < /tr>

< /table>

< textarea cols=50 rows=30 wrap=physical name=" view" > < /textarea>

< /form>

< a href=" /generators. php" > Back to Mainpage< /a>

< /body>

< /html>

 



Поделиться:





Воспользуйтесь поиском по сайту:



©2015 - 2024 megalektsii.ru Все авторские права принадлежат авторам лекционных материалов. Обратная связь с нами...