From 8deb4dfef1f3a6b81a93af20eccc7026b308dcc0 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Wed, 1 Dec 2010 18:36:27 +0000 Subject: * Fixed bAutoSpellOnSkill bonuses could not be chained (bugreport:4421, since r13596). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14536 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.h | 2 +- src/map/skill.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/map/pc.h b/src/map/pc.h index 4a9c17f3a..c6c6f4801 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -55,6 +55,7 @@ struct weapon_data { struct s_autospell { short id, lv, rate, card_id, flag; + bool lock; // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed }; struct s_addeffect { @@ -134,7 +135,6 @@ struct map_session_data { short pmap; // Previous map on Map Change struct guild *gmaster_flag; unsigned int bg_id; - unsigned skillonskill : 1; unsigned short user_font; unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish] } state; diff --git a/src/map/skill.c b/src/map/skill.c index dbdfbe35a..c1c9420e3 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1091,11 +1091,14 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s if( sd == NULL || skillid <= 0 ) return 0; - sd->state.skillonskill = 1; for( i = 0; i < ARRAYLENGTH(sd->autospell3) && sd->autospell3[i].flag; i++ ) { if( sd->autospell3[i].flag != skillid ) continue; + + if( sd->autospell3[i].lock ) + continue; // autospell already being executed + skill = (sd->autospell3[i].id > 0) ? sd->autospell3[i].id : -sd->autospell3[i].id; if( skillnotok(skill, sd) ) continue; @@ -1113,6 +1116,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s continue; sd->state.autocast = 1; + sd->autospell3[i].lock = true; skill_consume_requirement(sd,skill,skilllv,1); switch( skill_get_casttype(skill) ) { @@ -1120,6 +1124,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s case CAST_NODAMAGE: skill_castend_nodamage_id(&sd->bl, tbl, skill, skilllv, tick, 0); break; case CAST_DAMAGE: skill_castend_damage_id(&sd->bl, tbl, skill, skilllv, tick, 0); break; } + sd->autospell3[i].lock = false; sd->state.autocast = 0; } @@ -1137,7 +1142,6 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s } } - sd->state.skillonskill = 0; return 1; } @@ -3096,8 +3100,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int { if( sd->state.arrow_atk ) //Consume arrow on last invocation to this skill. battle_consume_ammo(sd, skillid, skilllv); - if( !sd->state.skillonskill ) - skill_onskillusage(sd, bl, skillid, tick); + skill_onskillusage(sd, bl, skillid, tick); skill_consume_requirement(sd,skillid,skilllv,2); } @@ -5718,8 +5721,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { if( sd->state.arrow_atk ) //Consume arrow on last invocation to this skill. battle_consume_ammo(sd, skillid, skilllv); - if( !sd->state.skillonskill ) - skill_onskillusage(sd, bl, skillid, tick); + skill_onskillusage(sd, bl, skillid, tick); skill_consume_requirement(sd,skillid,skilllv,2); } @@ -6583,8 +6585,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk { if( sd->state.arrow_atk && !(flag&1) ) //Consume arrow if a ground skill was not invoked. [Skotlex] battle_consume_ammo(sd, skillid, skilllv); - if( !sd->state.skillonskill ) - skill_onskillusage(sd, NULL, skillid, tick); + skill_onskillusage(sd, NULL, skillid, tick); skill_consume_requirement(sd,skillid,skilllv,2); } -- cgit v1.2.3-70-g09d2