summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorMichieru <Michieru@users.noreply.github.com>2014-08-28 16:53:22 +0200
committerMichieru <Michieru@users.noreply.github.com>2014-08-28 16:53:22 +0200
commitb9511727e6a754ad5a11d21d30df98451c2dd69c (patch)
tree1b3b8557e48019b977fe252db6ab6d2928d8baa2 /src/map/battle.c
parent769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6 (diff)
parente7be72538ea9c203bfd7a976d82e268e04303ca4 (diff)
downloadhercules-b9511727e6a754ad5a11d21d30df98451c2dd69c.tar.gz
hercules-b9511727e6a754ad5a11d21d30df98451c2dd69c.tar.bz2
hercules-b9511727e6a754ad5a11d21d30df98451c2dd69c.tar.xz
hercules-b9511727e6a754ad5a11d21d30df98451c2dd69c.zip
Merge pull request #326 from csnv/somefixes
Fixed official devotion behaviour, various cleanups
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index fc159c921..edc7b38e5 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2696,7 +2696,19 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if( (sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON && !(skill->get_nk(skill_id)&NK_NO_CARDFIX_ATK) && rnd()%100 < sce->val2 )
{
int delay;
- clif->skill_nodamage(bl,bl,CR_AUTOGUARD,sce->val1,1);
+ struct block_list *d_bl;
+ struct status_change_entry *sce_d;
+ bool devoted = false;
+
+ if ((sce_d = sc->data[SC_DEVOTION]) && (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
+ devoted = true;
+ clif->skill_nodamage(d_bl, d_bl, CR_AUTOGUARD, sce->val1, 1);
+ } else
+ clif->skill_nodamage(bl, bl, CR_AUTOGUARD,sce->val1, 1);
+
// different delay depending on skill level [celest]
if (sce->val1 <= 5)
delay = 300;
@@ -2704,7 +2716,8 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
delay = 200;
else
delay = 100;
- unit->set_walkdelay(bl, timer->gettick(), delay, 1);
+
+ unit->set_walkdelay((devoted ? d_bl : 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);
@@ -5217,9 +5230,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.damage-=wd.damage2;
#endif
}
-
- if( src != target ) { // Don't reflect your own damage (Grand Cross)
+
+ if( src != target ) { // Don't reflect your own damage (Grand Cross)
if( wd.dmg_lv == ATK_MISS || wd.dmg_lv == ATK_BLOCK ) {
int64 prev1 = wd.damage, prev2 = wd.damage2;
@@ -5345,6 +5358,9 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st
sc = NULL;
if( sc ) {
+ if (sc->data[SC_DEVOTION] && !(wd->flag & BF_SKILL))
+ return; // No reflect for basic attacks on devoted characters
+
if (wd->flag & BF_SHORT && !(skill->get_inf(skill_id) & (INF_GROUND_SKILL | INF_SELF_SKILL))) {
if( sc->data[SC_CRESCENTELBOW] && !is_boss(src) && rnd()%100 < sc->data[SC_CRESCENTELBOW]->val2 ){
//ATK [{(Target HP / 100) x Skill Level} x Caster Base Level / 125] % + [Received damage x {1 + (Skill Level x 0.2)}]
@@ -6353,13 +6369,6 @@ bool battle_check_range(struct block_list *src, struct block_list *bl, int range
if( src->m != bl->m )
return false;
-#ifndef CIRCULAR_AREA
- if( src->type == BL_PC ) { // Range for players' attacks and skills should always have a circular check. [Angezerus]
- int dx = src->x - bl->x, dy = src->y - bl->y;
- if( !path->check_distance(dx, dy, range) )
- return false;
- } else
-#endif
if( !check_distance_bl(src, bl, range) )
return false;