int Local_GetACEquipAdjustment (CNWSCreatureStats *stats, int touch, int adj) { #ifdef NWNX_DEFENSES_HG if (!touch) { int i; /* Insurmountable Protection feats */ for (i = 3105; i <= 3109; i++) { if (CNWSCreatureStats__HasFeat(stats, i)) adj += 2; } /* cap shield AC for large/tower shields */ if (stats->cs_ac_shield_base > 1 && stats->cs_ac_armour_base < 6) { int dex = CNWSCreatureStats__GetDEXMod(stats, 1); if (stats->cs_ac_shield_base == 3) { if (dex > (11 - stats->cs_ac_armour_base)) adj -= dex - (11 - stats->cs_ac_armour_base); } else if (stats->cs_ac_shield_base == 2) { if (dex > (18 - stats->cs_ac_armour_base)) adj -= dex - (18 - stats->cs_ac_armour_base); } } } #endif return adj; }
static int Hook_GetCasterClassAbility(CNWSCreatureStats *stats, int cl) { int abil, force = 0; if (cl < 0 || cl > 255) cl = 255; #ifdef NWNX_SPELLS_HG { int i, level = 0; for (i = 0; i < stats->cs_classes_len; i++) level += stats->cs_classes[i].cl_level; if (level >= 40) force = 1; } #endif switch (abil = Table_SpellAbilities[cl] - 1) { case ABILITY_STRENGTH: Hook_SCA_Ability = CNWSCreatureStats__GetSTRStat(stats); Hook_SCA_Modifier = (force ? (stats->cs_str / 2) + 1 : stats->cs_str_mod); break; case ABILITY_DEXTERITY: Hook_SCA_Ability = CNWSCreatureStats__GetDEXStat(stats); Hook_SCA_Modifier = (force ? (stats->cs_dex / 2) + 1 : CNWSCreatureStats__GetDEXMod(stats, 0)); break; case ABILITY_CONSTITUTION: Hook_SCA_Ability = CNWSCreatureStats__GetCONStat(stats); Hook_SCA_Modifier = (force ? (stats->cs_con / 2) + 1 : stats->cs_con_mod); break; case ABILITY_INTELLIGENCE: Hook_SCA_Ability = CNWSCreatureStats__GetINTStat(stats); Hook_SCA_Modifier = (force ? (stats->cs_int / 2) + 1 : stats->cs_int_mod); break; case ABILITY_WISDOM: Hook_SCA_Ability = CNWSCreatureStats__GetWISStat(stats); Hook_SCA_Modifier = (force ? (stats->cs_wis / 2) + 1 : stats->cs_wis_mod); break; case ABILITY_CHARISMA: Hook_SCA_Ability = CNWSCreatureStats__GetCHAStat(stats); Hook_SCA_Modifier = (force ? (stats->cs_cha / 2) + 1 : stats->cs_cha_mod); break; default: Hook_SCA_Ability = 0; Hook_SCA_Modifier = 0; abil = -1; break; } return abil; }
char CNWSCreatureStats_s::GetDEXMod(int bMaxArmorDex) { return CNWSCreatureStats__GetDEXMod(this, bMaxArmorDex); }