Ver código fonte

- Being in Enjoyable Rest state will now also trigger the HP/SP Time skills (even if there's no other TK around).
- Renamed SC_TKDORI to SC_TKREST (makes more sense if you ask me)
- Added battle config settings view_range_rate and chase_range_rate to adjust the view-range and chase-range (range2/range3) of the mob_db without having to manually change them.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6490 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 anos atrás
pai
commit
88722161e5
8 arquivos alterados com 52 adições e 14 exclusões
  1. 5 0
      Changelog-Trunk.txt
  2. 8 0
      conf-tmpl/battle/monster.conf
  3. 4 0
      src/map/battle.c
  4. 2 0
      src/map/battle.h
  5. 16 0
      src/map/mob.c
  6. 1 1
      src/map/skill.c
  7. 14 11
      src/map/status.c
  8. 2 2
      src/map/status.h

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ 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/05/05
+	* Being in Enjoyable Rest state will now also trigger the HP/SP Time skills
+	  (even if there's no other TK around). [Skotlex]
+	* Added battle config settings view_range_rate and chase_range_rate to
+	  adjust the view-range and chase-range (range2/range3) of the mob_db without
+	  having to manually change them (battle/monster.conf) [Skotlex]
 	* Kaupe now will only block all skills of players, for non-players, only
 	  normal attacks can be missed. [Skotlex]
 	* Moved the Kaite spell-reflect code after the damage calculation function,

+ 8 - 0
conf-tmpl/battle/monster.conf

@@ -64,6 +64,14 @@ monster_max_aspd: 199
 //    players on them, instead of only for mobs who are in the vecinity of players.
 monster_ai: 0
 
+// Mobs and Pets view-range adjustment (range2 column in the mob_db) (Note 2)
+view_range_rate: 100
+
+// Chase Range is the base minimum-chase that a mob gives before giving up
+// (as long as the target is outside their field of view). This is the range3
+// column in the mob_db. (Note 2)
+chase_range_rate: 100
+
 // Allow monsters to be aggresive and attack first? (Note 1)
 monster_active_enable: yes
 

+ 4 - 0
src/map/battle.c

@@ -3592,6 +3592,8 @@ static const struct battle_data_short {
 	{ "mvp_hp_rate",                       &battle_config.mvp_hp_rate				},
 	{ "monster_hp_rate",                   &battle_config.monster_hp_rate			},
 	{ "monster_max_aspd",                  &battle_config.monster_max_aspd			},
+	{ "view_range_rate",                   &battle_config.view_range_rate },
+	{ "chase_range_rate",                  &battle_config.chase_range_rate },
 	{ "atcommand_gm_only",                 &battle_config.atc_gmonly				},
 	{ "atcommand_spawn_quantity_limit",    &battle_config.atc_spawn_quantity_limit	},
 	{ "atcommand_slave_clone_limit",       &battle_config.atc_slave_clone_limit},
@@ -3984,6 +3986,8 @@ void battle_set_defaults() {
 	battle_config.mvp_hp_rate=100;
 	battle_config.monster_hp_rate=100;
 	battle_config.monster_max_aspd=199;
+	battle_config.view_range_rate=100;
+	battle_config.chase_range_rate=100;
 	battle_config.atc_gmonly=0;
 	battle_config.atc_spawn_quantity_limit=0;
 	battle_config.atc_slave_clone_limit=0;

+ 2 - 0
src/map/battle.h

@@ -135,6 +135,8 @@ extern struct Battle_Config {
 	unsigned short mvp_hp_rate;
 	unsigned short monster_hp_rate;
 	unsigned short monster_max_aspd;
+	unsigned short view_range_rate;
+	unsigned short chase_range_rate;
 	unsigned short atc_gmonly;
 	unsigned short atc_spawn_quantity_limit;
 	unsigned short atc_slave_clone_limit;

+ 16 - 0
src/map/mob.c

@@ -3152,6 +3152,22 @@ static int mob_readdb(void)
 			mob_db_data[class_]->luk=atoi(str[19]);
 			mob_db_data[class_]->range2=atoi(str[20]);
 			mob_db_data[class_]->range3=atoi(str[21]);
+			if (battle_config.view_range_rate!=100)
+			{
+				mob_db_data[class_]->range2=
+					mob_db_data[class_]->range2
+					*battle_config.view_range_rate/100;
+				if (mob_db_data[class_]->range2<1)
+					mob_db_data[class_]->range2=1;
+			}
+			if (battle_config.chase_range_rate!=100)
+			{
+				mob_db_data[class_]->range3=
+					mob_db_data[class_]->range3
+					*battle_config.chase_range_rate/100;
+				if (mob_db_data[class_]->range3<mob_db_data[class_]->range2)
+					mob_db_data[class_]->range3=mob_db_data[class_]->range2;
+			}
 			mob_db_data[class_]->size=atoi(str[22]);
 			mob_db_data[class_]->race=atoi(str[23]);
 			mob_db_data[class_]->element=atoi(str[24]);

+ 1 - 1
src/map/skill.c

@@ -7625,7 +7625,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
 			//Consume
 			sd->itemid = sd->itemindex = -1;
 			if(skill == WZ_EARTHSPIKE 
-				&& sd->sc.data[SC_TKDORI].timer != -1 && rand()%100 > sd->sc.data[SC_TKDORI].val2) // [marquis007]
+				&& sd->sc.data[SC_TKREST].timer != -1 && rand()%100 > sd->sc.data[SC_TKREST].val2) // [marquis007]
 				; //Do not consume item.
 			else
 				pc_delitem(sd,i,1,0);

+ 14 - 11
src/map/status.c

@@ -247,7 +247,7 @@ void initChangeTables(void) {
 	set_sc(TK_READYTURN,            SC_READYTURN,           SI_READYTURN);
 	set_sc(TK_READYCOUNTER,         SC_READYCOUNTER,        SI_READYCOUNTER);
 	set_sc(TK_DODGE,                SC_DODGE,               SI_DODGE);
-	set_sc(TK_SPTIME,               SC_TKDORI,              SI_BLANK);
+	set_sc(TK_SPTIME,               SC_TKREST,              SI_TKREST);
 	set_sc(TK_SEVENWIND,            SC_GHOSTWEAPON,         SI_GHOSTWEAPON);
 	set_sc(TK_SEVENWIND,            SC_SHADOWWEAPON,        SI_SHADOWWEAPON);
 	set_sc(SG_SUN_WARM,             SC_WARM,                SI_WARM);
@@ -1457,7 +1457,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
 		sd->nhealhp = sd->nhealhp*sd->hprecov_rate/100;
 
 	if(sd->nhealhp < 1) sd->nhealhp = 1;
-	if(sd->nhealhp > 0x7fff) sd->nhealhp = 0x7fff;
+	if(sd->nhealhp > SHRT_MAX) sd->nhealhp = SHRT_MAX;
 
 	// Skill-related HP recovery
 	if((skill=pc_checkskill(sd,SM_RECOVERY)) > 0)
@@ -1465,11 +1465,12 @@ int status_calc_pc(struct map_session_data* sd,int first)
 	// Skill-related HP recovery (only when sit)
 	if((skill=pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0)
 		sd->nsshealhp = skill*4 + (sd->status.max_hp*skill/500);
-	if((skill=pc_checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest == 1)
+	if((skill=pc_checkskill(sd,TK_HPTIME)) > 0 &&
+		(sd->state.rest || sd->sc.data[SC_TKREST].timer!=-1))
 		sd->nsshealhp = skill*30 + (sd->status.max_hp*skill/500);
 
-	if(sd->nshealhp > 0x7fff) sd->nshealhp = 0x7fff;
-	if(sd->nsshealhp > 0x7fff) sd->nsshealhp = 0x7fff;
+	if(sd->nshealhp > SHRT_MAX) sd->nshealhp = SHRT_MAX;
+	if(sd->nsshealhp > SHRT_MAX) sd->nsshealhp = SHRT_MAX;
 
 // ----- SP MAX AND REGEN CALCULATION -----
 
@@ -1524,7 +1525,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
 			sd->nhealsp = sd->nhealsp*sd->sprecov_rate/100;
 
 		if(sd->nhealsp < 1) sd->nhealsp = 1;
-		if(sd->nhealsp > 0x7fff) sd->nhealsp = 0x7fff;
+		if(sd->nhealsp > SHRT_MAX) sd->nhealsp = SHRT_MAX;
 
 		// Skill-related SP recovery
 		if((skill=pc_checkskill(sd,MG_SRECOVERY)) > 0)
@@ -1534,13 +1535,15 @@ int status_calc_pc(struct map_session_data* sd,int first)
 		// Skill-related SP recovery (only when sit)
 		if((skill = pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0)
 			sd->nsshealsp = skill*2 + (sd->status.max_sp*skill/500);
-		if((skill=pc_checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest == 1) {
+		if((skill=pc_checkskill(sd,TK_SPTIME)) > 0 &&
+			(sd->state.rest || sd->sc.data[SC_TKREST].timer!=-1))
+		{
 			sd->nsshealsp = skill*3 + (sd->status.max_sp*skill/500);
 			if ((skill=pc_checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
 				sd->nsshealsp += (30+10*skill)*sd->nsshealsp/100;
 		}
-		if(sd->nshealsp > 0x7fff) sd->nshealsp = 0x7fff;
-		if(sd->nsshealsp > 0x7fff) sd->nsshealsp = 0x7fff;
+		if(sd->nshealsp > SHRT_MAX) sd->nshealsp = SHRT_MAX;
+		if(sd->nsshealsp > SHRT_MAX) sd->nsshealsp = SHRT_MAX;
 	}
 
 // ----- MISC CALCULATIONS -----
@@ -4467,7 +4470,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 			}
 		}
 			break;
-		case SC_TKDORI:
+		case SC_TKREST:
 			val2 = 11-val1; //Chance to consume: 11-skilllv%
 			break;
 		case SC_RUN:
@@ -4849,7 +4852,7 @@ int status_change_clear(struct block_list *bl,int type)
 		// Do not reset Xmas status when killed. [Valaris]
 		if(sc->data[i].timer == -1 ||
 			(type == 0 &&
-			(i == SC_EDP || i == SC_MELTDOWN || i == SC_XMAS || i == SC_NOCHAT || i == SC_FUSION)))
+			(i == SC_EDP || i == SC_MELTDOWN || i == SC_XMAS || i == SC_NOCHAT || i == SC_FUSION || i == SC_TKREST)))
 			continue;
 
 		status_change_end(bl, i, -1);

+ 2 - 2
src/map/status.h

@@ -228,7 +228,7 @@ enum {
 	SC_KAITE,
 	SC_SWOO, // [marquis007]
 	SC_SKA, // [marquis007]
-	SC_TKDORI, // [marquis007]
+	SC_TKREST, // [marquis007]
 	SC_MIRACLE, //SG 'hidden' skill [Komurka]
 	//Ninja/GS states
 	SC_MADNESSCANCEL,
@@ -375,7 +375,7 @@ enum {
 	SI_CLOSECONFINE2	= 201,
 	SI_MADNESSCANCEL	= 203,	//[blackhole89]
 	SI_GATLINGFEVER		= 204,
-	// 205 = Gloria again
+	SI_TKREST = 205, // 205 = Gloria again (but TK- Happy State looks like it)
 	SI_MAEMI			= 206,
 	// 207 = crash
 	SI_NEN				= 208,