Skip to content

Instantly share code, notes, and snippets.

@jd28
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jd28/2f4000ae4ad8ea0c0824 to your computer and use it in GitHub Desktop.
Save jd28/2f4000ae4ad8ea0c0824 to your computer and use it in GitHub Desktop.
// Define your races and your FE feats, make these for each custom race replacing MYRACE
// with a more descriptive name.
#define RACIAL_TYPE_MYRACE <index into the race 2da>
#define FEAT_FAVORED_ENEMEY_MYRACE <index into the feat 2da>
int Hook_GetFavoredEnemyBonus(CNWSCreatureStats *attacker, CNWSCreature *defender) {
uint16_t race = defender->cs_stats->cs_race;
int feat = -1;
switch(race) {
// copy between here
case RACIAL_TYPE_DWARF:
feat = FEAT_FAVORED_ENEMY_DWARF;
break;
// and here and paste and replace them with all the races and FE feats, including yours you made above in between here:
// and here.
}
if (feat == -1 || !nwn_GetKnowsFeat(attacker, feat)) { return 0; }
// There should be some harper scout here too, but I forget.
int ranger = nwn_GetLevelByClass(attacker, CLASS_TYPE_RANGER);
// Might need to deal with bane of enemies here too.
int bonus = 1 + (ranger / 5);
return bonus;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment