You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
2.4 KiB
JavaScript

function nameGen() {
var nm1 = ["Wide", "Ugly", "Strange", "Spike", "Smelly", "Slime", "Rumble", "Puny", "Pale", "Lazy", "Icky", "Hairy", "Grime", "Grease", "Greasy", "Gray", "Fuzzy", "Fickle", "Fierce", "Dirty", "Creaky", "Broke", "Bone", "Fake", "False", "Bad", "Bent", "Big", "Bitter", "Black", "Blood", "Bold", "Brash", "Broken", "Cloth", "Cold", "Cruel", "Dark", "Dirt", "Drunk", "Dull", "Elder", "Fat", "Firm", "Flat", "Frail", "Glob", "Gout", "Green", "Grim", "Grub", "Half", "Hollow", "Ichor", "Light", "Limp", "Long", "Lost", "Loud", "Lump", "Mad", "Meek", "Mild", "Mold", "Moss", "Muck", "Mud", "Murk", "Nag", "Null", "Numb", "Oaf", "Odd", "Patch", "Rabid", "Red", "Round", "Sad", "Sharp", "Shrill", "Shudder", "Sick", "Slow", "Small", "Smooth", "Smug", "Snail", "Snot", "Somber", "Spot", "Stark", "Steel", "Stink", "Strong", "Stub", "Thick", "Wag", "War", "Warp", "Wart", "Weak", "Wicked", "Wild", "Wood", "Worm"];
var nm2 = ["arm", "arms", "axe", "ear", "ears", "eye", "eyes", "blade", "bone", "bones", "bow", "brain", "cheek", "cheeks", "chin", "face", "feet", "fist", "fists", "flab", "flank", "flap", "foot", "gob", "gut", "guts", "hair", "hammer", "head", "helm", "joint", "joints", "knee", "knees", "knuckle", "knuckles", "leg", "legs", "maw", "mug", "nail", "nails", "nose", "pit", "pits", "scar", "scars", "shield", "skin", "spear", "spike", "stack", "sword", "teeth", "thumb", "thumbs", "toe", "toes", "tooth", "tuft", "will"];
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
if (nm1[rnd].charAt(nm1[rnd].length, -1) === "y" || nm1[rnd].charAt(nm1[rnd].length, -1) === "e") {
while (nm2[rnd2].charAt(0) === "a" || nm2[rnd2].charAt(0) === "e") {
rnd2 = Math.random() * nm2.length | 0;
}
}
names = nm1[rnd] + nm2[rnd2];
nm1.splice(rnd, 1);
nm2.splice(rnd2, 1);
br = document.createElement('br');
element.appendChild(document.createTextNode(names));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
}