summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 18:25:55 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 18:25:55 +0000
commit58a012ef888ec1b80c714636f64648ba1e272b18 (patch)
tree7dce484979c085663e40850d70a845094abe04cd /src/map/mob.c
parent08d47edb4cd49b4c4fa77085257127c8e2cee74a (diff)
downloadhercules-58a012ef888ec1b80c714636f64648ba1e272b18.tar.gz
hercules-58a012ef888ec1b80c714636f64648ba1e272b18.tar.bz2
hercules-58a012ef888ec1b80c714636f64648ba1e272b18.tar.xz
hercules-58a012ef888ec1b80c714636f64648ba1e272b18.zip
- Updated attr_fix_table reading code to account for ELE_MAX (will correctly read bigger elemental tables if ELE_MAX is changed)
- Aggressive mobs will now use battle_check_range rather than mob_can_reach to decide whether to lock-on or not to a target within sight-range. - Added warnings in mob_readdb when the mob's element is invalid. - Updated the corresponding entries in map.h to use ELE_MAX - Added error messages in pc_bonus* functions when an invalid element is passed to the relevant bonuses. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6856 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 929565511..087d05546 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -793,10 +793,10 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
!(status_get_mode(&md->bl)&MD_BOSS))
return 0; //Gangster paradise protection.
case BL_MOB:
- if((dist=distance_bl(&md->bl, bl)) < md->db->range2
- && (md->status.rhw.range > 6 || mob_can_reach(md,bl,dist+1, MSS_FOLLOW))
- && ((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) //New target closer than previous one.
- ) {
+ if((dist=distance_bl(&md->bl, bl)) < md->db->range2 &&
+ ((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) &&
+ battle_check_range(&md->bl,bl,md->db->range2)
+ ) { //Pick closest target?
(*target) = bl;
md->target_id=bl->id;
md->min_chase= dist + md->db->range3;
@@ -3157,6 +3157,16 @@ static int mob_readdb(void)
i = atoi(str[24]); //Element
status->def_ele = i%10;
status->ele_lv = i/20;
+ if (status->def_ele >= ELE_MAX)
+ {
+ ShowWarning("Mob with ID: %d has invalid element type %d (max element is %d)\n", class_, status->def_ele, ELE_MAX-1);
+ status->def_ele = ELE_NEUTRAL;
+ }
+ if (status->ele_lv < 1 || status->ele_lv > 4)
+ {
+ ShowWarning("Mob with ID: %d has invalid element level %d (max is 4)\n", class_, status->ele_lv);
+ status->ele_lv = 1;
+ }
status->mode=atoi(str[25]);
status->speed=atoi(str[26]);
status->aspd_rate = 100;
@@ -3826,6 +3836,16 @@ static int mob_read_sqldb(void)
i = TO_INT(24); //Element
status->def_ele = i%10;
status->ele_lv = i/20;
+ if (status->def_ele >= ELE_MAX)
+ {
+ ShowWarning("Mob with ID: %d has invalid element type %d (max element is %d)\n", status->def_ele, ELE_MAX-1);
+ status->def_ele = ELE_NEUTRAL;
+ }
+ if (status->ele_lv < 1 || status->ele_lv > 4)
+ {
+ ShowWarning("Mob with ID: %d has invalid elemnt level %d (max is 4)\n", status->ele_lv);
+ status->ele_lv = 1;
+ }
status->mode = TO_INT(25);
status->speed = TO_INT(26);
status->aspd_rate = 100;