[Release] Drain

Status
Not open for further replies.
Junior Spellweaver
Joined
Apr 10, 2008
Messages
131
Reaction score
45
I didn't see this around, so correct me if I missed something.

Drain will not increase your HP past your base maximum no matter what (important if you have HP equips) unless you apply this fix to it.

http://forum.ragezone.com/f427/release-making-server-recognize-hp-mp-equips-389451/

On to the code:
1. Open up Mobs.cpp
2. Find void Mobs::damageMobS
3. Replace with:
PHP:
void Mobs::damageMobS(Player* player, unsigned char* packet, int size){
    int itemid=0;
    int pos=getInt(packet+14);
    for(int i=0; i<player->inv->getItemNum(); i++){
        if(player->inv->getItem(i)->pos == pos && player->inv->getItem(i)->inv == 2){
            itemid = player->inv->getItem(i)->id;
            break;
        }
    }
    MobsPacket::damageMobS(player, Maps::info[player->getMap()].Players, packet, itemid);
    int howmany = packet[1]/0x10;
    int hits = packet[1]%0x10;
    int map = player->getMap();
    int skillid = getInt(packet+2);
    int mhp = -1;
    int totaldmg = 0;
    if(skillid > 0)
        Skills::useAttackSkill(player, skillid);
    for(int i=0; i<howmany; i++){
        int mobid = getInt(packet+19+i*(22+4*(hits-1)));
        for(int k=0; k<hits; k++){
            int damage = getInt(packet+37+i*(22+4*(hits-1))+k*4);
            for(unsigned int j=0; j<mobs[map].size(); j++){
                if(mobs[map][j]->getID() == mobid){
                    mobs[map][j]->setHP(mobs[map][j]->getHP()-damage);
                    mhp = -1;
                    totaldmg = totaldmg + damage;
                    mhp = mobinfo[mobs[map][j]->getMobID()].hp;
                    MobsPacket::showHP(player, mobid ,mobs[map][j]->getHP()*100/mhp);
                    if(mobs[map][j]->getHP() <= 0){
                        dieMob(player, mobs[map][j], j);
                    }
                break;
                }
            }
        }
    }
    if (skillid == 4101005 && totaldmg != 0) {
        int hpamt = Skills::skills[4101005][player->skills->getSkillLevel(4101005)].x;
        int healing = (int)((totaldmg * hpamt) / 100);
        unsigned short pmhp = player->getMHP();
        unsigned short php = player->getHP();
        if (healing > mhp) { healing = mhp; }
        if (healing > (pmhp / 2)) { healing = (pmhp / 2); }
        int healed = php + healing;
        if (healed > pmhp) { healed = pmhp; }
        player->setHP(healed);
    }
}
4. ????
5. PROFIT!

PHP:
Changes:

1. Moved
int mhp = -1;
outside the loop so as to increase the scope beyond the loop. Needed for later referencing.

2. Added
int totaldmg = 0;
for counting inside the loop for two reasons: One, to determine how much HP to gain and two, to determine if a hit actually occurred.

3. Added
mhp = -1;
inside the loop where it was originally initialized. No special reason other than not wanting to break it in case of unforeseen error.

4.  Added
totaldmg = totaldmg + damage;
inside the loop to count damage.

5. Added
	if (skillid == 4101005 && totaldmg != 0) {
		int hpamt = Skills::skills[4101005][player->skills->getSkillLevel(4101005)].x;
		int healing = (int)((totaldmg * hpamt) / 100);
		unsigned short pmhp = player->getMHP();
		unsigned short php = player->getHP();
		if (healing > mhp) { healing = mhp; }
		if (healing > (pmhp / 2)) { healing = (pmhp / 2); }
		int healed = php + healing;
		if (healed > pmhp) { healed = pmhp; }
		player->setHP(healed);
	}
to the end of the function. Obviously, everything that has to do with Drain.
 
Last edited:
Re: [Release] ~90% Functioning Drain

1/2 maxhp is always the upper limit regardless of shadowpartner or not

i remember when drain was @ 60% for lv30.. 90% with sp xD [could still only get 50% of maxhp though]

edit: nice release too btw ;)
 
Last edited:
Re: [Release] ~90% Functioning Drain

No lines in Skills.cpp are needed. Drain is an attack, not a buff or summon. The damage part of the attack already works, it only needs the HP healing effect.
 
Re: [Release] ~90% Functioning Drain

Drain + Shadow Partner = Same drain.

Tested it on my friends account.

Are you drunk?

This is what happens...

You use drain, it atks, gives you 60% of the dmg as health (or w.e %) and since you have on SP, it atks again with drain, and since its SP, you get half of the hp as you did before.

So say you atked, and did 3000 dmg. you would get 1800 HP back, and would get 900 from sp so you would get a total of 2700 HP back. So I would say SP does make a difference. (Also, drain hits at a % of your normal atk, so normally you wouldnt do that much dmg.)
 
That's what

if (healing > mhp) { healing = mhp; }

does. mhp is defined in the loop as the mob's HP.

oh wasn't paying attention just skimmed your code lol
but from what I can tell w/o running the code if you did drain and it didn't hit anything mhp would be -1 so your healing = -1 as well?
 
Re: [Release] ~90% Functioning Drain

Are you drunk?

This is what happens...

You use drain, it atks, gives you 60% of the dmg as health (or w.e %) and since you have on SP, it atks again with drain, and since its SP, you get half of the hp as you did before.

So say you atked, and did 3000 dmg. you would get 1800 HP back, and would get 900 from sp so you would get a total of 2700 HP back. So I would say SP does make a difference. (Also, drain hits at a % of your normal atk, so normally you wouldnt do that much dmg.)

ROFL! It'll throw the extra star, it'll do damage, but it won't heal you.
 
Re: [Release] ~90% Functioning Drain

ROFL! It'll throw the extra star, it'll do damage, but it won't heal you.

wrong

drain heals 45% (at max) and SP will heal for 22.5% [total of 67.5% of dmg]

if youve spent any time at all playing an assassin/hermit/nightlord you would know this (which clearly you havent)

edit: i figured id explain a little more..

before 3rd job was released drain was set at 60% healing.. then along comes SP and suddenly hermits could heal 90% of their damage (which basically meant every drain would heal the maximum of 1/2 of their maxhp).. in response to this NEXON lowered drains healing % down to 45
 
Err. I'm not quite certain what you're referring to. If you're referring to the amount of HP it heals, no. It's not 100%. If you're referring to its completion status, yes. It is complete.

Technically, Nexon didn't have full control of the game until well after 3rd job came out. They also nerfed Lucky Seven after 3rd job came out. I remember the massive bitchfest that was Assassins/Hermits after the 3rd job patch. Ahh, nostalgia.
 
Status
Not open for further replies.
Back