PenUltima Online

It is currently Sat Sep 06, 2008 1:35 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Critical bug in combat system [current 96 svn]
PostPosted: Sun Jan 14, 2007 1:33 pm 
Offline

Joined: Thu Dec 28, 2006 11:52 am
Posts: 80
while i was looking at the distro attackhook i noticed a little, but critical bug that practically breaks the whole hook...

in this function

Code:
function GetArmorHit(byref d_info)
   var hit_zone := CS_GetRandomArmorZone();
   var armor_hit := CS_GetEquipmentInArmorZone(d_info.mobile, hit_zone);

   if ( armor_hit.Size() < 1 )
      return 0;
   endif

   var best_armor := 0;
   foreach item in ( armor_hit )
      if ( item.ar > best_armor.ar )
         best_armor := item;
      endif
      SleepMS(2);
   endforeach

   return best_armor;
endfunction


there is var best_armor := 0; and then if ( item.ar > best_armor.ar )

which is terribily wrong, and causes the function to return 0 nearly always, and with 0 armor you get huge damage...

so this is the fixed function:

Code:
function GetArmorHit(byref d_info)
   var hit_zone := CS_GetRandomArmorZone();
   var armor_hit := CS_GetEquipmentInArmorZone(d_info.mobile, hit_zone);

   if ( armor_hit.Size() < 1 )
      return 0;
   endif

   var best_armor := armor_hit[1];
   foreach item in ( armor_hit )
      if ( item.ar > best_armor.ar )
         best_armor := item;
      endif
      SleepMS(2);
   endforeach

   return best_armor;
endfunction


cheers


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 26, 2007 7:39 pm 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
Just for my own notes, this has been fixed (a long time ago).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl