summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-26 02:31:18 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-26 02:31:18 +0000
commit7c4b730c6d8a0201512148fcb795c0f666bfe8c8 (patch)
treed18286ab4e0a11d3c3384c85b84f34b775872235 /src/map/mob.c
parentf8636b8d7c4d3e1e43ea5e0f7c399316651931c9 (diff)
downloadhercules-7c4b730c6d8a0201512148fcb795c0f666bfe8c8.tar.gz
hercules-7c4b730c6d8a0201512148fcb795c0f666bfe8c8.tar.bz2
hercules-7c4b730c6d8a0201512148fcb795c0f666bfe8c8.tar.xz
hercules-7c4b730c6d8a0201512148fcb795c0f666bfe8c8.zip
- NPC_AGIUP now boosts flee by 100% and duration is 5+5*lv secs, as stated on the Ragnarok Bible.
- Fixed Soul Breaker's misc part not ignoring flee. - Fixed misc attack's flee check being backwards (the less hit%, the more chance you had to connect) - Corrected the range check in vending.c (TRADE_DISTANCE -> AREA_SIZE) - Added define DEFAULT_ENEMY_TYPE in mob.c to simplify the enemy bl check (for easier reading/customization) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9922 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index ddc26254d..da4696620 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -46,6 +46,9 @@
#define RUDE_ATTACKED_COUNT 2 //After how many rude-attacks should the skill be used?
+//Used to determine default enemy type of mobs (for use in eachinrange calls)
+#define DEFAULT_ENEMY_TYPE(md) (md->special_state.ai?BL_CHAR:BL_PC|BL_HOM)
+
//Dynamic mob database, allows saving of memory when there's big gaps in the mob_db [Skotlex]
struct mob_db *mob_db_data[MAX_MOB_DB+1];
struct mob_db *mob_dummy = NULL; //Dummy mob to be returned when a non-existant one is requested.
@@ -1199,13 +1202,13 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
if ((!tbl && mode&MD_AGGRESSIVE) || md->state.skillstate == MSS_FOLLOW)
{
map_foreachinrange (mob_ai_sub_hard_activesearch, &md->bl,
- view_range, md->special_state.ai?BL_CHAR:BL_PC|BL_HOM, md, &tbl);
+ view_range, DEFAULT_ENEMY_TYPE(md), md, &tbl);
} else
if (mode&MD_CHANGECHASE && (md->state.skillstate == MSS_RUSH || md->state.skillstate == MSS_FOLLOW))
{
search_size = view_range<md->status.rhw.range ? view_range:md->status.rhw.range;
map_foreachinrange (mob_ai_sub_hard_changechase, &md->bl,
- search_size, (md->special_state.ai?BL_CHAR:BL_PC|BL_HOM), md, &tbl);
+ search_size, DEFAULT_ENEMY_TYPE(md), md, &tbl);
}
if (!tbl) { //No targets available.
@@ -2779,7 +2782,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
if (ms[i].target <= MST_AROUND) {
switch (ms[i].target) {
case MST_RANDOM: //Pick a random enemy within skill range.
- bl = battle_getenemy(&md->bl, md->special_state.ai?BL_CHAR:BL_PC|BL_HOM,
+ bl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md),
skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv));
break;
case MST_TARGET:
@@ -2831,7 +2834,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
struct block_list *bl;
switch (ms[i].target) {
case MST_RANDOM: //Pick a random enemy within skill range.
- bl = battle_getenemy(&md->bl, md->special_state.ai?BL_CHAR:BL_PC|BL_HOM,
+ bl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md),
skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv));
break;
case MST_TARGET: