Jump to content
  • 0

Add a status change when getting hit


Question

Posted (edited)

Hi all.

 

I need to add a status change everytime a player is hit by a skill or a normal attack (that doesn't miss and does actual damage, even if it's bypassed through devotion). Under which function should I start this status change?

 

Thanks in advance.

Edited by Mikado

3 answers to this question

Recommended Posts

Posted (edited)

i think you can put it after every attack.

 

battle.c

struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int count)
{
	struct Damage d;
	switch(attack_type) {
	case BF_WEAPON: d = battle_calc_weapon_attack(bl,target,skill_id,skill_lv,count); break;
	case BF_MAGIC:  d = battle_calc_magic_attack(bl,target,skill_id,skill_lv,count);  break;
	case BF_MISC:   d = battle_calc_misc_attack(bl,target,skill_id,skill_lv,count);   break;
	default:
		ShowError("battle_calc_attack: unknown attack type! %d\n",attack_type);
		memset(&d,0,sizeof(d));
		break;
	}
	if( d.damage + d.damage2 < 1 )
	{	//Miss/Absorbed
		//Weapon attacks should go through to cause additional effects.
		if (d.dmg_lv == ATK_DEF /*&& attack_type&(BF_MAGIC|BF_MISC)*/) // Isn't it that additional effects don't apply if miss?
			d.dmg_lv = ATK_MISS;
		d.dmotion = 0;
	}
	else // Some skills like Weaponry Research will cause damage even if attack is dodged
		d.dmg_lv = ATK_DEF;

        // ->>> maybe put it here?
	return d;
}

 

just a thought tho. not so sure about it.

Edited by Jhedzkie
Posted

if you want to add a status to a attack that go trought put it in skill_additional_effet, this would be trigger only if dmg>0.

But your starting condition is quite big not sure that really what you wanna do.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...