summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/skill.c16
-rw-r--r--src/map/status.c28
-rw-r--r--src/map/unit.c6
6 files changed, 44 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 1ed59317b..5886097e5 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3455,6 +3455,7 @@ static const struct battle_data_short {
{ "gvg_traps_target_all", &battle_config.vs_traps_bctall },
{ "traps_setting", &battle_config.traps_setting },
{ "clear_skills_on_death", &battle_config.clear_unit_ondeath },
+ { "clear_skills_on_warp", &battle_config.clear_unit_onwarp },
{ "random_monster_checklv", &battle_config.random_monster_checklv },
{ "attribute_recover", &battle_config.attr_recover },
{ "flooritem_lifetime", &battle_config.flooritem_lifetime },
@@ -3851,6 +3852,7 @@ void battle_set_defaults() {
battle_config.vs_traps_bctall=BL_PC;
battle_config.traps_setting=0;
battle_config.clear_unit_ondeath=BL_ALL;
+ battle_config.clear_unit_onwarp=BL_ALL;
battle_config.random_monster_checklv=1;
battle_config.attr_recover=1;
battle_config.flooritem_lifetime=LIFETIME_FLOORITEM*1000;
diff --git a/src/map/battle.h b/src/map/battle.h
index 7b2bc0600..fdac323c5 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -105,6 +105,7 @@ extern struct Battle_Config {
unsigned short vs_traps_bctall;
unsigned short traps_setting;
unsigned short clear_unit_ondeath; //[Skotlex]
+ unsigned short clear_unit_onwarp; //[Skotlex]
unsigned short random_monster_checklv;
unsigned short attr_recover;
unsigned short flooritem_lifetime;
diff --git a/src/map/pc.c b/src/map/pc.c
index 6327719bd..8a0739ece 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3272,7 +3272,6 @@ int pc_setpos(struct map_session_data *sd,unsigned short mapindex,int x,int y,in
{ //Misc map-changing settings
party_send_dot_remove(sd); //minimap dot fix [Kevin]
guild_send_dot_remove(sd);
- skill_clear_group(&sd->bl, 1|(battle_config.traps_setting&2));
if (sd->regen.state.gc)
sd->regen.state.gc = 0;
if (sd->sc.count)
@@ -3290,6 +3289,8 @@ int pc_setpos(struct map_session_data *sd,unsigned short mapindex,int x,int y,in
sd->sc.data[SC_KNOWLEDGE].timer = add_timer(gettick() + skill_get_time(SG_KNOWLEDGE, sd->sc.data[SC_KNOWLEDGE].val1), status_change_timer, sd->bl.id, SC_KNOWLEDGE);
}
}
+ if (battle_config.clear_unit_onwarp&BL_PC)
+ skill_clear_unitgroup(&sd->bl);
}
if(m<0){
diff --git a/src/map/skill.c b/src/map/skill.c
index a25a523a2..905e2c1fb 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2887,15 +2887,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
case ASC_METEORASSAULT:
case GS_DESPERADO:
case GS_SPREADATTACK:
- case KN_BRANDISHSPEAR:
if (flag&1)
{ //Invoked from map_foreachinarea, skill_area_temp[0] holds number of targets to divide damage by.
if (skill_area_temp[1] != bl->id)
skill_attack(skill_get_type(skillid), src, src, bl,
skillid, skilllv, tick, skill_area_temp[0]|SD_ANIMATION);
- else if (skillid == KN_BRANDISHSPEAR)
- skill_attack(skill_get_type(skillid), src, src, bl,
- skillid, skilllv, tick, skill_area_temp[0]);
break;
}
if ( skillid == NJ_BAKUENRYU )
@@ -2926,6 +2922,16 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
}
break;
+ case KN_BRANDISHSPEAR:
+ //Coded apart for it needs the flag passed to the damage calculation.
+ if (skill_area_temp[1] != bl->id)
+ skill_attack(skill_get_type(skillid), src, src, bl,
+ skillid, skilllv, tick, flag|SD_ANIMATION);
+ else
+ skill_attack(skill_get_type(skillid), src, src, bl,
+ skillid, skilllv, tick, flag);
+ break;
+
case KN_BOWLINGBASH:
if(flag&1){
if(bl->id==skill_area_temp[1])
@@ -6838,7 +6844,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
if((!sd->chatID || battle_config.chat_warpportal)
&& sd->ud.to_x == src->bl.x && sd->ud.to_y == src->bl.y) {
if (pc_setpos(sd,sg->val3,sg->val2>>16,sg->val2&0xffff,3) == 0) {
- if (--sg->val1<=0 || sg->src_id == bl->id)
+ if (--sg->val1<=0)
skill_delunitgroup(NULL, sg);
}
}
diff --git a/src/map/status.c b/src/map/status.c
index f4fcf32a2..38a9d382d 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -812,16 +812,34 @@ int status_percent_change(struct block_list *src,struct block_list *target,signe
unsigned int hp =0, sp = 0;
status = status_get_status_data(target);
-
- if (hp_rate > 0)
- hp = (hp_rate*status->hp)/100;
+
+ //Change the equation when the values are high enough to discard the
+ //imprecision in exchange of overflow protection [Skotlex]
+ //Also add 100% checks since those are the most used cases where we don't
+ //want aproximation errors.
+ if (hp_rate > 99)
+ hp = status->hp;
+ else if (hp_rate > 0)
+ hp = status->hp>10000?
+ hp_rate*(status->hp/100):
+ (hp_rate*status->hp)/100;
+ else if (hp_rate < -99)
+ hp = status->max_hp;
else if (hp_rate < 0)
- hp = (-hp_rate)*status->max_hp/100;
+ hp = status->max_hp>10000?
+ (-hp_rate)*(status->max_hp/100):
+ (-hp_rate*status->max_hp)/100;
if (hp_rate && !hp)
hp = 1;
- if (sp_rate > 0)
+ //Should be safe to not do overflow protection here, noone should have
+ //millions upon millions of SP
+ if (sp_rate > 99)
+ sp = status->sp;
+ else if (sp_rate > 0)
sp = (sp_rate*status->sp)/100;
+ else if (sp_rate < -99)
+ sp = status->max_sp;
else if (sp_rate < 0)
sp = (-sp_rate)*status->max_sp/100;
if (sp_rate && !sp)
diff --git a/src/map/unit.c b/src/map/unit.c
index 1fa676823..af77ce7f9 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -534,13 +534,17 @@ int unit_warp(struct block_list *bl,int m,short x,short y,int type)
return 2;
}
}
-
+
if (bl->type == BL_PC) //Use pc_setpos
return pc_setpos((TBL_PC*)bl, map[m].index, x, y, type);
if (!unit_remove_map(bl, type))
return 3;
+ if (bl->m != m && battle_config.clear_unit_onwarp &&
+ battle_config.clear_unit_onwarp&bl->type)
+ skill_clear_unitgroup(bl);
+
bl->x=ud->to_x=x;
bl->y=ud->to_y=y;
bl->m=m;