Skill damage fixed

Submit code for osProse project.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Skill damage fixed

Postby PurpleYouko on Tue May 13, 2008 7:08 pm

I can't remember precisely what was changed here so i will just give you the whole function.
This is working fine now.

in battle.cpp
find
  1.  
  2. // use skill attack
  3. void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill )
  4.  

Replace entire function with
  1.  
  2. // use skill attack
  3. void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill )
  4. {
  5.     long int skillpower = skill->atkpower + (long int)floor(((double)GetInt( )/2));
  6.     skillpower -= Enemy->Stats->Magic_Defense;
  7.     bool bflag = false;          
  8.     Enemy->OnBeAttacked( this );  
  9.     if(skillpower<=0) skillpower = 0;
  10.     if(IsPlayer())
  11.     {
  12.         skillpower+=((skillpower*(Stats->ExtraDamage))/100);
  13.     }
  14.     if(!Enemy->IsSummon( ) && Enemy->IsMonster( ))
  15.     {
  16.         Enemy->AddDamage( this, skillpower );
  17.     }
  18.     Enemy->Stats->HP -= skillpower;  
  19.     BEGINPACKET( pak, 0x7b6 );
  20.     ADDWORD    ( pak, Enemy->clientid );            
  21.     ADDWORD    ( pak, clientid );
  22.     ADDDWORD   ( pak, 0x000007f8 );
  23.     ADDBYTE    ( pak, 0x00 );
  24.     if (Enemy->Stats->HP<1)
  25.     {
  26.         ADDWORD   ( pak, skillpower+0x8000 );
  27.     }
  28.     else
  29.     {
  30.         ADDWORD   ( pak, skillpower+0x2000 );
  31.     }
  32.     if(Enemy->IsDead())
  33.     {
  34.         CDrop* thisdrop = NULL;
  35.         ADDDWORD   ( pak, 16 );  
  36.         if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
  37.         {
  38.             thisdrop = Enemy->GetDrop( );
  39.             if(thisdrop!=NULL)
  40.             {                
  41.                 ADDFLOAT   ( pak, thisdrop->pos.x*100 );
  42.                 ADDFLOAT   ( pak, thisdrop->pos.y*100 );    
  43.                 if(thisdrop->type==1)
  44.                 {                        
  45.                     ADDWORD( pak, 0xccdf );
  46.                     ADDDWORD( pak, thisdrop->amount );                        
  47.                 }
  48.                 else
  49.                 {
  50.                     ADDWORD   ( pak, GServer->BuildItemHead( thisdrop->item ) );
  51.                     ADDDWORD   ( pak, GServer->BuildItemData( thisdrop->item ) );
  52.                 }
  53.                 ADDWORD    ( pak, thisdrop->clientid );                    
  54.                 ADDWORD    ( pak, thisdrop->owner );  
  55.                 CMap* map = GServer->MapList.Index[thisdrop->posMap];
  56.                 map->AddDrop( thisdrop );
  57.             }
  58.         }
  59.         GServer->SendToVisible( &pak, Enemy, thisdrop );        
  60.         OnEnemyDie( Enemy );        
  61.     }
  62.     else
  63.     {
  64.         ADDDWORD   ( pak, 4 );
  65.         GServer->SendToVisible( &pak, Enemy );  
  66.         bflag = GServer->AddDeBuffs( skill, Enemy, GetInt( ) );
  67.         if(skill->nbuffs>0 && bflag)
  68.         {
  69.             BEGINPACKET( pak, 0x7b5 );
  70.             ADDWORD    ( pak, Battle->skilltarget );
  71.             ADDWORD    ( pak, clientid );    
  72.             ADDWORD    ( pak, Battle->skillid );
  73.             ADDBYTE    ( pak, GetInt( ) );
  74.             GServer->SendToVisible( &pak, Enemy );
  75.         }  
  76.     }                  
  77.     RESETPACKET( pak, 0x7b9);
  78.     ADDWORD    ( pak, clientid);
  79.     ADDWORD    ( pak, Battle->skillid);
  80.     GServer->SendToVisible( &pak, this );           
  81. }


With this, you get the correct damage sent when you use an attack skill so you no longer get annoying undead zombie monsters chasing you around and refusing to die till you leave the map.
The problem was that the wrong damage value was being sent in the skill packet so the client did not recognize that the monster had died, even though the server had long since moved on.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Skill damage fixed

Postby Blah4 on Tue May 13, 2008 7:14 pm

Wow nice, this bug haas been annoying me forqutie some time.
Blah4
ospRose dev team
ospRose dev team
 
Posts: 199
Joined: Sun Jan 06, 2008 12:05 pm
Location: The Netherlands

Re: Skill damage fixed

Postby pepu on Tue May 13, 2008 7:54 pm

I was investigating on this, and didn´t find the error!!, thx purple :P
pepu
ospRose dev team
ospRose dev team
 
Posts: 283
Joined: Mon Feb 04, 2008 10:12 pm
Location: ESPAÑA(Aranjuez)

Re: Skill damage fixed

Postby amaedict on Thu Jun 04, 2009 1:52 pm

this exact bug exists in osrose still.

but code different, cannot use above code. get compile errors.
We Have it all ... Image
Image
User avatar
amaedict
Clown
Clown
 
Posts: 531
Joined: Thu Apr 23, 2009 2:44 pm


Return to Submit Code

Who is online

Users browsing this forum: No registered users and 7 guests