Jump to content
Sign in to follow this  
karazu

Critical Strike on Magic

Recommended Posts

Converted by Angelmelody:
http://herc.ws/board/user/98-angelmelody/ 
       
Fixed by Dastgir:
http://herc.ws/board/user/48-dastgir/                             

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

Original Author: Goddameit
http://rathena.org/board/user/477-goddameit/



Video

 

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, int64 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, 1, 1, id, 0, 10, 0);          +		break;+	case 2:+		clif->skill_damage(tmpd->src,tmpd->bl,timer->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, int64 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)+	{+		if (md != 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(skill_id,skill_lv)), _damage=0;+				damage *= 2;				+				md = mob->once_spawn_sub(src, src->m, src->x, src->y, "--en--",1083,"", SZ_SMALL, AI_NONE);+				md->deletetimer=timer->add(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(skill_id,skill_lv)>1&&num>1)+					num = 1;+				_damage = damage/num;+				tmpd->src = src;+				tmpd->bl = bl;+				tmpd->num[0]=skill_id;+				tmpd->num[1]=skill_lv;+				u_ = tick+d_*num+1;+				if( tstatus->hp <= damage )//delay to kill it+				{+					damage = 1;+					status->change_start(NULL, bl, SC_BLADESTOP_WAIT, 10000, 1, 0, 0, 0, u_, 2);   +					status->change_start(NULL, bl, SC_INVINCIBLE, 10000, 1, 0, 0, 0, u_, 2);              +					timer->add(u_,skill_mcri_kill_delay,bl->id,(intptr_t)src);+				}+				clif->skill_nodamage(src,src,skill_id,skill_lv,1);+				for(i=0;i<num;i++)+					timer->add(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, int64 tick, int _damage, intptr_t data);+int skill_mcri_kill_delay(int tid, int64 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; 
Edited by karazu

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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