Selaa lähdekoodia

- 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://svn.code.sf.net/p/rathena/svn/trunk@7168 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 vuotta sitten
vanhempi
commit
f9c36c217e
5 muutettua tiedostoa jossa 60 lisäystä ja 25 poistoa
  1. 4 0
      Changelog-Trunk.txt
  2. 10 2
      conf-tmpl/battle/battle.conf
  3. 9 4
      src/map/battle.c
  4. 2 0
      src/map/battle.h
  5. 35 19
      src/map/status.c

+ 4 - 0
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]

+ 10 - 2
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

+ 9 - 4
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;
 

+ 2 - 0
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;
 

+ 35 - 19
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;