Guest User

Untitled

a guest
Dec 18th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.22 KB | None | 0 0
  1. func void HeroDamage_SetDamageToNpc(var c_npc target)
  2. {
  3.         var int dmg_sum;
  4.         var int target_ptr; var int ocnpc_attacker;
  5.         var int att;
  6.         var c_item item;
  7.         item = Npc_GetReadiedWeapon(hero);
  8.         dmg_sum=0;    
  9.         target_ptr = oCNpc_GetPointer(target);
  10.         ocnpc_attacker = oCNpc_GetPointer(hero);
  11.         if(Npc_IsPlayer(target)){printdebug("Set damage to hero! SKIP"); return; };
  12.        
  13.         if(item.weight)
  14.         {
  15.             att = item.weight;
  16.         }
  17.         else
  18.         {
  19.             att = hero.attribute[ATR_STRENGTH];
  20.         };
  21.        
  22.         if(item.hp)//STAFSS etc.
  23.         {
  24.             dmg_sum = 0;
  25.             //B_SpecialCombatDamageReaction(hero, target);
  26.         }
  27.         else if(item.damagetotal)&&(!item.hp)
  28.         {
  29.             if(Hlp_Random(101)<=HeroDamage_CriticalChance)
  30.             {
  31.                 dmg_sum = ((att + item.damagetotal)-target.protection[DAM_INDEX_EDGE]);
  32.             }
  33.             else
  34.             {
  35.                 dmg_sum = ((att + item.damagetotal)-target.protection[DAM_INDEX_EDGE])/10;
  36.             };
  37.         }
  38.         else if(HeroDamage_Damage_Blunt)&&(!item.hp)
  39.         {
  40.             if(Hlp_Random(101)<=HeroDamage_CriticalChance)
  41.             {
  42.                 dmg_sum = ((att + HeroDamage_Damage_Blunt)-target.protection[DAM_INDEX_BLUNT]);  
  43.                 if(dmg_sum<Hero_Minimal_Dmg)
  44.                 {
  45.                     dmg_sum = Hero_Minimal_Dmg;
  46.                 };             
  47.             }
  48.             else
  49.             {
  50.                  dmg_sum = ((att + HeroDamage_Damage_Blunt)-target.protection[DAM_INDEX_BLUNT])/10;    
  51.                 if(dmg_sum<Hero_Minimal_Dmg)
  52.                 {
  53.                     dmg_sum = Hero_Minimal_Dmg;
  54.                 };               
  55.             };
  56.         }
  57.         else if (HeroDamage_Damage_Edge)&&(!item.hp)
  58.         {
  59.             if(Hlp_Random(101)<=HeroDamage_CriticalChance)
  60.             {
  61.                 dmg_sum = ((att + HeroDamage_Damage_Edge)-target.protection[DAM_INDEX_BLUNT]);  
  62.                 if(dmg_sum<Hero_Minimal_Dmg)
  63.                 {
  64.                     dmg_sum = Hero_Minimal_Dmg;
  65.                 };             
  66.             }
  67.             else
  68.             {
  69.                 dmg_sum = ((att + HeroDamage_Damage_Edge)-target.protection[DAM_INDEX_BLUNT])/10;              
  70.             };
  71.                 if(dmg_sum<Hero_Minimal_Dmg)
  72.                 {
  73.                     dmg_sum = Hero_Minimal_Dmg;
  74.                 };
  75.         };
  76.    
  77.    
  78.  
  79.             if(dmg_sum>=1)
  80.             {
  81.                 if((target.guild < GIL_SEPERATOR_HUM) && (target.attribute[ATR_HITPOINTS]-dmg_sum <= 0) && (!Npc_IsInState(target,ZS_Unconscious)) && (target.aivar[AIV_DROPDEADANDKILL] == FALSE))
  82.                 {
  83.                     CALL_IntParam (0);
  84.                     CALL_IntParam (_@(hero));
  85.                     CALL__thiscall (_@(target), 7560880);
  86.                 }
  87.                 else if ((target.guild>=GIL_SEPERATOR_HUM)&&(target.attribute[ATR_HITPOINTS]-dmg_sum<=0))
  88.                 ||((target.aivar[AIV_DROPDEADANDKILL]) && (target.attribute[ATR_HITPOINTS]-dmg_sum<=0))
  89.                 {
  90.                     target.attribute[ATR_HITPOINTS]=0;
  91.                     CALL_IntParam (ocnpc_attacker);
  92.                     CALL__thiscall (target_ptr, 7563104);
  93.                     Npc_ClearAiQueue(target);      
  94.                     AI_StandUpQuick(target);
  95.                     CALL_IntParam (0);
  96.                     CALL__thiscall (target_ptr, 7563104);
  97.                     if(target.aivar[AIV_DEFEATEDBYPLAYER]==FALSE)
  98.                     {
  99.                         B_GivePlayerXP(target.level * XP_PER_VICTORY);    
  100.                         target.aivar[AIV_DEFEATEDBYPLAYER] = TRUE;
  101.                     }; 
  102.                 }
  103.                 else
  104.                 {
  105.                     target.attribute[ATR_HITPOINTS]-=dmg_sum;
  106.                     printdebug("L_HURTANI!");
  107.                     Npc_ClearAiQueue(target);      
  108.                     AI_PlayAni(target,"T_STUMBLE");
  109.                     Npc_SendSinglePerc      (hero,target,PERC_ASSESSDAMAGE);
  110.                     Npc_SendPassivePerc             (hero,PERC_ASSESSFIGHTSOUND,target,hero);
  111.                 };     
  112.             };
  113.         Snd_Play3D(hero,ConcatStrings("CS_IAM_ME_FL_A",IntToString(Hlp_Random(4)+1)));
  114. };
Advertisement
Add Comment
Please, Sign In to add comment