summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c22
-rw-r--r--src/map/skill.c70
-rw-r--r--src/map/status.c61
-rw-r--r--src/map/status.h6
4 files changed, 90 insertions, 69 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;
diff --git a/src/map/skill.c b/src/map/skill.c
index 8c2ff23be..000025e08 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1045,7 +1045,7 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s
struct pet_data *pd=NULL;
int skill,skill2;
- int rate,luk;
+ int rate;
int sc_def_mdef,sc_def_vit,sc_def_int,sc_def_luk;
int sc_def_mdef2,sc_def_vit2,sc_def_int2,sc_def_luk2;
@@ -1064,44 +1064,23 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s
nullpo_retr(0, pd = (struct pet_data *)src); // [Valaris]
}
+ if(bl->type == BL_PC) {
+ nullpo_retr(0, dstsd=(struct map_session_data *)bl);
+ } else if(bl->type == BL_MOB) {
+ nullpo_retr(0, dstmd=(struct mob_data *)bl); //未使用?
+ }
+
//?象の耐性
- luk = status_get_luk(bl);
- sc_def_mdef=100 - (3 + status_get_mdef(bl) + luk/3);
- sc_def_vit=100 - (3 + status_get_vit(bl) + luk/3);
- sc_def_int=100 - (3 + status_get_int(bl) + luk/3);
- sc_def_luk=100 - (3 + luk);
+ sc_def_mdef = status_get_sc_def_mdef(bl);
+ sc_def_vit = status_get_sc_def_vit(bl);
+ sc_def_int = status_get_sc_def_int(bl);
+ sc_def_luk = status_get_sc_def_luk(bl);
+
//自分の耐性
- luk = status_get_luk(src);
- sc_def_mdef2=100 - (3 + status_get_mdef(src) + luk/3);
- sc_def_vit2=100 - (3 + status_get_vit(src) + luk/3);
- sc_def_int2=100 - (3 + status_get_int(src) + luk/3);
- sc_def_luk2=100 - (3 + luk);
- if(bl->type==BL_PC)
- dstsd=(struct map_session_data *)bl;
- else if(bl->type==BL_MOB){
- dstmd=(struct mob_data *)bl; //未使用?
- if(sc_def_mdef<50)
- sc_def_mdef=50;
- if(sc_def_vit<50)
- sc_def_vit=50;
- if(sc_def_int<50)
- sc_def_int=50;
- if(sc_def_luk<50)
- sc_def_luk=50;
- }
- if (dstsd && dstsd->sc_count && dstsd->sc_data[SC_GOSPEL].timer != -1 &&
- dstsd->sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
- dstsd->sc_data[SC_GOSPEL].val3 == 3) {
- sc_def_mdef -= 25;
- sc_def_vit -= 25;
- sc_def_int -= 25;
- }
- if(sc_def_mdef<0)
- sc_def_mdef=0;
- if(sc_def_vit<0)
- sc_def_vit=0;
- if(sc_def_int<0)
- sc_def_int=0;
+ sc_def_mdef2 = status_get_sc_def_mdef(src);
+ sc_def_vit2 = status_get_sc_def_vit(src);
+ sc_def_int2 = status_get_sc_def_int(src);
+ sc_def_luk2 = status_get_sc_def_luk(src);
switch(skillid){
case 0: /* 通常攻? */
@@ -2674,7 +2653,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
{
struct status_change *sc_data = status_get_sc_data(bl);
int sc_def_mdef, rate, damage;
- sc_def_mdef = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
+ sc_def_mdef = status_get_sc_def_mdef(bl);
rate = (skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15;
rate = rate<=5?5:rate;
if (sc_data && sc_data[SC_FREEZE].timer != -1) {
@@ -2957,23 +2936,14 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
sc_dex=status_get_mdef(bl);
sc_luk=status_get_luk(bl);
- sc_def_vit = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
- //sc_def_vit = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
- sc_def_mdef = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
+ sc_def_vit = status_get_sc_def_vit(bl);
+ sc_def_mdef = status_get_sc_def_mdef (bl);
if(bl->type==BL_PC){
nullpo_retr(1, dstsd=(struct map_session_data *)bl);
}else if(bl->type==BL_MOB){
nullpo_retr(1, dstmd=(struct mob_data *)bl);
- if(sc_def_vit>50)
- sc_def_vit=50;
- if(sc_def_mdef>50)
- sc_def_mdef=50;
- }
- if(sc_def_vit < 0)
- sc_def_vit=0;
- if(sc_def_mdef < 0)
- sc_def_mdef=0;
+ }
if(bl == NULL || bl->prev == NULL)
return 1;
diff --git a/src/map/status.c b/src/map/status.c
index f3c022fe0..35b2baaff 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2559,6 +2559,65 @@ short *status_get_option(struct block_list *bl)
return 0;
}
+int status_get_sc_def(struct block_list *bl, int type)
+{
+ int sc_def;
+ nullpo_retr(0, bl);
+
+ switch (type)
+ {
+ case SP_MDEF1: // mdef
+ sc_def = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
+ break;
+ case SP_MDEF2: // int
+ sc_def = 100 - (3 + status_get_int(bl) + status_get_luk(bl)/3);
+ break;
+ case SP_DEF1: // def
+ sc_def = 100 - (3 + status_get_def(bl) + status_get_luk(bl)/3);
+ break;
+ case SP_DEF2: // vit
+ sc_def = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
+ break;
+ case SP_LUK: // luck
+ sc_def = 100 - (3 + status_get_luk(bl));
+ break;
+
+ case SC_STONE:
+ case SC_FREEZE:
+ sc_def = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
+ break;
+ case SC_STAN:
+ case SC_POISON:
+ case SC_SILENCE:
+ sc_def = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
+ break;
+ case SC_SLEEP:
+ case SC_CONFUSION:
+ case SC_BLIND:
+ sc_def = 100 - (3 + status_get_int(bl) + status_get_luk(bl)/3);
+ break;
+ case SC_CURSE:
+ sc_def = 100 - (3 + status_get_luk(bl));
+ break;
+
+ default:
+ sc_def = 100;
+ break;
+ }
+
+ if(bl->type == BL_MOB && sc_def < 50)
+ sc_def = 50;
+ else if(bl->type == BL_PC) {
+ struct status_change* sc_data = status_get_sc_data(bl);
+ if (sc_data && sc_data[SC_GOSPEL].timer != -1 &&
+ sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+ sc_data[SC_GOSPEL].val3 == 3)
+ sc_def -= 25;
+ }
+
+ return (sc_def < 0) ? 0 : sc_def;
+}
+
/*==========================================
* ステータス異常開始
*------------------------------------------
@@ -3077,7 +3136,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
break;
case SC_STAN: /* スタン(val2にミリ秒セット) */
if(!(flag&2)) {
- int sc_def = 100 - (status_get_vit(bl) + status_get_luk(bl)/3);
+ int sc_def = status_get_sc_def_vit(bl);
tick = tick * sc_def / 100;
}
break;
diff --git a/src/map/status.h b/src/map/status.h
index 513458822..6ef1d4bb5 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -54,6 +54,12 @@ int status_get_atk_(struct block_list *bl);
int status_get_atk_2(struct block_list *bl);
int status_get_atk2(struct block_list *bl);
+int status_get_sc_def(struct block_list *bl, int type);
+#define status_get_sc_def_mdef(bl) (status_get_sc_def(bl, SP_MDEF1))
+#define status_get_sc_def_vit(bl) (status_get_sc_def(bl, SP_DEF2))
+#define status_get_sc_def_int(bl) (status_get_sc_def(bl, SP_MDEF2))
+#define status_get_sc_def_luk(bl) (status_get_sc_def(bl, SP_LUK))
+
// 状態異常関連 skill.c より移動
int status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag);
int status_change_end( struct block_list* bl , int type,int tid );