|
|
@ -1,7 +1,6 @@ |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "chargen.h" |
|
|
|
#include "chargen.h" |
|
|
|
#include "character.h" |
|
|
|
#include "character.h" |
|
|
@ -32,7 +31,7 @@ void addLanguage(long lang){ |
|
|
|
if((lang & languages ) == 0){ |
|
|
|
if((lang & languages ) == 0){ |
|
|
|
languages = languages + lang; |
|
|
|
languages = languages + lang; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -40,7 +39,7 @@ void addProf(long prof){ |
|
|
|
if((prof & profs) == 0){ |
|
|
|
if((prof & profs) == 0){ |
|
|
|
profs = profs + prof; |
|
|
|
profs = profs + prof; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
addProf(exp2l(arc4random_uniform(18))); |
|
|
|
addProf(1lu << arc4random_uniform(18)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -63,7 +62,7 @@ void classProfs(unsigned long* classprofs, int count, int num){ |
|
|
|
//Grab the first N elements, based on the class's value, but first, if we have more profs than available profs, get some random ones
|
|
|
|
//Grab the first N elements, based on the class's value, but first, if we have more profs than available profs, get some random ones
|
|
|
|
if(num > count){ |
|
|
|
if(num > count){ |
|
|
|
for(count;num > count;count--){ |
|
|
|
for(count;num > count;count--){ |
|
|
|
addProf(exp2l(arc4random_uniform(18))); |
|
|
|
addProf(1lu << arc4random_uniform(18)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for(int i=0;i<=num;i++){ |
|
|
|
for(int i=0;i<=num;i++){ |
|
|
@ -81,9 +80,9 @@ void genClass(){ |
|
|
|
classProfs(barbskills, 6, 2); |
|
|
|
classProfs(barbskills, 6, 2); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case BARD:; |
|
|
|
case BARD:; |
|
|
|
addProf(exp2l(arc4random_uniform(18))); |
|
|
|
addProf(1lu << arc4random_uniform(18)); |
|
|
|
addProf(exp2l(arc4random_uniform(18))); |
|
|
|
addProf(1lu << arc4random_uniform(18)); |
|
|
|
addProf(exp2l(arc4random_uniform(18))); |
|
|
|
addProf(1lu << arc4random_uniform(18)); |
|
|
|
strlcat(otherprofs, "Three Musical Instruments, ", sizeof(otherprofs)); |
|
|
|
strlcat(otherprofs, "Three Musical Instruments, ", sizeof(otherprofs)); |
|
|
|
hp = 8 + mods[CON]; |
|
|
|
hp = 8 + mods[CON]; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -176,7 +175,7 @@ void genRace(){ |
|
|
|
if(subrace == 0){ |
|
|
|
if(subrace == 0){ |
|
|
|
race = "High Elf"; |
|
|
|
race = "High Elf"; |
|
|
|
stats[INT]+=1; |
|
|
|
stats[INT]+=1; |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
}else if(subrace == 1){ |
|
|
|
}else if(subrace == 1){ |
|
|
|
race = "Wood Elf"; |
|
|
|
race = "Wood Elf"; |
|
|
|
stats[WIS]+=1; |
|
|
|
stats[WIS]+=1; |
|
|
@ -202,9 +201,9 @@ void genRace(){ |
|
|
|
stats[CHA]+=2; |
|
|
|
stats[CHA]+=2; |
|
|
|
stats[arc4random_uniform(4)]+=1; |
|
|
|
stats[arc4random_uniform(4)]+=1; |
|
|
|
stats[arc4random_uniform(4)]+=1; |
|
|
|
stats[arc4random_uniform(4)]+=1; |
|
|
|
addProf(exp2l(arc4random_uniform(18))); |
|
|
|
addProf(1lu << arc4random_uniform(18)); |
|
|
|
addProf(exp2l(arc4random_uniform(18))); |
|
|
|
addProf(1lu << arc4random_uniform(18)); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
addLanguage(ELVISH); |
|
|
|
addLanguage(ELVISH); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case HALFLING: |
|
|
|
case HALFLING: |
|
|
@ -232,7 +231,7 @@ void genRace(){ |
|
|
|
stats[INT]+=1; |
|
|
|
stats[INT]+=1; |
|
|
|
stats[WIS]+=1; |
|
|
|
stats[WIS]+=1; |
|
|
|
stats[CHA]+=1; |
|
|
|
stats[CHA]+=1; |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TIEFLING: |
|
|
|
case TIEFLING: |
|
|
|
stats[INT]+=1; |
|
|
|
stats[INT]+=1; |
|
|
@ -252,8 +251,8 @@ void genBackground(){ |
|
|
|
case ACOLYTE: |
|
|
|
case ACOLYTE: |
|
|
|
addProf(INSIGHT); |
|
|
|
addProf(INSIGHT); |
|
|
|
addProf(RELIGION); |
|
|
|
addProf(RELIGION); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CHARLATAN: |
|
|
|
case CHARLATAN: |
|
|
|
addProf(DECEPTION); |
|
|
|
addProf(DECEPTION); |
|
|
@ -282,32 +281,32 @@ void genBackground(){ |
|
|
|
case GUILDARTISAN: |
|
|
|
case GUILDARTISAN: |
|
|
|
addProf(INSIGHT); |
|
|
|
addProf(INSIGHT); |
|
|
|
addProf(PERSUASION); |
|
|
|
addProf(PERSUASION); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
strlcat(otherprofs, "Artisan's Tools, ", sizeof(otherprofs)); |
|
|
|
strlcat(otherprofs, "Artisan's Tools, ", sizeof(otherprofs)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case HERMIT: |
|
|
|
case HERMIT: |
|
|
|
addProf(MEDICINE); |
|
|
|
addProf(MEDICINE); |
|
|
|
addProf(RELIGION); |
|
|
|
addProf(RELIGION); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
strlcat(otherprofs, "Herbalism Kit, ", sizeof(otherprofs)); |
|
|
|
strlcat(otherprofs, "Herbalism Kit, ", sizeof(otherprofs)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case NOBLE: |
|
|
|
case NOBLE: |
|
|
|
addProf(HISTORY); |
|
|
|
addProf(HISTORY); |
|
|
|
addProf(PERSUASION); |
|
|
|
addProf(PERSUASION); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
strlcat(otherprofs, "Gaming Set, ", sizeof(otherprofs)); |
|
|
|
strlcat(otherprofs, "Gaming Set, ", sizeof(otherprofs)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case OUTLANDER: |
|
|
|
case OUTLANDER: |
|
|
|
addProf(ATHLETICS); |
|
|
|
addProf(ATHLETICS); |
|
|
|
addProf(SURVIVAL); |
|
|
|
addProf(SURVIVAL); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
strlcat(otherprofs, "Musical Instrument, ", sizeof(otherprofs)); |
|
|
|
strlcat(otherprofs, "Musical Instrument, ", sizeof(otherprofs)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case SAGE: |
|
|
|
case SAGE: |
|
|
|
addProf(ARCANA); |
|
|
|
addProf(ARCANA); |
|
|
|
addProf(HISTORY); |
|
|
|
addProf(HISTORY); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
addLanguage(exp2l(arc4random_uniform(15))); |
|
|
|
addLanguage(1lu << arc4random_uniform(15)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case SAILOR: |
|
|
|
case SAILOR: |
|
|
|
addProf(ATHLETICS); |
|
|
|
addProf(ATHLETICS); |
|
|
@ -345,7 +344,7 @@ size_t genChar(char* output, size_t maxlen){ |
|
|
|
genBackground(); |
|
|
|
genBackground(); |
|
|
|
for(i=0; i < 6; i++){ |
|
|
|
for(i=0; i < 6; i++){ |
|
|
|
stats[i] = dieroll(3,6); |
|
|
|
stats[i] = dieroll(3,6); |
|
|
|
mods[i] = floor((stats[i]/2)-5); |
|
|
|
mods[i] = (stats[i]/2)-5; |
|
|
|
} |
|
|
|
} |
|
|
|
snprintf(output, maxlen, "Race = %s\r\nBackground = %s\r\nClass = %s\r\nStr = %d %d\r\nDex = %d %d\r\nCon = %d %d\r\nInt = %d %d\r\nWis = %d %d\r\nCha = %d %d\r\n\r\nHP: %d\r\n", race, background, class, stats[STR], mods[STR], stats[DEX], mods[DEX], stats[CON], mods[CON], stats[INT], mods[INT], stats[WIS], mods[WIS], stats[CHA], mods[CHA], hp); |
|
|
|
snprintf(output, maxlen, "Race = %s\r\nBackground = %s\r\nClass = %s\r\nStr = %d %d\r\nDex = %d %d\r\nCon = %d %d\r\nInt = %d %d\r\nWis = %d %d\r\nCha = %d %d\r\n\r\nHP: %d\r\n", race, background, class, stats[STR], mods[STR], stats[DEX], mods[DEX], stats[CON], mods[CON], stats[INT], mods[INT], stats[WIS], mods[WIS], stats[CHA], mods[CHA], hp); |
|
|
|
|
|
|
|
|
|
|
|