summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c101
-rw-r--r--src/map/battle.h15
-rw-r--r--src/map/map.c52
-rw-r--r--src/map/map.h13
-rw-r--r--src/map/npc.c18
-rw-r--r--src/map/script.c2
6 files changed, 104 insertions, 97 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 692750bdb..d2156058d 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1199,23 +1199,31 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if (hd) hom_addspiritball(hd, 10);
}
}
-
- if (battle_config.pk_mode && sd && bl->type == BL_PC && damage && map[bl->m].flag.pvp)
- {
- if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex]
- if (flag&BF_WEAPON)
- damage = damage * battle_config.pk_weapon_damage_rate / 100;
- if (flag&BF_MAGIC)
- damage = damage * battle_config.pk_magic_damage_rate / 100;
- if (flag&BF_MISC)
- damage = damage * battle_config.pk_misc_damage_rate / 100;
- } else { //Normal attacks get reductions based on range.
- if (flag & BF_SHORT)
- damage = damage * battle_config.pk_short_damage_rate / 100;
- if (flag & BF_LONG)
- damage = damage * battle_config.pk_long_damage_rate / 100;
- }
- if(!damage) damage = 1;
+ /* no data claims these settings affect anything other than players */
+ if( damage && sd && bl->type == BL_PC ) {
+ switch( skill_id ) {
+ //case PA_PRESSURE: /* pressure also belongs to this list but it doesn't reach this area -- so dont worry about it */
+ case HW_GRAVITATION:
+ case NJ_ZENYNAGE:
+ case KO_MUCHANAGE:
+ break;
+ default:
+ if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex]
+ if (flag&BF_WEAPON)
+ damage = damage * map[bl->m].weapon_damage_rate / 100;
+ if (flag&BF_MAGIC)
+ damage = damage * map[bl->m].magic_damage_rate / 100;
+ if (flag&BF_MISC)
+ damage = damage * map[bl->m].misc_damage_rate / 100;
+ } else { //Normal attacks get reductions based on range.
+ if (flag & BF_SHORT)
+ damage = damage * map[bl->m].short_damage_rate / 100;
+ if (flag & BF_LONG)
+ damage = damage * map[bl->m].long_damage_rate / 100;
+ }
+ if(!damage) damage = 1;
+ break;
+ }
}
if(battle_config.skill_min_damage && damage > 0 && damage < div_)
@@ -1267,35 +1275,10 @@ int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int dam
if( bl->type == BL_MOB ) {
struct mob_data* md = BL_CAST(BL_MOB, bl);
- if( map[bl->m].flag.battleground && (md->class_ == MOBID_BLUE_CRYST || md->class_ == MOBID_PINK_CRYST) && flag&BF_SKILL )
+ if( flag&BF_SKILL && (md->class_ == MOBID_BLUE_CRYST || md->class_ == MOBID_PINK_CRYST) )
return 0; // Crystal cannot receive skill damage on battlegrounds
}
- switch( skill_id ) {
- case PA_PRESSURE:
- case HW_GRAVITATION:
- case NJ_ZENYNAGE:
- case KO_MUCHANAGE:
- break;
- default:
- if( flag&BF_SKILL ) { //Skills get a different reduction than non-skills. [Skotlex]
- if( flag&BF_WEAPON )
- damage = damage * battle_config.bg_weapon_damage_rate / 100;
- if( flag&BF_MAGIC )
- damage = damage * battle_config.bg_magic_damage_rate / 100;
- if( flag&BF_MISC )
- damage = damage * battle_config.bg_misc_damage_rate / 100;
- } else { //Normal attacks get reductions based on range.
- if( flag&BF_SHORT )
- damage = damage * battle_config.bg_short_damage_rate / 100;
- if( flag&BF_LONG )
- damage = damage * battle_config.bg_long_damage_rate / 100;
- }
-
- if( !damage )
- damage = 1;
- }
-
return damage;
}
@@ -1335,7 +1318,6 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
}
switch (skill_id) {
- //Skills with no damage reduction.
case PA_PRESSURE:
case HW_GRAVITATION:
case NJ_ZENYNAGE:
@@ -1347,21 +1329,9 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
damage -= damage * (md->guardian_data->castle->defense/100) * battle_config.castle_defense_rate/100;
}
*/
- if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex]
- if (flag&BF_WEAPON)
- damage = damage * battle_config.gvg_weapon_damage_rate / 100;
- if (flag&BF_MAGIC)
- damage = damage * battle_config.gvg_magic_damage_rate / 100;
- if (flag&BF_MISC)
- damage = damage * battle_config.gvg_misc_damage_rate / 100;
- } else { //Normal attacks get reductions based on range.
- if (flag & BF_SHORT)
- damage = damage * battle_config.gvg_short_damage_rate / 100;
- if (flag & BF_LONG)
- damage = damage * battle_config.gvg_long_damage_rate / 100;
- }
- if(!damage) damage = 1;
+ break;
}
+
return damage;
}
@@ -5665,17 +5635,7 @@ static const struct _battle_data {
{ "player_cloak_check_type", &battle_config.pc_cloak_check_type, 1, 0, 1|2|4, },
{ "monster_cloak_check_type", &battle_config.monster_cloak_check_type, 4, 0, 1|2|4, },
{ "sense_type", &battle_config.estimation_type, 1|2, 0, 1|2, },
- { "gvg_short_attack_damage_rate", &battle_config.gvg_short_damage_rate, 80, 0, INT_MAX, },
- { "gvg_long_attack_damage_rate", &battle_config.gvg_long_damage_rate, 80, 0, INT_MAX, },
- { "gvg_weapon_attack_damage_rate", &battle_config.gvg_weapon_damage_rate, 60, 0, INT_MAX, },
- { "gvg_magic_attack_damage_rate", &battle_config.gvg_magic_damage_rate, 60, 0, INT_MAX, },
- { "gvg_misc_attack_damage_rate", &battle_config.gvg_misc_damage_rate, 60, 0, INT_MAX, },
{ "gvg_flee_penalty", &battle_config.gvg_flee_penalty, 20, 0, INT_MAX, },
- { "pk_short_attack_damage_rate", &battle_config.pk_short_damage_rate, 80, 0, INT_MAX, },
- { "pk_long_attack_damage_rate", &battle_config.pk_long_damage_rate, 70, 0, INT_MAX, },
- { "pk_weapon_attack_damage_rate", &battle_config.pk_weapon_damage_rate, 60, 0, INT_MAX, },
- { "pk_magic_attack_damage_rate", &battle_config.pk_magic_damage_rate, 60, 0, INT_MAX, },
- { "pk_misc_attack_damage_rate", &battle_config.pk_misc_damage_rate, 60, 0, INT_MAX, },
{ "mob_changetarget_byskill", &battle_config.mob_changetarget_byskill, 0, 0, 1, },
{ "attack_direction_change", &battle_config.attack_direction_change, BL_ALL, BL_NUL, BL_ALL, },
{ "land_skill_limit", &battle_config.land_skill_limit, BL_ALL, BL_NUL, BL_ALL, },
@@ -5867,11 +5827,6 @@ static const struct _battle_data {
{ "client_limit_unit_lv", &battle_config.client_limit_unit_lv, 0, 0, BL_ALL, },
// BattleGround Settings
{ "bg_update_interval", &battle_config.bg_update_interval, 1000, 100, INT_MAX, },
- { "bg_short_attack_damage_rate", &battle_config.bg_short_damage_rate, 80, 0, INT_MAX, },
- { "bg_long_attack_damage_rate", &battle_config.bg_long_damage_rate, 80, 0, INT_MAX, },
- { "bg_weapon_attack_damage_rate", &battle_config.bg_weapon_damage_rate, 60, 0, INT_MAX, },
- { "bg_magic_attack_damage_rate", &battle_config.bg_magic_damage_rate, 60, 0, INT_MAX, },
- { "bg_misc_attack_damage_rate", &battle_config.bg_misc_damage_rate, 60, 0, INT_MAX, },
{ "bg_flee_penalty", &battle_config.bg_flee_penalty, 20, 0, INT_MAX, },
/**
* rAthena
diff --git a/src/map/battle.h b/src/map/battle.h
index e6f860b5a..cd07e25f9 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -232,17 +232,7 @@ struct Battle_Config {
int pc_cloak_check_type;
int monster_cloak_check_type;
int estimation_type;
- int gvg_short_damage_rate;
- int gvg_long_damage_rate;
- int gvg_weapon_damage_rate;
- int gvg_magic_damage_rate;
- int gvg_misc_damage_rate;
int gvg_flee_penalty;
- int pk_short_damage_rate;
- int pk_long_damage_rate;
- int pk_weapon_damage_rate;
- int pk_magic_damage_rate;
- int pk_misc_damage_rate;
int mob_changetarget_byskill;
int attack_direction_change;
int land_skill_limit;
@@ -439,11 +429,6 @@ struct Battle_Config {
// [BattleGround Settings]
int bg_update_interval;
- int bg_short_damage_rate;
- int bg_long_damage_rate;
- int bg_weapon_damage_rate;
- int bg_magic_damage_rate;
- int bg_misc_damage_rate;
int bg_flee_penalty;
// rAthena
diff --git a/src/map/map.c b/src/map/map.c
index d6804a150..eb44ea6ac 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2925,6 +2925,16 @@ void map_zone_db_clear(void) {
db_destroy(zone_db);/* will aFree(zone) */
+ /* clear the pk zone stuff */
+ for(i = 0; i < map_zone_pk.disabled_skills_count; i++) {
+ aFree(map_zone_pk.disabled_skills[i]);
+ }
+ aFree(map_zone_pk.disabled_skills);
+ aFree(map_zone_pk.disabled_items);
+ for(i = 0; i < map_zone_pk.mapflags_count; i++) {
+ aFree(map_zone_pk.mapflags[i]);
+ }
+ aFree(map_zone_pk.mapflags);
/* clear the main zone stuff */
for(i = 0; i < map_zone_all.disabled_skills_count; i++) {
aFree(map_zone_all.disabled_skills[i]);
@@ -3015,12 +3025,19 @@ void map_flags_init(void) {
map[i].skill_count = 0;
// adjustments
- if( battle_config.pk_mode )
+ if( battle_config.pk_mode ) {
map[i].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
- /* align with 'All' zone */
- map[i].zone = &map_zone_all;
+ map[i].zone = &map_zone_pk;
+ } else /* align with 'All' zone */
+ map[i].zone = &map_zone_all;
map[i].invincible_time_inc = 0;
+
+ map[i].weapon_damage_rate = 100;
+ map[i].magic_damage_rate = 100;
+ map[i].misc_damage_rate = 100;
+ map[i].short_damage_rate = 100;
+ map[i].long_damage_rate = 100;
}
}
@@ -3601,7 +3618,7 @@ void map_zone_apply(int m, struct map_zone_data *zone,char* w1, const char* star
npc_parse_mapflag(w1,empty,flag,params,start,buffer,filepath);
}
}
-/* used on npc load and reload to apply all "Normal" zone */
+/* used on npc load and reload to apply all "Normal" and "PK Mode" zones */
void map_zone_init(void) {
struct map_zone_data *zone;
char empty[1] = "\0";
@@ -3622,11 +3639,33 @@ void map_zone_init(void) {
}
}
for(j = 0; j < map_num; j++) {
- if( map[j].zone == &map_zone_all ) {
+ if( map[j].zone == zone ) {
npc_parse_mapflag(map[j].name,empty,flag,params,empty,empty,empty);
}
}
}
+
+ if( battle_config.pk_mode ) {
+ zone = &map_zone_pk;
+ for(i = 0; i < zone->mapflags_count; i++) {
+ char flag[MAP_ZONE_MAPFLAG_LENGTH], params[MAP_ZONE_MAPFLAG_LENGTH];
+ int len = strlen(zone->mapflags[i]);
+ params[0] = '\0';
+ memcpy(flag, zone->mapflags[i], MAP_ZONE_MAPFLAG_LENGTH);
+ for(k = 0; k < len; k++) {
+ if( flag[k] == '\t' ) {
+ memcpy(params, &flag[k+1], len - k);
+ flag[k] = '\0';
+ break;
+ }
+ }
+ for(j = 0; j < map_num; j++) {
+ if( map[j].zone == zone ) {
+ npc_parse_mapflag(map[j].name,empty,flag,params,empty,empty,empty);
+ }
+ }
+ }
+ }
}
enum bl_type map_zone_bl_type(const char *entry) {
@@ -3712,6 +3751,9 @@ void read_map_zone_db(void) {
if( strncmpi(zonename,MAP_ZONE_ALL_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
zone = &map_zone_all;
is_all = true;
+ } else if( strncmpi(zonename,MAP_ZONE_PK_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
+ zone = &map_zone_pk;
+ is_all = true;
} else {
CREATE( zone, struct map_zone_data, 1 );
zone->disabled_skills_count = 0;
diff --git a/src/map/map.h b/src/map/map.h
index 964bee736..6f1a51e9f 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -507,6 +507,7 @@ struct map_zone_disabled_skill_entry {
#define MAP_ZONE_PVP_NAME "PvP"
#define MAP_ZONE_GVG_NAME "GvG"
#define MAP_ZONE_BG_NAME "Battlegrounds"
+#define MAP_ZONE_PK_NAME "PK Mode"
#define MAP_ZONE_MAPFLAG_LENGTH 50
DBMap *zone_db;/* string => struct map_zone_data */
struct map_zone_data {
@@ -522,6 +523,7 @@ void map_zone_init(void);
void map_zone_apply(int m, struct map_zone_data *zone,char* w1, const char* start, const char* buffer, const char* filepath);
struct map_zone_data map_zone_all;/* used as a base on all maps */
+struct map_zone_data map_zone_pk;/* used for (pk_mode) */
struct map_data {
@@ -628,6 +630,17 @@ struct map_data {
/* invincible_time_inc mapflag */
unsigned int invincible_time_inc;
+
+ /* weapon_damage_rate mapflag */
+ unsigned short weapon_damage_rate;
+ /* magic_damage_rate mapflag */
+ unsigned short magic_damage_rate;
+ /* misc_damage_rate mapflag */
+ unsigned short misc_damage_rate;
+ /* short_damage_rate mapflag */
+ unsigned short short_damage_rate;
+ /* long_damage_rate mapflag */
+ unsigned short long_damage_rate;
};
/// Stores information about a remote map (for multi-mapserver setups).
diff --git a/src/map/npc.c b/src/map/npc.c
index 92285118d..abba98293 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3241,8 +3241,10 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
map[m].flag.battleground = 0;
ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
}
- if( (zone = strdb_get(zone_db, MAP_ZONE_GVG_NAME)) && map[m].zone != zone ) {
+ if( state && (zone = strdb_get(zone_db, MAP_ZONE_PVP_NAME)) && map[m].zone != zone ) {
map_zone_apply(m,zone,w1,start,buffer,filepath);
+ } else if ( !state ) {
+ map[m].zone = &map_zone_pk;
}
}
else if (!strcmpi(w3,"pvp_noparty"))
@@ -3294,7 +3296,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
map[m].flag.battleground = 0;
ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
}
- if( (zone = strdb_get(zone_db, MAP_ZONE_GVG_NAME)) && map[m].zone != zone ) {
+ if( state && (zone = strdb_get(zone_db, MAP_ZONE_GVG_NAME)) && map[m].zone != zone ) {
map_zone_apply(m,zone,w1,start,buffer,filepath);
}
}
@@ -3329,7 +3331,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing GvG flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
}
- if( (zone = strdb_get(zone_db, MAP_ZONE_BG_NAME)) && map[m].zone != zone ) {
+ if( state && (zone = strdb_get(zone_db, MAP_ZONE_BG_NAME)) && map[m].zone != zone ) {
map_zone_apply(m,zone,w1,start,buffer,filepath);
}
}
@@ -3462,6 +3464,16 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
map[m].invincible_time_inc = (state) ? atoi(w4) : 0;
} else if ( !strcmpi(w3,"noknockback") ) {
map[m].flag.noknockback = state;
+ } else if ( !strcmpi(w3,"weapon_damage_rate") ) {
+ map[m].weapon_damage_rate = (state) ? atoi(w4) : 100;
+ } else if ( !strcmpi(w3,"magic_damage_rate") ) {
+ map[m].magic_damage_rate = (state) ? atoi(w4) : 100;
+ } else if ( !strcmpi(w3,"misc_damage_rate") ) {
+ map[m].misc_damage_rate = (state) ? atoi(w4) : 100;
+ } else if ( !strcmpi(w3,"short_damage_rate") ) {
+ map[m].short_damage_rate = (state) ? atoi(w4) : 100;
+ } else if ( !strcmpi(w3,"long_damage_rate") ) {
+ map[m].long_damage_rate = (state) ? atoi(w4) : 100;
} else
ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').\n", w3, filepath, strline(buffer,start-buffer));
diff --git a/src/map/script.c b/src/map/script.c
index b2d9f6c87..5b076aeff 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10907,7 +10907,7 @@ BUILDIN_FUNC(removemapflag)
case MF_NOWARPTO: map[m].flag.nowarpto = 0; break;
case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 0; break;
case MF_ZONE:/* reset zone state, mapflags cant be removed however */
- map[m].zone = &map_zone_all;
+ map[m].zone = ( battle_config.pk_mode && map[m].flag.pvp ) ? &map_zone_pk : &map_zone_all;
break;
case MF_NOCOMMAND: map[m].nocommand = 0; break;
case MF_NODROP: map[m].flag.nodrop = 0; break;