- Modified a bit the hard/lazy ai triggers to match aegis:

- Mobs go into active AI when they are 2 cells from entering a player's view (ACTIVE_AI_RANGE)
- Mobs in passive AI no longer use skills.
- Mobs in passive AI do not random walk UNLESS they have entered active AI before (random walk frequency is not lost during passive AI).
- Added an additional check to prevent support skills from being blocked if the target has an armor element that blocks it.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11294 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2007-09-25 18:32:08 +00:00
parent 61e871da7f
commit dbfa221083
5 changed files with 23 additions and 6 deletions

View File

@ -4,6 +4,15 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/09/25 2007/09/25
* Modified a bit the hard/lazy ai triggers to match aegis (you can alter
these changing the defines near the beginning of mob.c):
- Mobs go into active AI when they are 2 cells from entering a player's
view (ACTIVE_AI_RANGE)
- Mobs in passive AI no longer use skills.
- Mobs in passive AI do not random walk UNLESS they have entered active AI
before (random walk frequency is not lost during passive AI).
* Added an additional check to prevent support skills from being blocked if
the target has an armor element that blocks it. [Skotlex]
* Fixed the double free's caused by r11290 (wrong option in the database * Fixed the double free's caused by r11290 (wrong option in the database
constructors). [FlavioJS] constructors). [FlavioJS]
* Corrected being able to cast multiple Gravitation Fields before the * Corrected being able to cast multiple Gravitation Fields before the

View File

@ -919,6 +919,7 @@ struct mob_data {
unsigned alchemist: 1; unsigned alchemist: 1;
unsigned no_random_walk: 1; unsigned no_random_walk: 1;
unsigned killer: 1; unsigned killer: 1;
unsigned spotted: 1;
unsigned char attacked_count; //For rude attacked. unsigned char attacked_count; //For rude attacked.
int provoke_flag; // Celest int provoke_flag; // Celest
} state; } state;

View File

@ -36,17 +36,18 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#define ACTIVE_AI_RANGE 2 //Distance added on top of 'AREA_SIZE' at which mobs enter active AI mode.
#define IDLE_SKILL_INTERVAL 10 //Active idle skills should be triggered every 1 second (1000/MIN_MOBTHINKTIME) #define IDLE_SKILL_INTERVAL 10 //Active idle skills should be triggered every 1 second (1000/MIN_MOBTHINKTIME)
#define MOB_LAZYSKILLPERC 10 // Probability for mobs far from players from doing their IDLE skill. (rate of 1000 minute) #define MOB_LAZYSKILLPERC 0 // Probability for mobs far from players from doing their IDLE skill. (rate of 1000 minute)
#define MOB_LAZYMOVEPERC 50 // Move probability in the negligent mode MOB (rate of 1000 minute) // Move probability for mobs away from players (rate of 1000 minute)
// in Aegis, this is 100% for mobs that have been activated by players and none otherwise.
#define MOB_LAZYMOVEPERC(md) (md->state.spotted?1000:0)
#define MOB_LAZYWARPPERC 20 // Warp probability in the negligent mode MOB (rate of 1000 minute) #define MOB_LAZYWARPPERC 20 // Warp probability in the negligent mode MOB (rate of 1000 minute)
#define MAX_MINCHASE 30 //Max minimum chase value to use for mobs. #define MAX_MINCHASE 30 //Max minimum chase value to use for mobs.
#define RUDE_ATTACKED_COUNT 2 //After how many rude-attacks should the skill be used? #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) //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) #define DEFAULT_ENEMY_TYPE(md) (md->special_state.ai?BL_CHAR:BL_PC|BL_HOM)
@ -1129,6 +1130,9 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
if(md->bl.prev == NULL || md->status.hp <= 0) if(md->bl.prev == NULL || md->status.hp <= 0)
return 1; return 1;
if(!md->state.spotted) //Hard AI triggered.
md->state.spotted = 1;
if (DIFF_TICK(tick, md->last_thinktime) < MIN_MOBTHINKTIME) if (DIFF_TICK(tick, md->last_thinktime) < MIN_MOBTHINKTIME)
return 0; return 0;
md->last_thinktime = tick; md->last_thinktime = tick;
@ -1367,7 +1371,7 @@ static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
{ {
unsigned int tick; unsigned int tick;
tick=va_arg(ap,unsigned int); tick=va_arg(ap,unsigned int);
map_foreachinrange(mob_ai_sub_hard,&sd->bl, AREA_SIZE*2, BL_MOB,tick); map_foreachinrange(mob_ai_sub_hard,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB,tick);
return 0; return 0;
} }
@ -1413,7 +1417,7 @@ static int mob_ai_sub_lazy(DBKey key,void * data,va_list ap)
// Since PC is in the same map, somewhat better negligent processing is carried out. // Since PC is in the same map, somewhat better negligent processing is carried out.
// It sometimes moves. // It sometimes moves.
if(rand()%1000<MOB_LAZYMOVEPERC) if(rand()%1000<MOB_LAZYMOVEPERC(md))
mob_randomwalk(md,tick); mob_randomwalk(md,tick);
else if(rand()%1000<MOB_LAZYSKILLPERC) //Chance to do a mob's idle skill. else if(rand()%1000<MOB_LAZYSKILLPERC) //Chance to do a mob's idle skill.
mobskill_use(md, tick, -1); mobskill_use(md, tick, -1);

View File

@ -1753,6 +1753,8 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case SP_NO_GEMSTONE: case SP_NO_GEMSTONE:
if(sd->state.lr_flag != 2) if(sd->state.lr_flag != 2)
sd->special_state.no_gemstone = 1; sd->special_state.no_gemstone = 1;
ShowDebug("Rate: %d\n", sd->special_state.no_gemstone);
break; break;
case SP_INTRAVISION: // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG] case SP_INTRAVISION: // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG]
if(sd->state.lr_flag != 2) { if(sd->state.lr_flag != 2) {

View File

@ -3485,6 +3485,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if (src!=bl && type > -1 && if (src!=bl && type > -1 &&
(i = skill_get_pl(skillid, skilllv)) > ELE_NEUTRAL && (i = skill_get_pl(skillid, skilllv)) > ELE_NEUTRAL &&
skill_get_inf(skillid) != INF_SUPPORT_SKILL &&
battle_attr_fix(NULL, NULL, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0) battle_attr_fix(NULL, NULL, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0)
return 1; //Skills that cause an status should be blocked if the target element blocks its element. return 1; //Skills that cause an status should be blocked if the target element blocks its element.