int CNWSCreature_s::GetDamageFlags() { CNWSCombatRound *CRound = cre_combat_round; CNWSCombatAttackData *AttackData = CRound->GetAttack(CRound->CurrentAttack); CNWSItem *Weapon = CRound->GetCurrentAttackWeapon(AttackData->WeaponAttackType); if (Weapon) { return Weapon->GetDamageFlags(); } return 1; }
int __fastcall GetCriticalHitRoll( CNWSCreatureStats * pThis, void*, int arg1 ){ CNWSItem * itm = NULL; BYTE nBase = 0; BYTE nRange; if( arg1 == 1 ){ itm = pThis->cs_original->cre_equipment->GetItemInSlot( 32 ); } else{ itm = pThis->cs_original->cre_equipment->GetItemInSlot( 16 ); } if( itm == NULL ) itm = pThis->cs_original->cre_equipment->GetItemInSlot( 8 ); DWORD BaseItemType = itm == NULL ? 256 : itm->it_baseitemtype; CNWSItemProperty * itmprop; nRange = Weapons.WB->GetCriticalHitThreat( BaseItemType ); if( nRange <= 0 ){ DWORD * basePTR = Weapons.GetDefaultBaseItemTypeInfo( BaseItemType, 28 ); if( basePTR ) nRange = *(BYTE*)basePTR; } if( itm != NULL && itm->GetPropertyByType( &itmprop, 43, 0 ) ){ nBase = nRange; } if( pThis->HasFeat( 885 ) && pThis->GetIsWeaponOfChoice( BaseItemType ) ){ nBase += 2; } if( Weapons.DevCritBehavior == 3 ){ WORD devFeat = Weapons.WB->GetDevastatingCirticalHitFeat( BaseItemType ); if( devFeat > 0 && pThis->HasFeat( devFeat ) ) nBase += 2; } if( GetWeaponImprovedCritical( pThis, NULL, itm ) ) nBase += nRange; return 21 - nBase - nRange; }
int __fastcall GetCanUseMonkAbilities( CNWSCreature * pThis, void * ){ if( pThis == NULL || pThis->cre_stats->GetNumLevelsOfClass( 5 ) <= 0 ) return 0; CNWSItem * itmChest = pThis->cre_equipment->GetItemInSlot( 2 ); int armorAC = itmChest == NULL ? 0 : itmChest->ComputeArmorClass( ); if( armorAC > 0 ) return 0; CNWSItem * itmHand = pThis->cre_equipment->GetItemInSlot( 32 ); DWORD baseItem = itmHand == NULL ? 256 : itmHand->it_baseitemtype; return Weapons.WB->GetWeaponUsesUnarmedBaseAttackBonus( baseItem ); }
char* CNWNXFuncs::OnRequest(char *gameObject, char* Request, char* Parameters) { _log(1, "- StrReq: \"%s\" Params: \"%s\"\n", Request, Parameters); if (gameObject == NULL) { _log(1, "o Error: Invalid Object passed to nwnx_funcs.\n"); sprintf(Parameters, ""); return NULL; } if (strcmp(Request, "TEST") == 0) { CNWSCreature *cre = ((CGameObject*)gameObject)->AsNWSCreature(); CNWSItem *Weapon = cre->cre_equipment->GetItemInSlot(EQUIPMENT_SLOT_RIGHTHAND); if (Weapon) { if (Weapon->GetPropertyByTypeExists(74, 0)) { CNWSItemProperty *iprp = new CNWSItemProperty; if (Weapon->GetPropertyByType(&iprp, 74, 0)) { if (iprp->ip_cost_value) { int NumDice = 0, Die = 0; CExoString ExoString = "NumDice"; ((*NWN_Rules)->ru_2das->tda_iprp_damagecost)->GetINTEntry_strcol(iprp->ip_cost_value, ExoString, &NumDice); ExoString = "Die"; ((*NWN_Rules)->ru_2das->tda_iprp_damagecost)->GetINTEntry_strcol(iprp->ip_cost_value, ExoString, &Die); } } } } } else if (MainLookup->Execute(Request, (CGameObject*)gameObject, Parameters)) { } else {sprintf(Parameters, "-1"); _log(1, "o Could not find requested function.\n");} return NULL; }