Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func void HeroDamage_SetDamageToNpc(var c_npc target)
- {
- var int dmg_sum;
- var int target_ptr; var int ocnpc_attacker;
- var int att;
- var c_item item;
- item = Npc_GetReadiedWeapon(hero);
- dmg_sum=0;
- target_ptr = oCNpc_GetPointer(target);
- ocnpc_attacker = oCNpc_GetPointer(hero);
- if(Npc_IsPlayer(target)){printdebug("Set damage to hero! SKIP"); return; };
- if(item.weight)
- {
- att = item.weight;
- }
- else
- {
- att = hero.attribute[ATR_STRENGTH];
- };
- if(item.hp)//STAFSS etc.
- {
- dmg_sum = 0;
- //B_SpecialCombatDamageReaction(hero, target);
- }
- else if(item.damagetotal)&&(!item.hp)
- {
- if(Hlp_Random(101)<=HeroDamage_CriticalChance)
- {
- dmg_sum = ((att + item.damagetotal)-target.protection[DAM_INDEX_EDGE]);
- }
- else
- {
- dmg_sum = ((att + item.damagetotal)-target.protection[DAM_INDEX_EDGE])/10;
- };
- }
- else if(HeroDamage_Damage_Blunt)&&(!item.hp)
- {
- if(Hlp_Random(101)<=HeroDamage_CriticalChance)
- {
- dmg_sum = ((att + HeroDamage_Damage_Blunt)-target.protection[DAM_INDEX_BLUNT]);
- if(dmg_sum<Hero_Minimal_Dmg)
- {
- dmg_sum = Hero_Minimal_Dmg;
- };
- }
- else
- {
- dmg_sum = ((att + HeroDamage_Damage_Blunt)-target.protection[DAM_INDEX_BLUNT])/10;
- if(dmg_sum<Hero_Minimal_Dmg)
- {
- dmg_sum = Hero_Minimal_Dmg;
- };
- };
- }
- else if (HeroDamage_Damage_Edge)&&(!item.hp)
- {
- if(Hlp_Random(101)<=HeroDamage_CriticalChance)
- {
- dmg_sum = ((att + HeroDamage_Damage_Edge)-target.protection[DAM_INDEX_BLUNT]);
- if(dmg_sum<Hero_Minimal_Dmg)
- {
- dmg_sum = Hero_Minimal_Dmg;
- };
- }
- else
- {
- dmg_sum = ((att + HeroDamage_Damage_Edge)-target.protection[DAM_INDEX_BLUNT])/10;
- };
- if(dmg_sum<Hero_Minimal_Dmg)
- {
- dmg_sum = Hero_Minimal_Dmg;
- };
- };
- if(dmg_sum>=1)
- {
- if((target.guild < GIL_SEPERATOR_HUM) && (target.attribute[ATR_HITPOINTS]-dmg_sum <= 0) && (!Npc_IsInState(target,ZS_Unconscious)) && (target.aivar[AIV_DROPDEADANDKILL] == FALSE))
- {
- CALL_IntParam (0);
- CALL_IntParam (_@(hero));
- CALL__thiscall (_@(target), 7560880);
- }
- else if ((target.guild>=GIL_SEPERATOR_HUM)&&(target.attribute[ATR_HITPOINTS]-dmg_sum<=0))
- ||((target.aivar[AIV_DROPDEADANDKILL]) && (target.attribute[ATR_HITPOINTS]-dmg_sum<=0))
- {
- target.attribute[ATR_HITPOINTS]=0;
- CALL_IntParam (ocnpc_attacker);
- CALL__thiscall (target_ptr, 7563104);
- Npc_ClearAiQueue(target);
- AI_StandUpQuick(target);
- CALL_IntParam (0);
- CALL__thiscall (target_ptr, 7563104);
- if(target.aivar[AIV_DEFEATEDBYPLAYER]==FALSE)
- {
- B_GivePlayerXP(target.level * XP_PER_VICTORY);
- target.aivar[AIV_DEFEATEDBYPLAYER] = TRUE;
- };
- }
- else
- {
- target.attribute[ATR_HITPOINTS]-=dmg_sum;
- printdebug("L_HURTANI!");
- Npc_ClearAiQueue(target);
- AI_PlayAni(target,"T_STUMBLE");
- Npc_SendSinglePerc (hero,target,PERC_ASSESSDAMAGE);
- Npc_SendPassivePerc (hero,PERC_ASSESSFIGHTSOUND,target,hero);
- };
- };
- Snd_Play3D(hero,ConcatStrings("CS_IAM_ME_FL_A",IntToString(Hlp_Random(4)+1)));
- };
Advertisement
Add Comment
Please, Sign In to add comment