Added battle config pet_master_dead (fixes #1916)

* Added a new battle config that will allow or disallow (default) a pet to continue attacking its target if the master is dead.
Thanks to @technoken!
This commit is contained in:
aleos 2017-01-29 10:36:53 -05:00
parent bfab00a3c3
commit cb72a89fd5
4 changed files with 13 additions and 3 deletions

View File

@ -78,3 +78,6 @@ pet_disable_in_gvg: no
// Will does petskillattack2 fixed damage ignore plant infnite defense? (Note 1)
pet_ignore_infinite_def: yes
// Whether or not the pet will continue to attack when the master is dead. (Note 1)
pet_master_dead: no

View File

@ -8020,6 +8020,7 @@ static const struct _battle_data {
{ "pet_max_atk1", &battle_config.pet_max_atk1, 750, 0, INT_MAX, },
{ "pet_max_atk2", &battle_config.pet_max_atk2, 1000, 0, INT_MAX, },
{ "pet_disable_in_gvg", &battle_config.pet_no_gvg, 0, 0, 1, },
{ "pet_master_dead", &battle_config.pet_master_dead, 0, 0, 1, },
{ "skill_min_damage", &battle_config.skill_min_damage, 2|4, 0, 1|2|4, },
{ "finger_offensive_type", &battle_config.finger_offensive_type, 0, 0, 1, },
{ "heal_exp", &battle_config.heal_exp, 0, 0, INT_MAX, },

View File

@ -232,6 +232,7 @@ extern struct Battle_Config
int pet_max_atk2; //[Skotlex]
int pet_no_gvg; //Disables pets in gvg. [Skotlex]
int pet_equip_required;
int pet_master_dead;
int skill_min_damage;
int finger_offensive_type;

View File

@ -151,9 +151,9 @@ int pet_attackskill(struct pet_data *pd, int target_id)
/**
* Make sure pet can attack from given config values.
* @param sd : player requesting (owner)
* @param bl : target
* @param type : pet's attack rate type
* @param pd: pet data
* @param bl: target
* @param type: pet's attack rate type
* @return 0
*/
int pet_target_check(struct pet_data *pd,struct block_list *bl,int type)
@ -174,6 +174,11 @@ int pet_target_check(struct pet_data *pd,struct block_list *bl,int type)
!check_distance_bl(&pd->bl, bl, pd->db->range2))
return 0;
if (!battle_config.pet_master_dead && pc_isdead(pd->master)) {
pet_unlocktarget(pd);
return 0;
}
if (!status_check_skilluse(&pd->bl, bl, 0, 0))
return 0;