Log in

View Full Version : Fix: Lifetaps


neotokyo
11-15-2002, 11:35 AM
add this function somewhere in the attack.cpp


// neotokyo 14-Nov-02
// Helperfunction to check for Lifetaps
bool IsLifetapSpell(int16 spell_id)
{
// filter out invalid spell_ids
if (spell_id <= 0 || spell_id >= 0xffff)
return false;

// if database says its a tap, i am sure its right
if (spells[spell_id].targettype == ST_Tap)
return true;

// now check some additional lifetaps just to make sure
// i.e. lifebane isnt recognized since type == target not tap
switch(spell_id)
{
case 1613:
case 341:
case 445:
case 502:
case 447:
case 525:
case 2115: // Ancient: Lifebane
case 446:
case 524:
case 1618:
case 1393: // Gangrenous touch of zu'muul
case 1735: // trucidation
return true;
}
return false;
}


add this snippet of code into the same file, into function
"NPC:Damage" just before the check for Death (1st return in the function) and after the "was hit by non melee" message.


// if spell is lifetap add hp to the caster
if (other && IsLifetapSpell( spell_id ))
{
int32 healedhp;

// check if healing would be greater than max hp
// use temp var to store actual healing value
if ( other->GetHP() + damage > other->GetMaxHP())
{
healedhp = other->GetMaxHP() - other->GetHP();
other->SetHP(other->GetMaxHP());
}
else
{
healedhp = damage;
other->SetHP(other->GetHP() + damage);
}

// not sure if i need to send this or not. didnt hurt yet though ;-)
APPLAYER hp_app;
other->CreateHPPacket(&hp_app);

// if client was casting the spell there need to be some messages
if (other->IsClient())
{
other->CastToClient()->Message(4,"You have been healed for %d points of damage.", healedhp);
other->CastToClient()->QueuePacket(&hp_app);
}

// emote goes with every one ... even npcs
entity_list.MessageClose(this, true, 300, MT_Emote, "%s beams a smile at %s", other->GetName(), this->GetName() );
entity_list.QueueCloseClients(this, &hp_app, false, 600, other);
}


and remove these lines of code in the same function -> obsolete

else if (attack_skill == 0x231)
{
if (spell_id != 0xFFFF && spell_id != 0)
{
if (spells[spell_id].targettype == ST_Tap)
{
other->SetHP(GetHP() + damage);
}
}
}


this doesnt cover PVP yet (i guess - couldnt test it cause no one joined my test server ;-) just normal Player vs Mobs Combat, but should include lifetap procs

have fun...

quester
11-15-2002, 12:19 PM
AWESOME!

This is one of those areas I really wanted to see working, but had enough on my plate as it is lol.

How about lookign at the hp-to-mana spells now :D

Does this mod cover lifetap over time spells, like leach, etc?

neotokyo
11-16-2002, 03:18 AM
since verant decided to do the dot-taps quite differently the answer to your question is: No.

but dont panic. the lifetaps-over-time are working if you implemented the Recourse-Spell-Fix i posted a few days back.

Trumpcard
11-16-2002, 03:32 AM
Hmm.. Havent rolled that one into my changes..

Neo, how about downloading my changed files from the other thread and rolling your changes for recourse and what not into them and reattatching it to the thread..

neotokyo
11-16-2002, 04:02 AM
do i need webspace for this?
if yes - any reliable free webspace provider around?

Trumpcard
11-16-2002, 04:28 AM
Naa, you can just attach it through your browser when paste a message, use the attatch button underneath your reply..

Just add .txt to the file extension..

Like so..