summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/pc.c66
2 files changed, 21 insertions, 47 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 39f36d9e1..fa2cef698 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,8 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+09/06/09
+ * Fixed applying autocasts with negative rate before the positive one made it fail to remove the autocast. [Inkfish]
09/06/08
* Rev. 13869 Follow up to r13867, corrected the newly added MD_TARGETWEAK. Monsters with this mode will now only target players five level LOWER than itself. [L0ne_W0lf]
09/06/08
diff --git a/src/map/pc.c b/src/map/pc.c
index 6edc70d96..fdd44339e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1459,48 +1459,18 @@ void pc_autoscript_clear(struct map_session_data *sd)
memset(&sd->autoscript3, 0, sizeof(sd->autoscript3));
}
-static int pc_bonus_autospell_del(struct s_autospell* spell, int max, short id, short lv, short rate, short card_id)
-{
- int i, j;
- for(i=max-1; i>=0 && !spell[i].id; i--);
- if (i<0) return 0; //Nothing to substract from.
-
- j = i;
- for(; i>=0 && rate>0; i--)
- {
- if (spell[i].id != id || spell[i].lv != lv) continue;
- if (rate >= spell[i].rate) {
- rate-= spell[i].rate;
- spell[i].rate = 0;
- memmove(&spell[i], &spell[j], sizeof(struct s_autospell));
- memset(&spell[j], 0, sizeof(struct s_autospell));
- j--;
- } else {
- spell[i].rate -= rate;
- rate = 0;
- }
- }
- if (rate > 0 && ++j < max)
- { //Tag this as "pending" autospell to remove.
- spell[j].id = id;
- spell[j].lv = lv;
- spell[j].rate = -rate;
- spell[j].card_id = card_id;
- }
- return rate;
-}
-
static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id)
{
int i;
- if (rate < 0) return //Remove the autobonus.
- pc_bonus_autospell_del(spell, max, id, lv, -rate, card_id);
- for (i = 0; i < max && spell[i].id; i++) {
- if ((spell[i].card_id == card_id || spell[i].rate < 0) &&
- spell[i].id == id && spell[i].lv == lv)
+ if( !rate )
+ return 0;
+
+ for( i = 0; i < max && spell[i].id; i++ )
+ {
+ if( (spell[i].card_id == card_id || spell[i].rate < 0 || rate < 0) && spell[i].id == id && spell[i].lv == lv )
{
- if (!battle_config.autospell_stacking && spell[i].rate > 0)
+ if( !battle_config.autospell_stacking && spell[i].rate > 0 && rate > 0 )
return 0;
rate += spell[i].rate;
break;
@@ -1528,17 +1498,19 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor
static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id)
{
int i;
- if( rate < 0 )
- return pc_bonus_autospell_del(spell, max, id, lv, -rate, card_id);
- for( i = 0; i < max && spell[i].id; i++ )
- {
- if( spell[i].flag == src_skill && spell[i].id == id && spell[i].lv == lv && spell[i].card_id == card_id )
- {
- if( !battle_config.autospell_stacking )
- rate += spell[i].rate;
- break;
- }
+ if( !rate )
+ return 0;
+
+ for( i = 0; i < max && spell[i].id; i++ )
+ {
+ if( spell[i].flag == src_skill && spell[i].id == id && spell[i].lv == lv && (spell[i].card_id == card_id || spell[i].rate <= 0 || rate < 0) )
+ {
+ if( !battle_config.autospell_stacking && spell[i].rate > 0 && rate > 0 )
+ return 0;
+ rate += spell[i].rate;
+ break;
+ }
}
if( i == max )