summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-08 18:25:51 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-08 18:25:51 +0000
commit655384295651f8611b0caa2022cbceac073c1b4d (patch)
tree52e83e9a3b8f9e83e5b0c13cc1e0d867805b79da /src/map
parent7d405eceea92418239dadaaad37f7c38e26aab25 (diff)
downloadhercules-655384295651f8611b0caa2022cbceac073c1b4d.tar.gz
hercules-655384295651f8611b0caa2022cbceac073c1b4d.tar.bz2
hercules-655384295651f8611b0caa2022cbceac073c1b4d.tar.xz
hercules-655384295651f8611b0caa2022cbceac073c1b4d.zip
- Spider web can again be recasted on target.
- Modified Spider Web so it can instantly retrap a target, rather than idling on the ground waiting for a new target. - Cleaned up some the rude-attacked code, being attacked while under spider web now triggers rude-attacked. - Sped up the FrostJoke/Scream message length chat check. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9828 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c11
-rw-r--r--src/map/mob.c43
-rw-r--r--src/map/skill.c7
3 files changed, 35 insertions, 26 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 7a0d6b4ad..aa2091054 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8548,11 +8548,12 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
if (messagelen > CHAT_SIZE) { // messages mustn't be too long
int i;
// special case here - allow some more freedom for frost joke & dazzler
- for(i = 0; i < MAX_SKILLTIMERSKILL; i++) // the only way to check ~.~
- if (sd->ud.skilltimerskill[i] && sd->ud.skilltimerskill[i]->timer != -1 &&
- (sd->ud.skilltimerskill[i]->skill_id == BA_FROSTJOKE || sd->ud.skilltimerskill[i]->skill_id == DC_SCREAM))
- break;
- if (i == MAX_SKILLTIMERSKILL) { // normal message, too long
+ // TODO:? You could use a state flag when FrostJoke/Scream is used, and unset it once the skill triggers. [Skotlex]
+ for(i = 0; i < MAX_SKILLTIMERSKILL && sd->ud.skilltimerskill[i] &&
+ sd->ud.skilltimerskill[i]->skill_id != BA_FROSTJOKE &&
+ sd->ud.skilltimerskill[i]->skill_id != DC_SCREAM; i++);
+
+ if (i == MAX_SKILLTIMERSKILL || !sd->ud.skilltimerskill[i]) { // normal message, too long
ShowWarning("clif_parse_GlobalMessage: Player '%s' sent a message too long ('%.*s')!", sd->status.name, CHAT_SIZE, message);
return;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index 9078454e9..f3eb3a22d 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1122,37 +1122,44 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
if (md->attacked_id && mode&MD_CANATTACK)
{
if (md->attacked_id == md->target_id)
- {
+ { //Rude attacked check.
if (!battle_check_range(&md->bl, tbl, md->status.rhw.range) &&
- (
- (!can_move && battle_config.mob_ai&0x2) ||
+ ( //Can't attack back and can't reach back.
+ (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 &&
+ (battle_config.mob_ai&0x2 || md->sc.data[SC_SPIDERWEB].timer != -1)) ||
(!mob_can_reach(md, tbl, md->min_chase, MSS_RUSH))
) &&
- DIFF_TICK(tick, md->ud.canmove_tick) > 0 &&
- md->state.attacked_count++ >= RUDE_ATTACKED_COUNT
- )
- { //Rude-attacked (avoid triggering due to can-walk delay).
- if (!mobskill_use(md, tick, MSC_RUDEATTACKED) && can_move)
- unit_escape(bl, tbl, rand()%10 +1);
+ md->state.attacked_count++ >= RUDE_ATTACKED_COUNT &&
+ !mobskill_use(md, tick, MSC_RUDEATTACKED) && //If can't rude Attack
+ can_move && unit_escape(bl, tbl, rand()%10 +1)) //Attempt escape
+ { //Escaped
+ md->attacked_id = 0;
+ return 0;
}
} else
if ((abl= map_id2bl(md->attacked_id)) && (!tbl || mob_can_changetarget(md, abl, mode))) {
if (md->bl.m != abl->m || abl->prev == NULL ||
(dist = distance_bl(&md->bl, abl)) >= MAX_MINCHASE ||
battle_check_target(bl, abl, BCT_ENEMY) <= 0 ||
- (battle_config.mob_ai&0x2 && !status_check_skilluse(bl, abl, 0, 0)) ||
- !mob_can_reach(md, abl, dist+md->db->range3, MSS_RUSH) ||
- ( //Gangster Paradise check
- abl->type == BL_PC && !(mode&MD_BOSS) &&
- ((TBL_PC*)abl)->state.gangsterparadise
+ (battle_config.mob_ai&0x2 && !status_check_skilluse(bl, abl, 0, 0)) || //Retaliate check
+ (!battle_check_range(&md->bl, abl, md->status.rhw.range) &&
+ ( //Reach check
+ (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 &&
+ (battle_config.mob_ai&0x2 || md->sc.data[SC_SPIDERWEB].timer != -1)) ||
+ !mob_can_reach(md, abl, dist+md->db->range3, MSS_RUSH)
+ )
)
- ) { //Can't attack back
+ ) { //Rude attacked
if (md->state.attacked_count++ >= RUDE_ATTACKED_COUNT &&
- !mobskill_use(md, tick, MSC_RUDEATTACKED) && can_move)
- unit_escape(bl, abl, rand()%10 +1);
+ !mobskill_use(md, tick, MSC_RUDEATTACKED) && can_move &&
+ unit_escape(bl, abl, rand()%10 +1))
+ { //Escaped.
+ //TODO: Maybe it shouldn't attempt to run if it has another, valid target?
+ md->attacked_id = 0;
+ return 0;
+ }
} else if (!(battle_config.mob_ai&0x2) && !status_check_skilluse(bl, abl, 0, 0)) {
//Can't attack back, but didn't invoke a rude attacked skill...
- md->attacked_id = 0; //Simply unlock, shouldn't attempt to run away when in dumb_ai mode.
} else { //Attackable
if (!tbl || dist < md->status.rhw.range || !check_distance_bl(&md->bl, tbl, dist)
|| battle_gettarget(tbl) != md->bl.id)
diff --git a/src/map/skill.c b/src/map/skill.c
index cdba67d5f..f5283b9d8 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -7173,9 +7173,9 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_SPIDERWEB:
case UNT_ANKLESNARE:
- if(sg->val2==0 && tsc && tsc->data[type].timer==-1){
+ if(sg->val2==0 && tsc){
int sec = skill_get_time2(sg->skill_id,sg->skill_lv);
- if (sc_start(bl,type,100,sg->skill_lv,sec))
+ if (sc_start2(bl,type,100,sg->skill_lv,sg->group_id,sec))
{
struct TimerData* td = get_timer(tsc->data[type].timer);
if (td) sec = DIFF_TICK(td->tick, tick);
@@ -7447,7 +7447,8 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
struct block_list *target = map_id2bl(sg->val2);
if (target && target==bl)
{
- status_change_end(bl,SC_SPIDERWEB,-1);
+ if (sc && sc->data[type].timer!=-1 && sc->data[type].val2 == sg->group_id)
+ status_change_end(bl,type,-1);
sg->limit = DIFF_TICK(tick,sg->tick)+1000;
}
break;