summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 0e8a054e7..57e02ff9c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4327,8 +4327,7 @@ int buildin_sc_end(struct script_state *st)
int buildin_getscrate(struct script_state *st)
{
struct block_list *bl;
- int sc_def=100,sc_def_mdef2,sc_def_vit2,sc_def_int2,sc_def_luk2;
- int type,rate,luk;
+ int sc_def,type,rate;
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
rate=conv_num(st,& (st->stack->stack_data[st->start+3]));
@@ -4337,22 +4336,9 @@ int buildin_getscrate(struct script_state *st)
else
bl = map_id2bl(st->rid);
- luk = status_get_luk(bl);
- sc_def_mdef2=100 - (3 + status_get_mdef(bl) + luk/3);
- sc_def_vit2=100 - (3 + status_get_vit(bl) + luk/3);
- sc_def_int2=100 - (3 + status_get_int(bl) + luk/3);
- sc_def_luk2=100 - (3 + luk);
-
- if(type==SC_STONE || type==SC_FREEZE)
- sc_def=sc_def_mdef2;
- else if(type==SC_STAN || type==SC_POISON || type==SC_SILENCE)
- sc_def=sc_def_vit2;
- else if(type==SC_SLEEP || type==SC_CONFUSION || type==SC_BLIND)
- sc_def=sc_def_int2;
- else if(type==SC_CURSE)
- sc_def=sc_def_luk2;
-
- rate=rate*sc_def/100;
+ sc_def = status_get_sc_def(bl,type);
+
+ rate = rate * sc_def / 100;
push_val(st->stack,C_INT,rate);
return 0;