summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-27 10:33:48 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-27 10:33:48 +0000
commit249b427c3ce9b90cbec7aa50e3b04100f3f95d1c (patch)
tree71372c22f4745fe8f6c9acc3f422dc5856e72c20
parent7047b7ca337bdeca6c8a24c58ee2abe0e840ccd9 (diff)
downloadhercules-249b427c3ce9b90cbec7aa50e3b04100f3f95d1c.tar.gz
hercules-249b427c3ce9b90cbec7aa50e3b04100f3f95d1c.tar.bz2
hercules-249b427c3ce9b90cbec7aa50e3b04100f3f95d1c.tar.xz
hercules-249b427c3ce9b90cbec7aa50e3b04100f3f95d1c.zip
* Moved guardian hostility checking and monster_ignore_gm check to battle.c
* Fixed the 'show_mob_hp' option not updating when a monster is healed git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1306 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/battle.c27
-rw-r--r--src/map/mob.c54
2 files changed, 49 insertions, 32 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 9caa111b2..9e8f6b578 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3785,10 +3785,33 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
return -1;
}
}
- // Mobでmaster_idがあってspecial_mob_aiなら、召喚主を求める
+
if( src->type==BL_MOB ){
struct mob_data *md=(struct mob_data *)src;
- if(md && md->master_id>0){
+ nullpo_retr (-1, md);
+
+ if(target->type == BL_PC) {
+ struct map_session_data *sd = (struct map_session_data *)target;
+ nullpo_retr (-1, sd);
+
+ if(md->class_ >= 1285 && md->class_ <= 1287){
+ struct guild_castle *gc = guild_mapname2gc (map[target->m].name);
+ if(gc && agit_flag==0) // Guardians will not attack during non-woe time [Valaris]
+ return 1; // end addition [Valaris]
+ if(gc && sd->status.guild_id > 0) {
+ struct guild *g=guild_search(sd->status.guild_id); // don't attack guild members [Valaris]
+ if(g && g->guild_id == gc->guild_id)
+ return 1;
+ if(g && guild_isallied(g,gc))
+ return 1;
+ }
+ }
+ // option to have monsters ignore GMs [Valaris]
+ if (battle_config.monsters_ignore_gm > 0 && pc_isGM(sd) >= battle_config.monsters_ignore_gm)
+ return 1;
+ }
+ // Mobでmaster_idがあってspecial_mob_aiなら、召喚主を求める
+ if(md->master_id>0){
if(md->master_id==target->id) // 主なら肯定
return 1;
if(md->state.special_mob_ai){
diff --git a/src/map/mob.c b/src/map/mob.c
index 76554f70b..80cd6e346 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1122,9 +1122,18 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range)
dx=abs(bl->x - md->bl.x);
dy=abs(bl->y - md->bl.y);
+ if( md->bl.m != bl->m) // 違うャbプ
+ return 0;
+
+ if( range>0 && range < ((dx>dy)?dx:dy) ) // 遠すぎる
+ return 0;
+
+ if( md->bl.x==bl->x && md->bl.y==bl->y ) // 同じマス
+ return 1;
+
//=========== guildcastle guardian no search start===========
//when players are the guild castle member not attack them !
- if(md->class_ >= 1285 && md->class_ <= 1287){
+ /*if(md->class_ >= 1285 && md->class_ <= 1287){
struct map_session_data *sd;
struct guild *g=NULL;
struct guild_castle *gc=guild_mapname2gc(map[bl->m].name);
@@ -1132,36 +1141,24 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range)
if(gc && agit_flag==0) // Guardians will not attack during non-woe time [Valaris]
return 0; // end addition [Valaris]
- if(bl && bl->type == BL_PC){
+ if(gc && bl->type == BL_PC){
nullpo_retr(0, sd=(struct map_session_data *)bl);
- if(!gc)
- return 0;
- if(gc && sd && sd->status.guild_id) {
- g=guild_search(sd->status.guild_id); // don't attack guild members [Valaris]
+ if(gc && sd->status.guild_id > 0) {
+ g=guild_search(sd->status.guild_id); // don't attack guild members [Valaris]
if(g && g->guild_id == gc->guild_id)
return 0;
if(g && gc && guild_isallied(g,gc))
return 0;
-
}
}
- }
+ }*/
//========== guildcastle guardian no search eof==============
- if(bl && bl->type == BL_PC && battle_config.monsters_ignore_gm) { // option to have monsters ignore GMs [Valaris]
+ /*if(bl->type == BL_PC && battle_config.monsters_ignore_gm) { // option to have monsters ignore GMs [Valaris]
struct map_session_data *sd;
if((sd=(struct map_session_data *)bl) != NULL && pc_isGM(sd) >= battle_config.monsters_ignore_gm)
return 0;
- }
-
- if( md->bl.m != bl->m) // 違うャbプ
- return 0;
-
- if( range>0 && range < ((dx>dy)?dx:dy) ) // 遠すぎる
- return 0;
-
- if( md->bl.x==bl->x && md->bl.y==bl->y ) // 同じマス
- return 1;
+ }*/
// Obstacle judging
wpd.path_len=0;
@@ -2885,6 +2882,9 @@ int mob_heal(struct mob_data *md,int heal)
}
} // end addition [Valaris]
+ if (battle_config.show_mob_hp)
+ clif_update_mobhp(md);
+
return 0;
}
@@ -3267,14 +3267,9 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data )
int mobskill_castend_pos( int tid, unsigned int tick, int id,int data )
{
struct mob_data* md=NULL;
- struct block_list *bl;
int range,maxcount;
- //mobskill_castend_id同様詠唱したMobが詠唱完了時にもういないというのはありそうなのでnullpoから除外
- if((bl=map_id2bl(id))==NULL)
- return 0;
-
- nullpo_retr(0, md=(struct mob_data *)bl);
+ nullpo_retr(0, md=(struct mob_data *)map_id2bl(id));
if( md->bl.type!=BL_MOB || md->bl.prev==NULL )
return 0;
@@ -3374,10 +3369,8 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx)
if(md->option&2 && skill_id!=TF_HIDING && skill_id!=AS_GRIMTOOTH && skill_id!=RG_BACKSTAP && skill_id!=RG_RAID)
return 0;
- if(map[md->bl.m].flag.gvg && (skill_id == SM_ENDURE || skill_id == AL_TELEPORT || skill_id == AL_WARP ||
- skill_id == WZ_ICEWALL || skill_id == TF_BACKSLIDING))
+ if(map[md->bl.m].flag.gvg && skill_db[skill_id].nocast & 4)
return 0;
-
if(skill_get_inf2(skill_id)&0x200 && md->bl.id == target->id)
return 0;
@@ -3423,8 +3416,9 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx)
md->bl.id, target->id, 0,0, skill_id,casttime);
// 詠唱反応モンスター
-/* if( target->type==BL_MOB && mob_db[(md2=(struct mob_data *)target)->class_].mode&0x10 &&
- md2->state.state!=MS_ATTACK){
+ // future homunculus support?
+/* if(md->master_id && target->type==BL_MOB && (md2=(struct mob_data *)target) &&
+ mob_db[md2->class_].mode&0x10 && md2->state.state!=MS_ATTACK){
md2->target_id=md->bl.id;
md->state.targettype = ATTACKABLE;
md2->min_chase=13;