Skip to content

Commit

Permalink
Vampires won't go to temple themselves
Browse files Browse the repository at this point in the history
Fixed a bug that caused vampires to occasionally go to the temple to
pray with the must_obey spell enabled. Now creatures don't ever go
randomly to the temple if they hate praying.
  • Loading branch information
Loobinex committed Aug 11, 2018
1 parent a49f03b commit a8d72ef
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/creature_jobs.c
Expand Up @@ -499,6 +499,13 @@ TbBool creature_will_reject_job(const struct Thing *creatng, CreatureJob jobpref
return (jobpref & crstat->jobs_not_do) != 0;
}

TbBool creature_dislikes_job(const struct Thing *creatng, CreatureJob jobpref)
{
struct CreatureStats *crstat;
crstat = creature_stats_get_from_thing(creatng);
return (jobpref & crstat->jobs_not_do) != 0;
}

TbBool is_correct_owner_to_perform_job(const struct Thing *creatng, PlayerNumber plyr_idx, CreatureJob new_job)
{
// Note that room required for job is not checked here on purpose.
Expand Down Expand Up @@ -1224,8 +1231,10 @@ TbBool attempt_job_secondary_preference(struct Thing *creatng, long jobpref)
CreatureJob new_job = Job_TEMPLE_PRAY;
if (creature_can_do_job_for_player(creatng, creatng->owner, new_job, JobChk_None))
{
if (send_creature_to_job_for_player(creatng, creatng->owner, new_job)) {
return true;
if (send_creature_to_job_for_player(creatng, creatng->owner, new_job))
{
if (!(creature_dislikes_job(creatng, new_job))){
return true; }
}
}
}
Expand Down

0 comments on commit a8d72ef

Please sign in to comment.