- Fixed skill_delayfix not altering delay at all after you reached 150.

- Applied ers to pet loot drops.
- Cleaned up the pet loot drop function.
- Mob skill state MSS_ANY won't include MSS_DEAD now.
- Added mob skill state MSS_ANYTARGET ("anytarget") which means any state (except dead) on which the mob has a target set.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6250 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-04-24 14:52:11 +00:00
parent c56c5f2b68
commit 9f19b5cfdc
7 changed files with 107 additions and 77 deletions

View File

@ -2,6 +2,14 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
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.
2006/04/24
* Fixed skill_delayfix not altering delay at all after you reached 150.
[Skotlex]
* Applied ers to pet loot drops and cleaned up the pet loot drop function.
[Skotlex]
* Mob skill state MSS_ANY won't include MSS_DEAD now. [Skotlex]
* Added mob skill state MSS_ANYTARGET ("anytarget") which means any state
(except dead) on which the mob has a target set. [Skotlex]
2006/04/23 2006/04/23
* Added new column to mob_db Sprite_Name to hold the mob's sprite name. * Added new column to mob_db Sprite_Name to hold the mob's sprite name.
Columns Name and JName now hold the mob's english and kro names Columns Name and JName now hold the mob's english and kro names

View File

@ -8,10 +8,11 @@
//delay is the time in milliseconds that has to be pass before recasting the same skill. //delay is the time in milliseconds that has to be pass before recasting the same skill.
// //
//STATE: //STATE:
// any / idle (in standby) / walk (in movement) / dead (on killed) / loot / // any (except dead) / idle (in standby) / walk (in movement) / dead (on killed) /
// attack / angry (like attack, except player has not attacked mob yet) / // loot /attack / angry (like attack, except player has not attacked mob yet) /
// chase (following target, after being attacked) / follow (following // chase (following target, after being attacked) / follow (following
// target, without being attacked) // target, without being attacked)
// anytarget (attack+angry+chase+follow)
// //
//target: The target of the skill can be: target (when a PC is targetted) / self / friend / master //target: The target of the skill can be: target (when a PC is targetted) / self / friend / master
// (the following are for ground-skills, a random target tile is selected from // (the following are for ground-skills, a random target tile is selected from

View File

@ -1382,23 +1382,6 @@ static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
return 0; return 0;
} }
/*==========================================
* The structure object for item drop with delay
* Since it is only two being able to pass [ int ] a timer function
* Data is put in and passed to this structure object.
*------------------------------------------
*/
struct item_drop {
struct item item_data;
struct item_drop *next;
};
struct item_drop_list {
int m,x,y;
struct map_session_data *first_sd,*second_sd,*third_sd;
struct item_drop *item;
};
/*========================================== /*==========================================
* Initializes the delay drop structure for mob-dropped items. * Initializes the delay drop structure for mob-dropped items.
*------------------------------------------ *------------------------------------------
@ -2617,10 +2600,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
if (DIFF_TICK(tick, md->skilldelay[i]) < ms[i].delay) if (DIFF_TICK(tick, md->skilldelay[i]) < ms[i].delay)
continue; continue;
// <20>óÔ”»è if (ms[i].state != md->state.skillstate && md->state.skillstate != MSS_DEAD) {
if (ms[i].state != MSS_ANY && ms[i].state != md->state.skillstate) if (ms[i].state == MSS_ANY || (ms[i].state == MSS_ANYTARGET && md->target_id))
; //ANYTARGET works with any state as long as there's a target. [Skotlex]
else
continue; continue;
}
if (rand() % 10000 > ms[i].permillage) //Lupus (max value = 10000) if (rand() % 10000 > ms[i].permillage) //Lupus (max value = 10000)
continue; continue;
@ -3478,7 +3463,7 @@ static int mob_readskilldb(void)
{ "hiding", SC_HIDING }, { "hiding", SC_HIDING },
{ "sight", SC_SIGHT }, { "sight", SC_SIGHT },
}, state[] = { }, state[] = {
{ "any", MSS_ANY }, { "any", MSS_ANY }, //All states except Dead
{ "idle", MSS_IDLE }, { "idle", MSS_IDLE },
{ "walk", MSS_WALK }, { "walk", MSS_WALK },
{ "loot", MSS_LOOT }, { "loot", MSS_LOOT },
@ -3487,6 +3472,7 @@ static int mob_readskilldb(void)
{ "angry", MSS_ANGRY }, //Preemptive attack (aggressive mobs) { "angry", MSS_ANGRY }, //Preemptive attack (aggressive mobs)
{ "chase", MSS_RUSH }, //Chase escaping target { "chase", MSS_RUSH }, //Chase escaping target
{ "follow", MSS_FOLLOW }, //Preemptive chase (aggressive mobs) { "follow", MSS_FOLLOW }, //Preemptive chase (aggressive mobs)
{ "anytarget",MSS_ANYTARGET }, //Berserk+Angry+Rush+Follow
}, target[] = { }, target[] = {
{ "target", MST_TARGET }, { "target", MST_TARGET },
{ "self", MST_SELF }, { "self", MST_SELF },

View File

@ -106,6 +106,25 @@ enum {
MSS_ANGRY, //Mob retaliating from being attacked. MSS_ANGRY, //Mob retaliating from being attacked.
MSS_RUSH, //Mob following a player after being attacked. MSS_RUSH, //Mob following a player after being attacked.
MSS_FOLLOW, //Mob following a player without being attacked. MSS_FOLLOW, //Mob following a player without being attacked.
MSS_ANYTARGET,
};
/*==========================================
* The structure object for item drop with delay
* Since it is only two being able to pass [ int ] a timer function
* Data is put in and passed to this structure object.
*------------------------------------------
*/
struct item_drop {
struct item item_data;
struct item_drop *next;
};
struct item_drop_list {
int m,x,y;
struct map_session_data *first_sd,*second_sd,*third_sd;
struct item_drop *item;
}; };
struct mob_db* mob_db(int class_); struct mob_db* mob_db(int class_);

View File

@ -10,6 +10,7 @@
#include "../common/nullpo.h" #include "../common/nullpo.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/ers.h"
#include "pc.h" #include "pc.h"
#include "status.h" #include "status.h"
@ -29,6 +30,9 @@
struct pet_db pet_db[MAX_PET_DB]; struct pet_db pet_db[MAX_PET_DB];
static struct eri *item_drop_ers; //For loot drops delay structures.
static struct eri *item_drop_list_ers;
static int dirx[8]={0,-1,-1,-1,0,1,1,1}; static int dirx[8]={0,-1,-1,-1,0,1,1,1};
static int diry[8]={1,1,0,-1,-1,-1,0,1}; static int diry[8]={1,1,0,-1,-1,-1,0,1};
@ -321,18 +325,6 @@ int pet_hungry_timer_delete(struct map_session_data *sd)
return 0; return 0;
} }
struct delay_item_drop {
int m,x,y;
int nameid,amount;
struct map_session_data *first_sd,*second_sd,*third_sd;
};
struct delay_item_drop2 {
int m,x,y;
struct item item_data;
struct map_session_data *first_sd,*second_sd,*third_sd;
};
int pet_performance(struct map_session_data *sd) int pet_performance(struct map_session_data *sd)
{ {
struct pet_data *pd; struct pet_data *pd;
@ -1082,31 +1074,57 @@ int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
return 0; return 0;
} }
static int pet_delay_item_drop(int tid,unsigned int tick,int id,int data)
{
struct item_drop_list *list;
struct item_drop *ditem, *ditem_prev;
list=(struct item_drop_list *)id;
ditem = list->item;
while (ditem) {
map_addflooritem(&ditem->item_data,ditem->item_data.amount,
list->m,list->x,list->y,
list->first_sd,list->second_sd,list->third_sd,0);
ditem_prev = ditem;
ditem = ditem->next;
ers_free(item_drop_ers, ditem_prev);
}
ers_free(item_drop_list_ers, list);
return 0;
}
int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd) int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
{ {
int i,flag=0; int i,flag=0;
struct delay_item_drop2 *ditem_floor, ditem; struct item_drop_list *dlist;
if(pd && pd->loot && pd->loot->count) { struct item_drop *ditem;
memset(&ditem, 0, sizeof(struct delay_item_drop2)); struct item *it;
ditem.m = pd->bl.m; if(!pd || !pd->loot || !pd->loot->count)
ditem.x = pd->bl.x; return 0;
ditem.y = pd->bl.y; dlist = ers_alloc(item_drop_list_ers, struct item_drop_list);
ditem.first_sd = 0; dlist->m = pd->bl.m;
ditem.second_sd = 0; dlist->x = pd->bl.x;
ditem.third_sd = 0; dlist->y = pd->bl.y;
dlist->first_sd = NULL;
dlist->second_sd = NULL;
dlist->third_sd = NULL;
dlist->item = NULL;
for(i=0;i<pd->loot->count;i++) { for(i=0;i<pd->loot->count;i++) {
memcpy(&ditem.item_data,&pd->loot->item[i],sizeof(pd->loot->item[0])); it = &pd->loot->item[i];
// 落とさないで直接PCのItem欄へ
if(sd){ if(sd){
if((flag = pc_additem(sd,&ditem.item_data,ditem.item_data.amount))){ if((flag = pc_additem(sd,it,it->amount))){
clif_additem(sd,0,0,flag); clif_additem(sd,0,0,flag);
map_addflooritem(&ditem.item_data,ditem.item_data.amount,ditem.m,ditem.x,ditem.y,ditem.first_sd,ditem.second_sd,ditem.third_sd,0); ditem = ers_alloc(item_drop_ers, struct item_drop);
memcpy(&ditem->item_data, it, sizeof(struct item));
ditem->next = dlist->item;
dlist->item = ditem->next;
} }
} }
else { else {
ditem_floor=(struct delay_item_drop2 *)aCalloc(1,sizeof(struct delay_item_drop2)); ditem = ers_alloc(item_drop_ers, struct item_drop);
memcpy(ditem_floor, &ditem, sizeof(struct delay_item_drop2)); memcpy(&ditem->item_data, it, sizeof(struct item));
add_timer(gettick()+540+i,pet_delay_item_drop2,(int)ditem_floor,0); ditem->next = dlist->item;
dlist->item = ditem->next;
} }
} }
//The smart thing to do is use pd->loot->max (thanks for pointing it out, Shinomori) //The smart thing to do is use pd->loot->max (thanks for pointing it out, Shinomori)
@ -1114,22 +1132,14 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
pd->loot->count = 0; pd->loot->count = 0;
pd->loot->weight = 0; pd->loot->weight = 0;
pd->ud.canact_tick = gettick()+10000; // 10*1000msÌŠÔ<C5A0>EíÈ¢ pd->ud.canact_tick = gettick()+10000; // 10*1000msÌŠÔ<C5A0>EíÈ¢
}
if (dlist->item)
add_timer(gettick()+540,pet_delay_item_drop,(int)dlist,0);
else
ers_free(item_drop_list_ers, dlist);
return 1; return 1;
} }
int pet_delay_item_drop2(int tid,unsigned int tick,int id,int data)
{
struct delay_item_drop2 *ditem;
ditem=(struct delay_item_drop2 *)id;
map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
aFree(ditem);
return 0;
}
/*========================================== /*==========================================
* pet bonus giving skills [Valaris] / Rewritten by [Skotlex] * pet bonus giving skills [Valaris] / Rewritten by [Skotlex]
*------------------------------------------ *------------------------------------------
@ -1384,10 +1394,13 @@ int do_init_pet(void)
memset(pet_db,0,sizeof(pet_db)); memset(pet_db,0,sizeof(pet_db));
read_petdb(); read_petdb();
item_drop_ers = ers_new((uint32)sizeof(struct item_drop));
item_drop_list_ers = ers_new((uint32)sizeof(struct item_drop_list));
add_timer_func_list(pet_hungry,"pet_hungry"); add_timer_func_list(pet_hungry,"pet_hungry");
add_timer_func_list(pet_ai_hard,"pet_ai_hard"); add_timer_func_list(pet_ai_hard,"pet_ai_hard");
add_timer_func_list(pet_skill_bonus_timer,"pet_skill_bonus_timer"); // [Valaris] add_timer_func_list(pet_skill_bonus_timer,"pet_skill_bonus_timer"); // [Valaris]
add_timer_func_list(pet_delay_item_drop2,"pet_delay_item_drop2"); add_timer_func_list(pet_delay_item_drop,"pet_delay_item_drop");
add_timer_func_list(pet_skill_support_timer, "pet_skill_support_timer"); // [Skotlex] add_timer_func_list(pet_skill_support_timer, "pet_skill_support_timer"); // [Skotlex]
add_timer_func_list(pet_recovery_timer,"pet_recovery_timer"); // [Valaris] add_timer_func_list(pet_recovery_timer,"pet_recovery_timer"); // [Valaris]
add_timer_func_list(pet_heal_timer,"pet_heal_timer"); // [Valaris] add_timer_func_list(pet_heal_timer,"pet_heal_timer"); // [Valaris]
@ -1404,5 +1417,7 @@ int do_final_pet(void) {
pet_db[i].script = NULL; pet_db[i].script = NULL;
} }
} }
ers_destroy(item_drop_ers);
ers_destroy(item_drop_list_ers);
return 0; return 0;
} }

View File

@ -52,7 +52,6 @@ int pet_equipitem(struct map_session_data *sd,int index);
int pet_unequipitem(struct map_session_data *sd); int pet_unequipitem(struct map_session_data *sd);
int pet_food(struct map_session_data *sd); int pet_food(struct map_session_data *sd);
int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd); int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd);
int pet_delay_item_drop2(int tid,unsigned int tick,int id,int data);
int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap); int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap);
int pet_attackskill(struct pet_data *pd, int target_id); int pet_attackskill(struct pet_data *pd, int target_id);
int pet_skill_support_timer(int tid, unsigned int tick, int id, int data); // [Skotlex] int pet_skill_support_timer(int tid, unsigned int tick, int id, int data); // [Skotlex]

View File

@ -8330,6 +8330,8 @@ int skill_delayfix(struct block_list *bl, int skill_id, int skill_lv)
int scale = battle_config.castrate_dex_scale - status_get_dex(bl); int scale = battle_config.castrate_dex_scale - status_get_dex(bl);
if (scale > 0) if (scale > 0)
time = time * scale / battle_config.castrate_dex_scale; time = time * scale / battle_config.castrate_dex_scale;
else //To be capped later to minimum.
time = 0;
} }
if (bl->type == BL_PC && ((TBL_PC*)bl)->delayrate != 100) if (bl->type == BL_PC && ((TBL_PC*)bl)->delayrate != 100)