diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 13 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/status.c | 54 |
3 files changed, 46 insertions, 23 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index c9245e7fa..7ca35dc6e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3560,6 +3560,8 @@ static const struct battle_data_short { { "status_cast_cancel", &battle_config.sc_castcancel }, { "pc_status_def_rate", &battle_config.pc_sc_def_rate }, { "mob_status_def_rate", &battle_config.mob_sc_def_rate }, + { "pc_luk_status_def", &battle_config.pc_luk_sc_def }, + { "mob_luk_status_def", &battle_config.mob_luk_sc_def }, { "pc_max_status_def", &battle_config.pc_max_sc_def }, { "mob_max_status_def", &battle_config.mob_max_sc_def }, { "sg_miracle_skill_ratio", &battle_config.sg_miracle_skill_ratio }, @@ -3978,6 +3980,8 @@ void battle_set_defaults() { battle_config.sc_castcancel = 0; battle_config.pc_sc_def_rate = 100; battle_config.mob_sc_def_rate = 100; + battle_config.pc_luk_sc_def = 300; + battle_config.mob_luk_sc_def = 300; battle_config.pc_max_sc_def = 10000; battle_config.mob_max_sc_def = 5000; battle_config.sg_miracle_skill_ratio=1; @@ -4176,10 +4180,11 @@ void battle_validate_conf() { if (battle_config.mobs_level_up_exp_rate < 1) // [Valaris] battle_config.mobs_level_up_exp_rate = 1; - if (battle_config.pc_max_sc_def > 10000) - battle_config.pc_max_sc_def = 10000; - if (battle_config.mob_max_sc_def > 10000) - battle_config.mob_max_sc_def = 10000; + if (battle_config.pc_luk_sc_def < 1) + battle_config.pc_luk_sc_def = 1; + if (battle_config.mob_luk_sc_def < 1) + battle_config.mob_luk_sc_def = 1; + if (battle_config.sg_miracle_skill_ratio > 10000) battle_config.sg_miracle_skill_ratio = 10000; diff --git a/src/map/battle.h b/src/map/battle.h index 8cbc15031..c926b3599 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -422,6 +422,8 @@ extern struct Battle_Config { unsigned short sc_castcancel; // [Skotlex]
unsigned short pc_sc_def_rate; // [Skotlex]
unsigned short mob_sc_def_rate;
+ unsigned short pc_luk_sc_def;
+ unsigned short mob_luk_sc_def;
unsigned short pc_max_sc_def;
unsigned short mob_max_sc_def;
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; |