Jump to content
  • 0
karazu

Critical Strike on Magic

Question

Please convert this to a plugin

http://rathena.org/board/topic/71862-critical-hit-on-magic-2/
 

Index: src/map/mob.h===================================================================--- src/map/mob.h	(revision 16936)+++ src/map/mob.h	(working copy)@@ -123,6 +123,7 @@ 	struct block_list bl; 	struct unit_data  ud; 	struct view_data *vd;+	struct tmp_data tmpd; 	struct status_data status, *base_status; //Second one is in case of leveling up mobs, or tiny/large mobs. 	struct status_change sc; 	struct mob_db *db;	//For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex]Index: src/map/pc.h===================================================================--- src/map/pc.h	(revision 16936)+++ src/map/pc.h	(working copy)@@ -91,6 +91,7 @@ 	struct block_list bl; 	struct unit_data ud; 	struct view_data vd;+	struct tmp_data tmpd; 	struct status_data base_status, battle_status; 	struct status_change sc; 	struct regen_data regen;Index: src/map/skill.c===================================================================--- src/map/skill.c	(revision 16936)+++ src/map/skill.c	(working copy)@@ -2110,7 +2110,38 @@  	return 0; }-+int skill_mcri_hit(int tid, unsigned int tick, int id, intptr_t data)+{+	struct mob_data *md = (struct mob_data *)data;+	struct tmp_data *tmpd;+	tmpd = &md->tmpd;+	if(tmpd!=NULL)+	{+	switch(1) // 1 = red ; 2 = blue+	{+	case 1:+		clif_damage(tmpd->src, tmpd->bl, gettick(), 1, 1, id, 0, 10, 0);+		break;+	case 2:+		clif_skill_damage(tmpd->src,tmpd->bl,gettick(), 1, 1, id, 0, TK_STORMKICK, 1, 8);+		clif_skill_nodamage(tmpd->src,tmpd->src,tmpd->num[0],tmpd->num[1],1);+		break;+	}+	}+	return 0;+}+int skill_mcri_kill_delay(int tid, unsigned int tick, int id, intptr_t data)+{+	struct block_list *bl = map_id2bl(id);+	struct block_list *src = (struct block_list *)data;+	struct mob_data *md = BL_CAST(BL_MOB, bl);+	if(bl!=NULL)+	{+		mob_dead(md,src,0);+		status_kill(bl);+	}+	return 0;+} /*  * =========================================================================  * Does a skill attack with the given properties.@@ -2449,6 +2480,48 @@ 	default: 		if( flag&SD_ANIMATION && dmg.div_ < 2 ) //Disabling skill animation doesn't works on multi-hit. 			type = 5;+		//m_cri+		if ( src->type == BL_PC || battle_get_master(src)->type == BL_PC )+		{+			char m_cri = 0;+			if(sd==NULL)+				m_cri = cap_value(map_id2sd(battle_get_master(src)->id)->battle_status.cri/10,1,100);+			else+				m_cri = cap_value(sd->battle_status.cri/10,1,100);+			if( rand()%100 < m_cri )+			{+				struct mob_data *md=NULL;+				struct tmp_data *tmpd=NULL;+				int d_ = 200;+				unsigned int u_ = 0;+				int i=0, num=abs(skill_get_num(skillid,skilllv)), _damage=0;+				damage *= 2;				+				md = mob_once_spawn_sub(src, src->m, src->x, src->y, "--en--",1083,"", SZ_SMALL, AI_NONE);+				md->deletetimer=add_timer(tick+d_*num+1,mob_timer_delete,md->bl.id,0);+				status_set_viewdata(&md->bl, INVISIBLE_CLASS);+				tmpd = &md->tmpd;				+				if(skill_get_splash(skillid,skilllv)>1&&num>1)+					num = 1;+				_damage = damage/num;+				tmpd->src = src;+				tmpd->bl = bl;+				tmpd->num[0]=skillid;+				tmpd->num[1]=skilllv;+				u_ = tick+d_*num+1;+				if( tstatus->hp <= damage )//delay to kill it+				{+					damage = 1;+					status_change_start(bl, SC_BLADESTOP_WAIT, 10000, 1, 0, 0, 0, u_, 2);+					status_change_start(bl, SC_INVINCIBLE, 10000, 1, 0, 0, 0, u_, 2);+					add_timer(u_,skill_mcri_kill_delay,bl->id,(intptr_t)src);+				}+				clif_skill_nodamage(src,src,skillid,skilllv,1);+				for(i=0;i<num;i++)+					add_timer(tick+d_*i +1,skill_mcri_hit,_damage,(intptr_t)md);+				u_ = d_ = _damage = 0;+				break;+			}+		} 		if( bl->type == BL_SKILL ){ 			TBL_SKILL *su = (TBL_SKILL*)bl; 			if( su->group && skill_get_inf2(su->group->skill_id)&INF2_TRAP )// show damage on trap targetsIndex: src/map/skill.h===================================================================--- src/map/skill.h	(revision 16936)+++ src/map/skill.h	(working copy)@@ -21,7 +21,8 @@ #define MAX_SKILL_IMPROVISE_DB 50  #define MAX_SKILL_LEVEL 100-+int skill_mcri_hit(int tid, unsigned int tick, int _damage, intptr_t data);+int skill_mcri_kill_delay(int tid, unsigned int tick, int id, intptr_t data); //Constants to identify the skill's inf value: enum e_skill_inf {Index: src/map/unit.h===================================================================--- src/map/unit.h	(revision 16936)+++ src/map/unit.h	(working copy)@@ -13,7 +13,11 @@ #include "map.h" // struct block_list #include "path.h" // struct walkpath_data #include "skill.h" // struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset-+struct tmp_data {+	struct block_list *src;+	struct block_list *bl;+	int num[2];+}; struct unit_data { 	struct block_list *bl; 	struct walkpath_data walkpath;

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.