diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-03 23:26:00 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-03 23:26:00 +0000 |
commit | b317caf7a7de3b2a4a64613aee576fd595aaca14 (patch) | |
tree | 1f4ef799df9e0b4fc8d712ab9ba5cc376095e023 /src/map/skill.c | |
parent | 42817756b603d2dc76c1408d0a6f432673350bd7 (diff) | |
download | hercules-b317caf7a7de3b2a4a64613aee576fd595aaca14.tar.gz hercules-b317caf7a7de3b2a4a64613aee576fd595aaca14.tar.bz2 hercules-b317caf7a7de3b2a4a64613aee576fd595aaca14.tar.xz hercules-b317caf7a7de3b2a4a64613aee576fd595aaca14.zip |
Fixes to Devotion (see topic:153345)
- removed totally fake Devotion packet from Marionette Control code (see r3934)
- fixed one devoted chars array management code bug which caused chars to be included in the array multiple times, producing various problems (also see r3934)
- the link will now re-display when coming into view range
- the link will no longer break if the devotee walks away, but instead, if he receives damage while being out of range of Devotion
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12171 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index d579cff5e..5bd4f3aed 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3152,7 +3152,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (!sc->data[type] && !tsc->data[type2]) { sc_start(src,type,100,bl->id,skill_get_time(skillid,skilllv)); sc_start(bl,type2,100,src->id,skill_get_time(skillid,skilllv)); - clif_marionette(src, bl); clif_skill_nodamage(src,bl,skillid,skilllv,1); } else if (sc->data[type] && tsc->data[type2] && @@ -3444,6 +3443,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case CR_DEVOTION: if(sd && dstsd) { + int count = min(skilllv, 5); int lv = sd->status.base_level - dstsd->status.base_level; if (lv < 0) lv = -lv; if (lv > battle_config.devotion_level_difference || @@ -3453,18 +3453,24 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in map_freeblock_unlock(); return 1; } - //Look for an empty slot (or reuse in case you cast it twice in the same char. [Skotlex] - for (i = 0; i < skilllv && i < 5 && sd->devotion[i]!=bl->id && sd->devotion[i]; i++); - if (i == skilllv) - { - clif_skill_fail(sd,skillid,0,0); - map_freeblock_unlock(); - return 1; + + // check if the char isn't devoted already + ARR_FIND( 0, count, i, sd->devotion[i] == bl->id ); + if( i == count ) + {// not there, find first empty slot + ARR_FIND( 0, count, i, sd->devotion[i] == 0 ); + if( i == count ) + {// all slots full, fail + clif_skill_fail(sd,skillid,0,0); + map_freeblock_unlock(); + return 1; + } } + sd->devotion[i] = bl->id; clif_skill_nodamage(src,bl,skillid,skilllv, sc_start4(bl,type,100,src->id,i,skill_get_range2(src,skillid,skilllv),skill_get_time2(skillid, skilllv),1000)); - clif_devotion(sd); + clif_devotion(sd,NULL); } else if (sd) |