summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-09 17:08:09 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-09 17:08:09 +0000
commit201d850ec63f84808533d44b37caa5f582c4c25e (patch)
tree97069a114e46d4fa379a3348f5e6a3be0e6abb90 /src/map/mob.c
parent78c3ef3eee96f59282e699b3c7da7dad592ab5ea (diff)
downloadhercules-201d850ec63f84808533d44b37caa5f582c4c25e.tar.gz
hercules-201d850ec63f84808533d44b37caa5f582c4c25e.tar.bz2
hercules-201d850ec63f84808533d44b37caa5f582c4c25e.tar.xz
hercules-201d850ec63f84808533d44b37caa5f582c4c25e.zip
- Script commands sc_start, sc_start2 and sc_start4 will now start regardless of sc defense of the target player (that is, they cannot be avoided)
- Fixed a possible counter overflow in attacked_count, changed the var size to unsigned char since the code can handle the overflow now. - Multiple targets again reduces armor defense, as reported by Tharis. - Increased dex increase of NPC_POWERUP to +20 per level. - Fog of Wall's -50 hit reduction is now only for ranged attacks. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6528 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index bd312a772..47dcd85fd 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1597,10 +1597,14 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if(!(type&2)) {
int id = 0;
if (src) {
+ md->attacked_players++;
+ if (!md->attacked_players) //Counter overflow o.O
+ md->attacked_players++;
+
switch (src->type) {
case BL_PC:
id = sd->status.char_id;
- if(rand()%1000 < 1000/++(md->attacked_players))
+ if(rand()%1000 < 1000/md->attacked_players)
md->attacked_id = sd->bl.id;
break;
case BL_PET:
@@ -1611,7 +1615,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
damage=(damage*battle_config.pet_attack_exp_rate)/100; //Modify logged damage accordingly.
}
//Let mobs retaliate against the pet's master [Skotlex]
- if(rand()%1000 < 1000/++(md->attacked_players))
+ if(rand()%1000 < 1000/md->attacked_players)
md->attacked_id = pd->msd->bl.id;
break;
}
@@ -1622,7 +1626,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
struct map_session_data* msd = map_id2sd(md2->master_id);
if (msd) id = msd->status.char_id;
}
- if(rand()%1000 < 1000/++(md->attacked_players))
+ if(rand()%1000 < 1000/md->attacked_players)
{ //Let players decide whether to retaliate versus the master or the mob. [Skotlex]
if (md2->master_id && battle_config.retaliate_to_master)
md->attacked_id = md2->master_id;