summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichieru <Michieru@users.noreply.github.com>2014-09-17 23:49:11 +0200
committerMichieru <Michieru@users.noreply.github.com>2014-09-17 23:49:11 +0200
commit15c8f8d190aae986a5c3c93d482fd9047cdad143 (patch)
treedc99c27c2f87ba5d1485a16a3b17a2f2efe53e6c
parentddc52570a9bf694cdba6445bc02350a94856a583 (diff)
parent964b47351ef2156423f6e0a68bfd3361283936c1 (diff)
downloadhercules-15c8f8d190aae986a5c3c93d482fd9047cdad143.tar.gz
hercules-15c8f8d190aae986a5c3c93d482fd9047cdad143.tar.bz2
hercules-15c8f8d190aae986a5c3c93d482fd9047cdad143.tar.xz
hercules-15c8f8d190aae986a5c3c93d482fd9047cdad143.zip
Merge pull request #357 from csnv/master
Devotion statuses fixed. Cleaned some warnings. Unit range shortened!
-rw-r--r--src/map/battle.c46
-rw-r--r--src/map/skill.c19
-rw-r--r--src/map/unit.c2
3 files changed, 40 insertions, 27 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 4dc1dc0e4..e120ea35d 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2712,6 +2712,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
struct block_list *d_bl = NULL;
struct status_change_entry *sce_d = sc->data[SC_DEVOTION];
+
// different delay depending on skill level [celest]
if (sce->val1 <= 5)
delay = 300;
@@ -2720,22 +2721,30 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
else
delay = 100;
- if (sce_d && (d_bl = map->id2bl(sce_d->val1))
- && ((d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id)
- || (d_bl->type == BL_PC && ((TBL_PC*)d_bl)->devotion[sce_d->val2] == bl->id))
- ) {
- // if player is target of devotion, show guard effect on the devotion caster rather than the target
- clif->skill_nodamage(d_bl, d_bl, CR_AUTOGUARD, sce->val1, 1);
- unit->set_walkdelay(d_bl, timer->gettick(), delay, 1);
+ if (sce_d) {
+ // If the target is too far away from the devotion caster, autoguard has no effect
+ // Autoguard will be disabled later on
+ if ((d_bl = map->id2bl(sce_d->val1)) && check_distance_bl(bl, d_bl, sce_d->val3)
+ && ((d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id)
+ || (d_bl->type == BL_PC && ((TBL_PC*)d_bl)->devotion[sce_d->val2] == bl->id))
+ ) {
+ // if player is target of devotion, show guard effect on the devotion caster rather than the target
+ clif->skill_nodamage(d_bl, d_bl, CR_AUTOGUARD, sce->val1, 1);
+ unit->set_walkdelay(d_bl, timer->gettick(), delay, 1);
+
+ d->dmg_lv = ATK_MISS;
+ return 0;
+ }
} else {
clif->skill_nodamage(bl, bl, CR_AUTOGUARD, sce->val1, 1);
unit->set_walkdelay(bl, timer->gettick(), delay, 1);
- }
- if(sc->data[SC_CR_SHRINK] && rnd()%100<5*sce->val1)
- skill->blown(bl,src,skill->get_blewcount(CR_SHRINK,1),-1,0);
- d->dmg_lv = ATK_MISS;
- return 0;
+ if(sc->data[SC_CR_SHRINK] && rnd()%100<5*sce->val1)
+ skill->blown(bl,src,skill->get_blewcount(CR_SHRINK,1),-1,0);
+
+ d->dmg_lv = ATK_MISS;
+ return 0;
+ }
}
if( (sce = sc->data[SC_MILLENNIUMSHIELD]) && sce->val2 > 0 && damage > 0 ) {
@@ -5460,11 +5469,18 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st
if( wd->dmg_lv >= ATK_BLOCK ) {/* yes block still applies, somehow gravity thinks it makes sense. */
if( sc ) {
+ struct status_change_entry *sce_d = sc->data[SC_DEVOTION];
+ struct block_list *d_bl = NULL;
+
+ if (sce_d && sce_d->val1)
+ d_bl = map->id2bl(sce_d->val1);
+
if( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION && skill_id != GS_DESPERADO
- && !(!(wd->flag&BF_SKILL) && sc->data[SC_DEVOTION])
- ) {
- NORMALIZE_RDAMAGE(damage * sc->data[SC_REFLECTSHIELD]->val2 / 100);
+ && !(d_bl && !(wd->flag&BF_SKILL)) /* It should not be a basic attack if the target is under devotion */
+ && !(d_bl && sce_d && !check_distance_bl(target, d_bl, sce_d->val3)) /* It should not be out of range if the target is under devotion */
+ ) {
+ NORMALIZE_RDAMAGE(damage * sc->data[SC_REFLECTSHIELD]->val2 / 100);
#ifndef RENEWAL
rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4);
#else
diff --git a/src/map/skill.c b/src/map/skill.c
index 6d4d9ef1b..814fb1999 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1733,7 +1733,7 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b
case LG_HESPERUSLIT:
if ( sc && sc->data[SC_FORCEOFVANGUARD] && sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 > 6 ) {
char i;
- for( i = 0; i < sc->data[SC_FORCEOFVANGUARD]->val3; i++ && sc->fv_counter <= sc->data[SC_FORCEOFVANGUARD]->val3 )
+ for( i = 0; i < sc->data[SC_FORCEOFVANGUARD]->val3 && sc->fv_counter <= sc->data[SC_FORCEOFVANGUARD]->val3 ; i++)
clif->millenniumshield(bl, sc->fv_counter++);
}
break;
@@ -1768,15 +1768,12 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b
if( attack_type&BF_MAGIC ) {
sp += sd->bonus.magic_sp_gain_value;
hp += sd->bonus.magic_hp_gain_value;
- if( skill_id == WZ_WATERBALL ) {// (bugreport:5303)
- struct status_change *sc = NULL;
- if( ( sc = status->get_sc(src) ) ) {
- if( sc->data[SC_SOULLINK]
- && sc->data[SC_SOULLINK]->val2 == SL_WIZARD
- && sc->data[SC_SOULLINK]->val3 == WZ_WATERBALL
- )
- sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check.
- }
+ if( skill_id == WZ_WATERBALL ) {// (bugreport:5303)
+ if( sc->data[SC_SOULLINK]
+ && sc->data[SC_SOULLINK]->val2 == SL_WIZARD
+ && sc->data[SC_SOULLINK]->val3 == WZ_WATERBALL
+ )
+ sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check.
}
}
if( hp || sp ) {
@@ -11866,7 +11863,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6
if( md && md->class_ == MOBID_EMPERIUM )
break;
#endif
- if( sg->src_id == bl->id && !(tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SL_BARDDANCER)
+ if( (sg->src_id == bl->id && !(tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SL_BARDDANCER))
|| (!(battle_config.song_timer_reset) && tsc && tsc->data[type] && tsc->data[type]->val4 == 1))
break;
heal = skill->calc_heal(ss,bl,sg->skill_id, sg->skill_lv, true);
diff --git a/src/map/unit.c b/src/map/unit.c
index 8b74ff80c..12df6ab1f 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -316,7 +316,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
unit->attack(bl, tbl->id, ud->state.attack_continue);
}
} else { //Update chase-path
- unit->walktobl(bl, tbl, ud->chaserange, ud->state.walk_easy|(ud->state.attack_continue?2:0));
+ unit->walktobl(bl, tbl, ud->chaserange, ud->state.walk_easy|(ud->state.attack_continue? 1 : 0));
return 0;
}
} else {