Hunter pet happiness set

This commit is contained in:
Yunfan Li
2023-12-25 18:48:51 +08:00
parent 111109b112
commit 3525e30305
3 changed files with 9 additions and 4 deletions

View File

@@ -679,7 +679,7 @@ void PlayerbotFactory::InitPet()
{
pet->InitStatsForLevel(bot->getLevel());
pet->SetLevel(bot->getLevel());
pet->SetPower(POWER_HAPPINESS, HAPPINESS_LEVEL_SIZE * 2);
pet->SetPower(POWER_HAPPINESS, pet->GetMaxPower(Powers(POWER_HAPPINESS)));
pet->SetHealth(pet->GetMaxHealth());
}
else

View File

@@ -105,6 +105,11 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
context->GetValue<Unit*>("current target")->Set(target);
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
bool attacked = bot->Attack(target, true);
if (!attacked) {
return false;
}
/* prevent pet dead immediately in group */
if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) {
with_pet = false;
@@ -130,10 +135,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
}
// bot->SetFacingToObject(target);
bool attacked = bot->Attack(target, true);
botAI->ChangeEngine(BOT_STATE_COMBAT);
return attacked;
return true;
}
bool AttackDuelOpponentAction::isUseful()

View File

@@ -31,7 +31,7 @@ bool FeedPetAction::Execute(Event event)
{
if (Pet* pet = bot->GetPet())
if (pet->getPetType() == HUNTER_PET && pet->GetHappinessState() != HAPPY)
pet->SetPower(POWER_HAPPINESS, HAPPINESS_LEVEL_SIZE * 2);
pet->SetPower(POWER_HAPPINESS, pet->GetMaxPower(Powers(POWER_HAPPINESS)));
return true;
}