📄 npcengine.h
字号:
/* ---------------------------------------------------------------------- * * dndutil.h * * by Jamis Buck (jgb3@email.byu.edu) * * NPC generation functions for the Dungeons & Dragons(tm) API. * * Function summary: * * void npcAbScoreStrategy_BestOf4d6( int* scores, void* data ); * void npcAbScoreStrategy_Straight3d6( int* scores, void* data ); * char* npcBuildComponentBreakdownDescription( NPCCOMPBREAKDOWN* breakdown, char* buffer, int len ) * char* npcBuildHitDiceBreakdown( NPC* npc, char* buffer, int len ) * char* npcBuildStatBlock( NPC* npc, char* buffer, int len ) * int npcClassCount( NPC* npc ) * int npcComputeActualAC( NPC* npc, NPCCOMPBREAKDOWN** breakdown ) * int npcComputeActualAttack( NPC* npc, int type, NPCCOMPBREAKDOWN** breakdown ) * int npcComputeActualInitiative( NPC* npc, NPCCOMPBREAKDOWN** breakdown ) * int npcComputeActualSave( NPC* npc, int save, NPCCOMPBREAKDOWN** breakdown ) * float npcComputeActualSkillBonus( NPC* npc, int type, NPCCOMPBREAKDOWN** breakdown ) * int npcComputeCR( NPC* npc ) * void npcDestroyComponentBreakdown( NPCCOMPBREAKDOWN* breakdown ) * void npcDestroyNPC( NPC* npc ) * int npcGearValue( NPC* npc ) * NPC* npcGenerateNPC( NPCGENERATOROPTS* opts ) * int npcGetBaseAttack( NPC* npc ) * int npcGetBaseClassAttack( NPC* npc ) * int npcGetBaseFortitudeSave( NPC* npc ) * int npcGetBaseReflexSave( NPC* npc ) * int npcGetBaseWillSave( NPC* npc ) * int npcGetCharacterLevel( NPC* npc ) * NPCCLASS* npcGetClass( NPC* npc, int classType ) * int npcGetRandomAlignment( int alType ); * int npcGetRandomRace( int raceType ) * NPCSKILL* npcGetSkill( NPC* npc, int skillType ) * int npcHasClass( NPC* npc, int classType ) * int npcHasFeat( NPC* npc, int featType ) * int npcHasSkill( NPC* npc, int skillType ) * int npcHasSkillFocus( NPC* npc, int skillType ) * int npcKnowsLanguage( NPC* npc, int language ) * char* npcRandomName( int race, int gender, char* filePath, char* name, int buflen ) * * ---------------------------------------------------------------------- */#ifndef __NPCENGINE_H__#define __NPCENGINE_H__/* ---------------------------------------------------------------------- * * Constant definitions * ---------------------------------------------------------------------- */#define classNONE ( 0 )#define classANY ( -1 )#define classANY_PC ( -2 )#define classANY_NPC ( -3 )#define raceANY ( 0 )#define raceANY_CORE ( -1 )#define raceANY_DMG ( -2 )#define raceANY_MM ( -3 )#define raceANY_CC ( -4 )#define genderANY ( 0 )#define alANY ( 0 )#define alANY_GOOD ( -1 )#define alANY_EVIL ( -2 )#define alANY_GENEUTRAL ( -3 )#define alANY_LAWFUL ( -4 )#define alANY_CHAOTIC ( -5 )#define alANY_LCNEUTRAL ( -6 )#define levelANY ( 0 )#define levelLOW ( -1 )#define levelMID ( -2 )#define levelHI ( -3 )/* component breakdown types */#define bdtABILITYSCORE ( 1 )#define bdtSIZE ( 2 )#define bdtRACIAL ( 3 )#define bdtARMOR ( 4 )#define bdtFEAT ( 5 )#define bdtBASE ( 6 )#define bdtRANK ( 7 )#define bdtHALFRANK ( 8 )#define bdtFOCUS ( 9 )#define bdtNATURAL ( 10 )#define bdtCLASS ( 11 )/* attack types */#define attMELEE ( 1 )#define attRANGED ( 2 )/* ---------------------------------------------------------------------- * * Type definitions * ---------------------------------------------------------------------- */typedef struct __npc__ NPC;typedef struct __npcclass__ NPCCLASS;typedef struct __npcfeat__ NPCFEAT;typedef struct __npcskill__ NPCSKILL;typedef struct __npcspell__ NPCSPELL;typedef struct __npclanguage__ NPCLANGUAGE;typedef struct __npcbarddata__ NPCBARDDATA;typedef struct __npcclericdata__ NPCCLERICDATA;typedef struct __npcdruiddata__ NPCDRUIDDATA;typedef struct __npcpaladindata__ NPCPALADINDATA;typedef struct __npcrangerdata__ NPCRANGERDATA;typedef struct __npcsorcererdata__ NPCSORCERERDATA;typedef struct __npcwizarddata__ NPCWIZARDDATA;typedef struct __npcexpertdata__ NPCEXPERTDATA;typedef struct __npcfeatweapon__ NPCFEATWEAPON;typedef struct __npcfeatskill__ NPCFEATSKILL;typedef struct __npcfeatschool__ NPCFEATSCHOOL;typedef struct __npcfeatspells___ NPCFEATSPELLS;typedef struct __npcgeneratoroptions__ NPCGENERATOROPTS;typedef struct __npcstatblockoptions__ NPCSTATBLOCKOPTS;typedef struct __npccompbreakdown__ NPCCOMPBREAKDOWN;/* first parameter - 6 element array of integers, second parameter - user * specified data. */typedef void (*NPCABSCOREGENFUNC)( int*, void* );/* ---------------------------------------------------------------------- * * Structure definitions * ---------------------------------------------------------------------- */struct __npclanguage__ { int language; NPCLANGUAGE* next;};struct __npcspell__ { int spell; NPCSPELL* next;};struct __npcbarddata__ { NPCSPELL* spells[10];};struct __npcclericdata__ { int domain[2];};struct __npcdruiddata__ { int companion;};struct __npcrangerdata__ { int favoredEnemies[5];};struct __npcpaladindata__ { int mount;};struct __npcsorcererdata__ { int familiar; NPCSPELL* spells[10];};struct __npcexpertdata__ { int classSkills[10];};struct __npcwizarddata__ { int familiar; int favoredSchool; int opposedSchools[3]; NPCSPELL* spells[10];};struct __npcfeatweapon__ { int weapon;};struct __npcfeatskill__ { int skill;};struct __npcfeatschool__ { int school;};struct __npcfeatspells___ { int spells[3];};struct __npcclass__ { int type; int level; int hp; void* data; NPCCLASS* next;};struct __npcfeat__ { int type; int autoAdd; void* data; NPCFEAT* next;};struct __npcskill__ { int type; float rank; void* data; NPCSKILL* next;}; struct __npc__ { int strength; int dexterity; int constitution; int intelligence; int wisdom; int charisma; int hp; int age; int weight; int height_ft; int height_in; int race; int gender; int alignment; char* name; NPCCLASS* classes; NPCFEAT* feats; NPCSKILL* skills; NPCLANGUAGE* languages;};struct __npcgeneratoroptions__ { int raceType; int gender; int alignment; int level[3]; int classType[3]; char* filePath; NPCABSCOREGENFUNC abilityScoreStrategy; void* userData;};struct __npcstatblockoptions__ { int abilityBonuses; int acBreakdown; int initBreakdown; int attackBreakdown; int saveBreakdown; int skillBreakdown; int languages; int skillsAndFeats; int possessions; int spells; int richFormatting;};struct __npccompbreakdown__ { int component; int data1; int data2; NPCCOMPBREAKDOWN* next;};/* ---------------------------------------------------------------------- * * Functions * ---------------------------------------------------------------------- */#ifdef __cplusplusextern "C" {#endif/* ---------------------------------------------------------------------- * * npcGenerateNPC * * Returns a pointer to a new NPC, generated according to the options * given in the parameter. * ---------------------------------------------------------------------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -