summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c54
1 files changed, 35 insertions, 19 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 7872771b9..1dd982372 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3839,6 +3839,8 @@ int status_get_sc_def(struct block_list *bl, int type)
int sc_def;
struct status_data* status;
struct status_change* sc;
+ struct map_session_data *sd;
+
nullpo_retr(0, bl);
//Status that are blocked by Golden Thief Bug card or Wand of Hermod
@@ -3877,16 +3879,16 @@ int status_get_sc_def(struct block_list *bl, int type)
case SC_DPOISON:
case SC_SILENCE:
case SC_BLEEDING:
- sc_def = 300 +100*status->vit +10*status->luk;
+ sc_def = 300 +100*status->vit;
break;
case SC_SLEEP:
- sc_def = 300 +100*status->int_ +10*status->luk;
+ sc_def = 300 +100*status->int_;
break;
case SC_STONE:
case SC_FREEZE:
case SC_DECREASEAGI:
case SC_COMA:
- sc_def = 300 +100*status->mdef +10*status->luk;
+ sc_def = 300 +100*status->mdef;
break;
case SC_CURSE:
if (status->luk > status_get_lv(bl))
@@ -3895,21 +3897,44 @@ int status_get_sc_def(struct block_list *bl, int type)
sc_def = 300 +100*status->luk;
break;
case SC_BLIND: //TODO: These 50/50 factors are guessed. Need to find actual value.
- sc_def = 300 +50*status->vit +50*status->int_ +10*status->luk;
+ sc_def = 300 +50*status->vit +50*status->int_;
break;
case SC_CONFUSION:
- sc_def = 300 +50*status->str +50*status->int_ +10*status->luk;
+ sc_def = 300 +50*status->str +50*status->int_;
break;
default:
return 0; //Effect that cannot be reduced? Likely a buff.
}
- if (bl->type == BL_PC) {
+ BL_CAST(BL_PC,bl,sd);
+
+ if (sd) {
+
if (battle_config.pc_sc_def_rate != 100)
sc_def = sc_def*battle_config.pc_sc_def_rate/100;
- } else
- if (battle_config.mob_sc_def_rate != 100)
- sc_def = sc_def*battle_config.mob_sc_def_rate/100;
+
+ if(SC_COMMON_MIN<=type && type<=SC_COMMON_MAX
+ && sd->reseff[type-SC_COMMON_MIN] > 0)
+ sc_def+= sd->reseff[type-SC_COMMON_MIN];
+
+ if (sc_def < battle_config.pc_max_sc_def)
+ sc_def += (battle_config.pc_max_sc_def - sc_def)*
+ status->luk/battle_config.pc_luk_sc_def;
+ else
+ sc_def = battle_config.pc_max_sc_def;
+
+ } else {
+
+ if (battle_config.mob_sc_def_rate != 100)
+ sc_def = sc_def*battle_config.mob_sc_def_rate/100;
+
+ if (sc_def < battle_config.mob_max_sc_def)
+ sc_def += (battle_config.mob_max_sc_def - sc_def)*
+ status->luk/battle_config.mob_luk_sc_def;
+ else
+ sc_def = battle_config.mob_max_sc_def;
+
+ }
sc = status_get_sc(bl);
if (sc && sc->count)
@@ -3920,13 +3945,7 @@ int status_get_sc_def(struct block_list *bl, int type)
sc_def += 100*sc->data[SC_SIEGFRIED].val3; //Status resistance.
}
- if(bl->type == BL_PC) {
- if (sc_def > battle_config.pc_max_sc_def)
- sc_def = battle_config.pc_max_sc_def;
- } else if (sc_def > battle_config.mob_max_sc_def)
- sc_def = battle_config.mob_max_sc_def;
-
- return sc_def;
+ return sc_def>10000?10000:sc_def;
}
//Reduces tick delay based on type and character defenses.
@@ -4058,9 +4077,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
if (!(flag&(4|1))) {
int def;
def = flag&8?0:status_get_sc_def(bl, type); //recycling race to store the sc_def value.
- //sd resistance applies even if the flag is &8
- if(sd && SC_COMMON_MIN<=type && type<=SC_COMMON_MAX && sd->reseff[type-SC_COMMON_MIN] > 0)
- def+= sd->reseff[type-SC_COMMON_MIN];
if (def)
rate -= rate*def/10000;