Skill damage fixed
Posted: 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
Replace entire function with
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.
This is working fine now.
in battle.cpp
find
- // use skill attack
- void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill )
Replace entire function with
- // use skill attack
- void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill )
- {
- long int skillpower = skill->atkpower + (long int)floor(((double)GetInt( )/2));
- skillpower -= Enemy->Stats->Magic_Defense;
- bool bflag = false;
- Enemy->OnBeAttacked( this );
- if(skillpower<=0) skillpower = 0;
- if(IsPlayer())
- {
- skillpower+=((skillpower*(Stats->ExtraDamage))/100);
- }
- if(!Enemy->IsSummon( ) && Enemy->IsMonster( ))
- {
- Enemy->AddDamage( this, skillpower );
- }
- Enemy->Stats->HP -= skillpower;
- BEGINPACKET( pak, 0x7b6 );
- ADDWORD ( pak, Enemy->clientid );
- ADDWORD ( pak, clientid );
- ADDDWORD ( pak, 0x000007f8 );
- ADDBYTE ( pak, 0x00 );
- if (Enemy->Stats->HP<1)
- {
- ADDWORD ( pak, skillpower+0x8000 );
- }
- else
- {
- ADDWORD ( pak, skillpower+0x2000 );
- }
- if(Enemy->IsDead())
- {
- CDrop* thisdrop = NULL;
- ADDDWORD ( pak, 16 );
- if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
- {
- thisdrop = Enemy->GetDrop( );
- if(thisdrop!=NULL)
- {
- ADDFLOAT ( pak, thisdrop->pos.x*100 );
- ADDFLOAT ( pak, thisdrop->pos.y*100 );
- if(thisdrop->type==1)
- {
- ADDWORD( pak, 0xccdf );
- ADDDWORD( pak, thisdrop->amount );
- }
- else
- {
- ADDWORD ( pak, GServer->BuildItemHead( thisdrop->item ) );
- ADDDWORD ( pak, GServer->BuildItemData( thisdrop->item ) );
- }
- ADDWORD ( pak, thisdrop->clientid );
- ADDWORD ( pak, thisdrop->owner );
- CMap* map = GServer->MapList.Index[thisdrop->posMap];
- map->AddDrop( thisdrop );
- }
- }
- GServer->SendToVisible( &pak, Enemy, thisdrop );
- OnEnemyDie( Enemy );
- }
- else
- {
- ADDDWORD ( pak, 4 );
- GServer->SendToVisible( &pak, Enemy );
- bflag = GServer->AddDeBuffs( skill, Enemy, GetInt( ) );
- if(skill->nbuffs>0 && bflag)
- {
- BEGINPACKET( pak, 0x7b5 );
- ADDWORD ( pak, Battle->skilltarget );
- ADDWORD ( pak, clientid );
- ADDWORD ( pak, Battle->skillid );
- ADDBYTE ( pak, GetInt( ) );
- GServer->SendToVisible( &pak, Enemy );
- }
- }
- RESETPACKET( pak, 0x7b9);
- ADDWORD ( pak, clientid);
- ADDWORD ( pak, Battle->skillid);
- GServer->SendToVisible( &pak, this );
- }
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.