summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-04 19:30:15 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-04 19:30:15 +0000
commitbb78f61a194f92934784d108cb8e54e391c570aa (patch)
tree2e49643974eca093697308c944ff3ba0622922ea /src/map
parent06387a85ce94281d1652ab4bc61c5b9c0971832a (diff)
downloadhercules-bb78f61a194f92934784d108cb8e54e391c570aa.tar.gz
hercules-bb78f61a194f92934784d108cb8e54e391c570aa.tar.bz2
hercules-bb78f61a194f92934784d108cb8e54e391c570aa.tar.xz
hercules-bb78f61a194f92934784d108cb8e54e391c570aa.zip
- 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8135 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c16
-rw-r--r--src/map/battle.h8
-rw-r--r--src/map/mob.c8
-rw-r--r--src/map/npc.c7
-rw-r--r--src/map/skill.c9
-rw-r--r--src/map/status.c92
-rw-r--r--src/map/unit.c4
7 files changed, 64 insertions, 80 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index c84fecffd..ec99f6116 100644
--- a/src/map/battle.c
+++ b/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;
diff --git a/src/map/battle.h b/src/map/battle.h
index 5ff2cfc30..8dbad1ac0 100644
--- a/src/map/battle.h
+++ b/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;
diff --git a/src/map/mob.c b/src/map/mob.c
index bbdf65bfe..15cb12e6b 100644
--- a/src/map/mob.c
+++ b/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);
diff --git a/src/map/npc.c b/src/map/npc.c
index af22a84de..ef8dbf8be 100644
--- a/src/map/npc.c
+++ b/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;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index db62dd23e..6e9d5c9ff 100644
--- a/src/map/skill.c
+++ b/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:
diff --git a/src/map/status.c b/src/map/status.c
index ce2d11f54..8b2942add 100644
--- a/src/map/status.c
+++ b/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)))
diff --git a/src/map/unit.c b/src/map/unit.c
index 0860c7b0a..063c9ac34 100644
--- a/src/map/unit.c
+++ b/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)