From 848708ccba75077e519c745cf036f5ddb594ad50 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 14 Jun 2006 20:10:36 +0000 Subject: - Modified how luk reduces status changes by reducing the gap. Eg: resist = vit; resist += (max - resist)*luk/300; - Added battle settings pc_max_sc_luk/mob_max_sc_luk to handle which is the luk threshold at which you gain inmunity (defaults to 300). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7168 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 ++++ conf-tmpl/battle/battle.conf | 12 ++++++++-- src/map/battle.c | 13 +++++++---- src/map/battle.h | 2 ++ src/map/status.c | 54 ++++++++++++++++++++++++++++---------------- 5 files changed, 60 insertions(+), 25 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index bad21b6fe..7ba4921b2 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/06/14 + * Modified how luk reduces status changes by reducing the gap. Eg: resist = + vit; resist += (max - resist)*luk/300; [Skotlex] + * Added battle settings pc_max_sc_luk/mob_max_sc_luk to handle which is the + luk threshold at which you gain inmunity (defaults to 300). [Skotlex] * Fixed buildin_getmobdata. It was trying to handle the first parameter as the array to fill in. [blackhole89] * Blocked again skill usage during marionette. [Skotlex] diff --git a/conf-tmpl/battle/battle.conf b/conf-tmpl/battle/battle.conf index dec785359..caa861518 100644 --- a/conf-tmpl/battle/battle.conf +++ b/conf-tmpl/battle/battle.conf @@ -139,8 +139,16 @@ arrow_decrement: yes pc_status_def_rate: 100 mob_status_def_rate: 100 +// Required luk to gain inmunity to status changes. +// Luk increases resistance by closing the gap between natural resist and max +// linearly. This setting indicates required luk to gain complete inmunity. +// Eg: 40 vit -> 40% resist. 150 luk -> +50% of the missing gap. +// So 40% + (50% of 60%) = 70% +pc_luk_sc_def: 300 +mob_luk_sc_def: 300 + // Maximum resistance to status changes. (10000 = 100%) -// NOTE: This is applied before cards and equipment. -// So inmunity cards can go beyond to this value. +// NOTE: This is applied after cards and equipment, so inmunity cards are +// capped to this. pc_max_status_def: 10000 mob_max_status_def: 10000 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; -- cgit v1.2.3-70-g09d2