summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/unit.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index fceb30be1..16b503e9d 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1382,6 +1382,7 @@ static int64 battle_calc_defense(int attack_type, struct block_list *src, struct
#ifndef RENEWAL
if(skill_id == AM_ACIDTERROR) def1 = 0; //Acid Terror ignores only armor defense. [Skotlex]
#endif
+ def1 = max(def1, 0);
if(def2 < 1) def2 = 1;
}
//Vitality reduction from rodatazone: http://rodatazone.simgaming.net/mechanics/substats.php#def
diff --git a/src/map/unit.c b/src/map/unit.c
index 9174bdccd..371be03db 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1836,7 +1836,7 @@ static int unit_set_target(struct unit_data *ud, int target_id)
struct block_list* target;
if (ud->target && (target = map->id2bl(ud->target)) != NULL && (ux = unit->bl2ud(target)) != NULL && ux->target_count > 0)
--ux->target_count;
- if (target_id && (target = map->id2bl(target_id)) != NULL && (ux = unit->bl2ud(target)) != NULL)
+ if (target_id && (target = map->id2bl(target_id)) != NULL && (ux = unit->bl2ud(target)) != NULL && ux->target_count < UCHAR_MAX)
++ux->target_count;
}