summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt14
-rw-r--r--conf-tmpl/Changelog.txt6
-rw-r--r--conf-tmpl/battle/skill.conf6
-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
9 files changed, 68 insertions, 14 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 2de2104f4..faf9cd0ff 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,20 @@ 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/08/24
+ * Added setting clear_skills_on_warp to specify when a character's
+ land-based skills are deleted when the caster changes maps. Defaults to all
+ types. [Skotlex]
+ * Should have fixed Brandish Spear not passing the flag to skill_attack,
+ causing it to do miserable damage. [Skotlex]
+ * Warp Portal will no longer be removed when caster steps through it (this
+ is left to the new clear_skills_on_warp setting) [Skotlex]
+ * Cleaned up status_percent_change to switch equations when the target has
+ high hp to prevent overflows, also it will directly take hp/maxhp when a
+ rate of 100 or higher is passed to prevent calculations. [Skotlex]
+ * Traps and Land Elemental fields are no longer automatically removed on
+ map change (handled now by clear_skills_on_warp) [Skotlex]
+ * traps_setting &2 no longer does anything (handled now by blah blah)
+ [Skotlex]
* Applied some change from mpeg on Ninja Skills [Toms]
* Put HVAN_Explosion based on max_hp instead of current hp [Toms]
2006/08/23
diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt
index 8e976b451..afb4d1ba2 100644
--- a/conf-tmpl/Changelog.txt
+++ b/conf-tmpl/Changelog.txt
@@ -1,5 +1,11 @@
Date Added
+2006/08/24
+ * Added setting clear_skills_on_warp to specify when a character's
+ land-based skills are deleted when the caster changes maps. Defaults to all
+ types (skill.conf). [Skotlex]
+ * The previous setting now obsoletes traps_setting &2, which now can only
+ be 0/1. [Skotlex]
2006/08/21
* Removed config setting "muting_players", and expanded the manner_system
config to specify how having negative manner (mute) affects a player (see
diff --git a/conf-tmpl/battle/skill.conf b/conf-tmpl/battle/skill.conf
index 99bf07ffe..a7cc6f53d 100644
--- a/conf-tmpl/battle/skill.conf
+++ b/conf-tmpl/battle/skill.conf
@@ -89,6 +89,9 @@ skill_caster_check: yes
// Should ground placed skills be removed as soon as the caster dies? [Note 4]
clear_skills_on_death: 15
+// Should ground placed skills be removed when the caster changes maps? [Note 4]
+clear_skills_on_warp: 15
+
//Setting this to YES will override the target mode of ground-based skills with the flag 0x01 to "No Enemies"
//The two skills affected by default are Pneuma and Safety Wall (if set to yes, those two skills will not protect everyone, but only allies)
//See db/skill_unit_db.txt for more info.
@@ -123,8 +126,7 @@ gvg_traps_target_all: 1
// Some traps settings (add as necessary):
// 1: Traps are invisible to those who come into view of it. When unset, all traps are visible at all times.
// (Invisible traps can be revealed through Hunter's Detecting skill)
-// 2: Traps are removed on map-change. When unset, traps last until they time-out.
-traps_setting: 2
+traps_setting: 0
// Whether placed down skills will check walls (Note 1)
// (Makes it so that Storm Gust/Lord of Vermillion/etc when casted next to a wall, won't hit on the other side)
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;