From a9c2d623a66f27674ea539963a8738138ca7f6aa Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 8 Feb 2006 16:56:53 +0000 Subject: - Cleaned up and reorganized status_change_start. Now it also receives the success % rate (0->100) - Added local function status_get_sc_tick which takes care of reducing the effect duration as need is be. - Modified status_get_sc_def to handle defense against all related statuses, now returns defense on a scale where 10000 is 100%. - Added time2 to pangvoice, it is the player effect's duration while time1 is for the mon's effect. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5227 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 0a88ddfc2..84c5c59e1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6066,7 +6066,7 @@ int buildin_sc_start(struct script_state *st) val4 = 1; //Mark that this was a thrown sc_effect } if (bl) - status_change_start(bl,type,val1,0,0,val4,tick,0); + status_change_start(bl,type,100,val1,0,0,val4,tick,0); return 0; } @@ -6093,8 +6093,8 @@ int buildin_sc_start2(struct script_state *st) val4 = 1; } - if(bl && rand()%10000 < per) - status_change_start(bl,type,val1,0,0,val4,tick,0); + if(bl) + status_change_start(bl,type,per/100,val1,0,0,val4,tick,0); return 0; } @@ -6124,7 +6124,7 @@ int buildin_sc_start4(struct script_state *st) tick/=2; } if (bl) - status_change_start(bl,type,val1,val2,val3,val4,tick,0); + status_change_start(bl,type,100,val1,val2,val3,val4,tick,0); return 0; } @@ -6153,7 +6153,7 @@ int buildin_sc_end(struct script_state *st) int buildin_getscrate(struct script_state *st) { struct block_list *bl; - int sc_def,type,rate; + int sc_def=0,type,rate; type=conv_num(st,& (st->stack->stack_data[st->start+2])); rate=conv_num(st,& (st->stack->stack_data[st->start+3])); @@ -6162,10 +6162,11 @@ int buildin_getscrate(struct script_state *st) else bl = map_id2bl(st->rid); - sc_def = status_get_sc_def(bl,type); + if (bl) + sc_def = status_get_sc_def(bl,type); - rate = rate * sc_def / 100; - push_val(st->stack,C_INT,rate); + rate = rate*(10000-sc_def)/10000; + push_val(st->stack,C_INT,rate<0?0:rate); return 0; -- cgit v1.2.3-70-g09d2