Ver código fonte

- Removed settings enemy_critical_rate, homun_critical_rate. Added settings enable_critical (defaults to specify only players), mob_critical_rate and critical_rate. The last applies to all non-mobs and non-players (battle/battle.conf)
- Removed settings mob_npc_warp, mob_warpportal. Replaced with setting mob_warp which specifies which types of warp can a mob step into (battle/monster.conf)
- Updated status_calc_misc so that it also handles the BL_PC case, removed redundant info from status_calc_pc, and moving the SNovice Max Hp bonus to status_base_pc_maxhp


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

skotlex 19 anos atrás
pai
commit
5ef4f71588

+ 7 - 0
Changelog-Trunk.txt

@@ -3,6 +3,13 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 2006/08/04
+	* Removed settings enemy_critical_rate, homun_critical_rate. Added settings
+	  enable_critical (defaults to specify only players), mob_critical_rate and
+	  critical_rate. The last applies to all non-mobs and non-players
+	  (battle/battle.conf) [Skotlex]
+	* Removed settings mob_npc_warp, mob_warpportal. Replaced with setting
+	  mob_warp which specifies which types of warp can a mob step into
+	  (battle/monster.conf) [Skotlex]
 	* Enabled Mastery damage on Soul Breaker again, moved adv katar mastery out
 	  of the mastery function so that it may apply to all skills except Soul
 	  Breaker. [Skotlex]

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

@@ -36,6 +36,14 @@ enable_baseatk: 11
 // Who can have perfect flee? (Note 4)
 enable_perfect_flee: 5
 
+// Who can have critical attacks? (Note 4)
+// (Note that there are some skills that always do critical hit regardless of this)
+enable_critical: 1
+
+// Critical adjustment rate for non-players (Note 2)
+mob_critical_rate: 100
+critical_rate: 100
+
 // Move-delay adjustment after being hit. (Note 2)
 // The 'can't walk' delay after being hit is calculated as a percentage of the damage animation duration.
 // NOTE: Only affects the normal delay from a single attack, not the delay added by the multihit_delay option below.

+ 5 - 9
conf-tmpl/battle/monster.conf

@@ -27,11 +27,6 @@
 // features.
 //--------------------------------------------------------------
 
-// Enemy's Critical Rate (use 0 to disable non-skill criticals) (Note 2)
-// Note: In Official servers enemies don't get criticals other than through skills.
-enemy_critical_rate: 0
-homun_critical_rate: 0
-
 // [MVP] Summoned monsters HP rate, that is, monsters summoned by an MVP will have this much HP. (Note 2)
 mvp_hp_rate: 100
 
@@ -61,11 +56,12 @@ monster_max_aspd: 199
 //    any npc-warps in it's sight of view (use with mob_npc_warp below)
 monster_ai: 0
 
-// Should mobs that stand on an npc warp be warped to the destination cell?
+// Should mobs be able to be warped (add as needed)?
 // 0: Disable.
-// 1: Enable on all warps except those that lead to 'nobranch' maps.
-// 2: Enable on all warps.
-mob_npc_warp: 0
+// 1: Enable mob-warping when standing on NPC-warps
+// 2: Enable mob-warping when standing on Priest Warp Portals
+// 4: Disable warping when the target map is a 'nobranch' map.
+mob_warp: 0
 
 // Mobs and Pets view-range adjustment (range2 column in the mob_db) (Note 2)
 view_range_rate: 100

+ 0 - 3
conf-tmpl/battle/skill.conf

@@ -154,9 +154,6 @@ display_snatcher_skill_fail: yes
 // Can a player in chat room (in-game), be warped by a warp portal? (Note 1)
 chat_warpportal: no
 
-// Can a monster be warped by a warp portal? (Note 1)
-mob_warpportal: no
-
 // What should the wizard's "Sense" skill display on the defense fields?
 // 0: Do not show defense
 // 1: Base defense

+ 1 - 1
db/skill_unit_db.txt

@@ -87,7 +87,7 @@
 430,0x86,    ,  0, 1, 500,enemy, 0x000	//SG_STAR_WARM
 484,0xb8,    ,  2, 0,1000,enemy, 0x808	//HW_GRAVITATION
 488,0xb9,    ,  3, 0,  -1,all,   0x200	//CG_HERMODE
-527,0xba,    , -1, 0,2000,enemy, 0x000	//NJ_TATAMIGAESHI
+527,0xba,    , -1, 0,2500,enemy, 0x000	//NJ_TATAMIGAESHI
 535,0xbd,    ,  2, 0, 100,enemy, 0x008	//NJ_KAENSIN
 541,0x86,,0,2:2:3:3:4,1000,enemy,0x000 //NJ_RAIGEKISAI
 538,0xbb,,1:1:1:2:2:2:3:3:3:4,0,-1,all,0x002	//NJ_SUITON

+ 8 - 8
src/map/battle.c

@@ -3449,8 +3449,9 @@ static const struct battle_data_short {
 	unsigned short *val;
 } battle_data_short[] = {	//List here battle_athena options which are type unsigned short!
 	{ "warp_point_debug",                  &battle_config.warp_point_debug			},
-	{ "enemy_critical_rate",               &battle_config.enemy_critical_rate		},
-	{ "homun_critical_rate",               &battle_config.homun_critical_rate		},
+	{ "enable_critical",                   &battle_config.enable_critical	},
+	{ "mob_critical_rate",                 &battle_config.mob_critical_rate		},
+	{ "critical_rate",                     &battle_config.critical_rate		},
 	{ "enable_baseatk",                    &battle_config.enable_baseatk				},
 	{ "enable_perfect_flee",               &battle_config.enable_perfect_flee		},
 	{ "casting_rate",                      &battle_config.cast_rate				},
@@ -3618,8 +3619,7 @@ static const struct battle_data_short {
 	{ "display_delay_skill_fail",          &battle_config.display_delay_skill_fail	},
 	{ "display_snatcher_skill_fail",       &battle_config.display_snatcher_skill_fail	},
 	{ "chat_warpportal",                   &battle_config.chat_warpportal			},
-	{ "mob_warpportal",                    &battle_config.mob_warpportal			},
-	{ "mob_npc_warp",                      &battle_config.mob_npc_warp },
+	{ "mob_warp",                          &battle_config.mob_warp	},
 	{ "dead_branch_active",                &battle_config.dead_branch_active			},
 	{ "show_steal_in_same_party",          &battle_config.show_steal_in_same_party		},
 	{ "party_hp_mode",                     &battle_config.party_hp_mode },
@@ -3845,8 +3845,9 @@ int battle_get_value(char *w1) {
 
 void battle_set_defaults() {
 	battle_config.warp_point_debug=0;
-	battle_config.enemy_critical_rate=0;
-	battle_config.homun_critical_rate=0;
+	battle_config.enable_critical=BL_PC;
+	battle_config.mob_critical_rate=100;
+	battle_config.critical_rate=100;
 	battle_config.enable_baseatk = BL_ALL;
 	battle_config.enable_perfect_flee = BL_PC|BL_PET;
 	battle_config.cast_rate=100;
@@ -4033,8 +4034,7 @@ void battle_set_defaults() {
 	battle_config.display_delay_skill_fail = 1;
 	battle_config.display_snatcher_skill_fail = 1;
 	battle_config.chat_warpportal = 0;
-	battle_config.mob_warpportal = 0;
-	battle_config.mob_npc_warp = 0;
+	battle_config.mob_warp = 0;
 	battle_config.dead_branch_active = 0;
 	battle_config.vending_max_value = 10000000;
 	battle_config.show_steal_in_same_party = 0;

+ 4 - 4
src/map/battle.h

@@ -95,8 +95,9 @@ int battle_config_switch(const char *str); // [Valaris]
 
 extern struct Battle_Config {
 	unsigned short warp_point_debug;
-	unsigned short enemy_critical_rate;
-	unsigned short homun_critical_rate;
+	unsigned short enable_critical;
+	unsigned short mob_critical_rate;
+	unsigned short critical_rate;
 	unsigned short enable_baseatk;
 	unsigned short enable_perfect_flee;
 	unsigned short cast_rate,delay_rate,delay_dependon_dex;
@@ -269,8 +270,7 @@ extern struct Battle_Config {
 	unsigned short display_delay_skill_fail;
 	unsigned short display_snatcher_skill_fail;
 	unsigned short chat_warpportal;
-	unsigned short mob_warpportal;
-	unsigned short mob_npc_warp;
+	unsigned short mob_warp;
 	unsigned short dead_branch_active;
 	unsigned int vending_max_value;
 	unsigned short show_steal_in_same_party;

+ 0 - 8
src/map/mob.c

@@ -3247,10 +3247,6 @@ static int mob_readdb(void)
 
 			status_calc_misc(status, BL_MOB, mob_db_data[class_]->lv);
 				
-			if(battle_config.enemy_critical_rate != 100)
-				status->cri = status->cri*battle_config.enemy_critical_rate/100;
-			if(!status->cri && battle_config.enemy_critical_rate) status->cri = 1;
-
 			// MVP EXP Bonus, Chance: MEXP,ExpPer
 			mob_db_data[class_]->mexp=atoi(str[30])*battle_config.mvp_exp_rate/100;
 			mob_db_data[class_]->mexpper=atoi(str[31]);
@@ -3923,10 +3919,6 @@ static int mob_read_sqldb(void)
 
 				status_calc_misc(status, BL_MOB, mob_db_data[class_]->lv);
 				
-				if(battle_config.enemy_critical_rate != 100)
-					status->cri = status->cri*battle_config.enemy_critical_rate/100;
-				if(!status->cri && battle_config.enemy_critical_rate) status->cri = 1;
-
 				// MVP EXP Bonus, Chance: MEXP,ExpPer
 				mob_db_data[class_]->mexp = TO_INT(30) * battle_config.mvp_exp_rate / 100;
 				mob_db_data[class_]->mexpper = TO_INT(31);

+ 3 - 4
src/map/npc.c

@@ -1004,10 +1004,9 @@ int npc_touch_areanpc2(struct block_list *bl)
 	if (xs < 0) // Can't warp object between map servers...
 		return 0;
 
-	if(battle_config.mob_npc_warp<2 && map[xs].flag.nobranch)
-		return 0; //Disable warps to nobranch maps.
-	
-	unit_warp(bl, xs, map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,0);
+	if (unit_warp(bl, xs, map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,0))
+		return 0; //Failed to warp.
+
 	return 1;
 }
 

+ 7 - 2
src/map/skill.c

@@ -6863,8 +6863,13 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
 						skill_delunitgroup(NULL, sg);
 				}
 			}
-		} else if(battle_config.mob_warpportal && bl->type != BL_PET)
-			unit_warp(bl,map_mapindex2mapid(sg->val3),sg->val2>>16,sg->val2&0xffff,3);
+		} else
+		if(bl->type == BL_MOB && battle_config.mob_warp&2)
+		{
+			int m = map_mapindex2mapid(sg->val3);
+			if (m < 0) break; //Map not available on this map-server.
+			unit_warp(bl,m,sg->val2>>16,sg->val2&0xffff,3);
+		}
 		break;
 
 	case UNT_QUAGMIRE:

+ 39 - 53
src/map/status.c

@@ -1155,20 +1155,45 @@ static int status_base_atk(struct block_list *bl, struct status_data *status)
 //Fills in the misc data that can be calculated from the other status info (except for level)
 void status_calc_misc(struct status_data *status, int type, int level)
 {
-	status->matk_min = status->int_+(status->int_/7)*(status->int_/7);
-	status->matk_max = status->int_+(status->int_/5)*(status->int_/5);
+	//Non players get the value set, players need to stack with previous bonuses.
+	if (type != BL_PC)
+		status->matk_min = status->matk_max = status->hit = status->flee =
+		status->def2 = status->mdef2 = status->cri = status->flee2 = 0;
 
-	status->hit = level + status->dex;
-	status->flee = level + status->agi;
-	status->def2 = status->vit;
-	status->mdef2 = status->int_ + (status->vit>>1);
-	
-	status->cri = status->luk*3 + 10;
+	status->matk_min += status->int_+(status->int_/7)*(status->int_/7);
+	status->matk_max += status->int_+(status->int_/5)*(status->int_/5);
+	status->hit += level + status->dex;
+	status->flee += level + status->agi;
+	status->def2 += status->vit;
+	status->mdef2 += status->int_ + (status->vit>>1);
+
+	if (type&battle_config.enable_critical)
+		status->cri += status->luk*3 + 10;
+	else
+		status->cri = 0;
 
 	if (type&battle_config.enable_perfect_flee)
-		status->flee2 = status->luk + 10;
+		status->flee2 += status->luk + 10;
 	else
 		status->flee2 = 0;
+
+	if (status->cri)
+	switch (type) {
+	case BL_MOB:
+		if(battle_config.mob_critical_rate != 100)
+			status->cri = status->cri*battle_config.mob_critical_rate/100;
+		if(!status->cri && battle_config.mob_critical_rate)
+		  	status->cri = 10;
+		break;
+	case BL_PC:
+		//Players don't have a critical adjustment setting as of yet.
+		break;
+	default:
+		if(battle_config.critical_rate != 100)
+			status->cri = status->cri*battle_config.critical_rate/100;
+		if (!status->cri && battle_config.critical_rate)
+			status->cri = 10;
+	}
 }
 
 //Skotlex: Calculates the initial status for the given mob
@@ -1321,11 +1346,6 @@ int status_calc_mob(struct mob_data* md, int first)
 		status->aspd_rate -= 100*md->guardian_data->guardup_lv;
 	}
 
-	if(battle_config.enemy_critical_rate != 100)
-		status->cri = status->cri*battle_config.enemy_critical_rate/100;
-	if (!status->cri && battle_config.enemy_critical_rate)
-		status->cri = 10;
-
 	//Initial battle status
 	if (!first)
 		status_calc_bl(&md->bl, SCB_ALL);
@@ -1409,6 +1429,9 @@ static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct sta
 		val -= val * 30/100;
 	if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->char_id, MAPID_TAEKWON))
 		val *= 3; //Triple max HP for top ranking Taekwons over level 90.
+	if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99)
+		val += 2000;
+
 	return val;
 }
 
@@ -1874,22 +1897,11 @@ int status_calc_pc(struct map_session_data* sd,int first)
 	if((skill=pc_checkskill(sd,BS_HILTBINDING))>0)
 		status->batk += 4;
 
-// ----- MATK CALCULATION -----
-
-	// Basic MATK value
-	status->matk_max += status->int_+(status->int_/5)*(status->int_/5);
-	status->matk_min += status->int_+(status->int_/7)*(status->int_/7);
-
-// ----- CRIT CALCULATION -----
-
-	// Basic Crit value
-	status->cri += (status->luk*3)+10;
+// ----- MISC CALCULATION -----
+	status_calc_misc(status, BL_PC, sd->status.base_level);
 
 // ----- HIT CALCULATION -----
 
-	// Basic Hit value
-	status->hit += status->dex + sd->status.base_level;
-
 	// Absolute modifiers from passive skills
 	if((skill=pc_checkskill(sd,BS_WEAPONRESEARCH))>0)
 		status->hit += skill*2;
@@ -1910,25 +1922,12 @@ int status_calc_pc(struct map_session_data* sd,int first)
 
 // ----- FLEE CALCULATION -----
 
-	// Basic Flee value
-	status->flee += status->agi + sd->status.base_level;
-
 	// Absolute modifiers from passive skills
 	if((skill=pc_checkskill(sd,TF_MISS))>0)
 		status->flee += skill*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3);
 	if((skill=pc_checkskill(sd,MO_DODGE))>0)
 		status->flee += (skill*3)>>1;
 
-// ----- PERFECT DODGE CALCULATION -----
-
-	// Basic Perfect Dodge value
-	status->flee2 += status->luk+10;
-
-// ----- VIT-DEF CALCULATION -----
-
-	// Basic VIT-DEF value
-	status->def2 += status->vit;
-
 // ----- EQUIPMENT-DEF CALCULATION -----
 
 	// Apply relative modifiers from equipment
@@ -1943,11 +1942,6 @@ int status_calc_pc(struct map_session_data* sd,int first)
 		status->def = (unsigned char)battle_config.max_def;
 	}
 
-// ----- INT-MDEF CALCULATION -----
-
-	// Basic INT-MDEF value
-	status->mdef2 += status->int_ + (status->vit>>1);
-
 // ----- EQUIPMENT-MDEF CALCULATION -----
 
 	// Apply relative modifiers from equipment
@@ -2016,9 +2010,6 @@ int status_calc_pc(struct map_session_data* sd,int first)
 	sd->status.max_hp = status_base_pc_maxhp(sd,status);
 	status->max_hp += sd->status.max_hp;
 
-	if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99)
-		status->max_hp += 2000;
-
 	// Absolute modifiers from passive skills
 	if((skill=pc_checkskill(sd,CR_TRUST))>0)
 		status->max_hp += skill*200;
@@ -2205,11 +2196,6 @@ int status_calc_homunculus(struct homun_data *hd, int first)
 	status_cpy(&hd->battle_status, status);
 	status_calc_misc(status, BL_HOM, hd->master->homunculus.level);
 
-	if(battle_config.homun_critical_rate != 100)
-		status->cri = status->cri*battle_config.homun_critical_rate/100;
-	if (!status->cri && battle_config.homun_critical_rate)
-		status->cri = 10;
-
 	status_calc_bl(&hd->bl, SCB_ALL); //Status related changes.
 
 	if (memcmp(&b_status, status, sizeof(struct status_data)))

+ 3 - 1
src/map/unit.c

@@ -195,7 +195,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data)
 			sc_start(&sd->bl,SC_MIRACLE,100,1,battle_config.sg_miracle_skill_duration);
 		}
 	} else if (md) {
-		if(battle_config.mob_npc_warp && map_getcell(bl->m,x,y,CELL_CHKNPC) &&
+		if(battle_config.mob_warp&1 && map_getcell(bl->m,x,y,CELL_CHKNPC) &&
 			npc_touch_areanpc2(bl)) // Enable mobs to step on warps. [Skotlex]
 	  		return 0;
 		if (md->min_chase > md->db->range2) md->min_chase--;
@@ -507,6 +507,8 @@ int unit_warp(struct block_list *bl,int m,short x,short y,int type)
 		case BL_MOB:
 			if (map[bl->m].flag.monster_noteleport)
 				return 1;
+			if (m != bl->m && map[m].flag.nobranch && battle_config.mob_warp&4)
+				return 1;
 			break;
 		case BL_PC:
 			if (map[bl->m].flag.noteleport)