mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-17 02:40:28 +00:00
General improvement on init and strats (#1064)
* Potions strats and potions init * Druid and shaman spell in low level * Ammo init improvement * Rogue low level * Fix melee attack action (for caster with no mana) * Disable pet spells that reduce dps * Talents improvement * Remove CanFreeMove check * Reduce penalty for non-dagger weapon for rogue
This commit is contained in:
@@ -53,6 +53,16 @@ bool AttackMyTargetAction::Execute(Event event)
|
||||
|
||||
bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
{
|
||||
Unit* oldTarget = context->GetValue<Unit*>("current target")->Get();
|
||||
bool shouldMelee = bot->IsWithinMeleeRange(target) || botAI->IsMelee(bot);
|
||||
|
||||
bool sameTarget = oldTarget == target && bot->GetVictim() == target;
|
||||
bool inCombat = botAI->GetState() == BOT_STATE_COMBAT;
|
||||
bool sameAttackMode = bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING) == shouldMelee;
|
||||
// there's no reason to do attack again
|
||||
if (sameTarget && inCombat && sameAttackMode)
|
||||
return false;
|
||||
|
||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE ||
|
||||
bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||
{
|
||||
@@ -131,11 +141,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
ObjectGuid guid = target->GetGUID();
|
||||
bot->SetSelection(target->GetGUID());
|
||||
|
||||
Unit* oldTarget = context->GetValue<Unit*>("current target")->Get();
|
||||
bool melee = bot->IsWithinMeleeRange(target) || botAI->IsMelee(bot);
|
||||
|
||||
if (oldTarget == target && botAI->GetState() == BOT_STATE_COMBAT && bot->GetVictim() == target && (bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING) == melee))
|
||||
return false;
|
||||
|
||||
|
||||
context->GetValue<Unit*>("old target")->Set(oldTarget);
|
||||
|
||||
@@ -158,7 +164,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
}
|
||||
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
||||
|
||||
bot->Attack(target, melee);
|
||||
bot->Attack(target, shouldMelee);
|
||||
/* prevent pet dead immediately in group */
|
||||
// if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) {
|
||||
// with_pet = false;
|
||||
|
||||
@@ -51,11 +51,10 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
|
||||
continue;
|
||||
|
||||
bool shouldApply = true;
|
||||
// spellId == 4511 || spellId == 54424 || spellId == 57564 || spellId == 57565 ||
|
||||
// spellId == 57566 || spellId == 57567 ||
|
||||
// cat stealth, prowl
|
||||
if (spellId == 1742 || spellId == 24450)
|
||||
if (spellId == 1742 /*cower*/ || spellId == 24450 /*Prowl*/ ||
|
||||
spellId == 47482 /*Leap*/ /* || spellId == 47481 Gnaw*/)
|
||||
{
|
||||
|
||||
shouldApply = false;
|
||||
}
|
||||
bool isAutoCast = false;
|
||||
|
||||
@@ -2017,7 +2017,7 @@ Position MovementAction::BestPositionForMeleeToFlee(Position pos, float radius)
|
||||
if (currentTarget)
|
||||
{
|
||||
// Normally, move to left or right is the best position
|
||||
bool isTanking = (currentTarget->CanFreeMove()) && (currentTarget->GetVictim() == bot);
|
||||
bool isTanking = (!currentTarget->isFrozen() && !currentTarget->HasRootAura()) && (currentTarget->GetVictim() == bot);
|
||||
float angle = bot->GetAngle(currentTarget);
|
||||
float angleLeft = angle + (float)M_PI / 2;
|
||||
float angleRight = angle - (float)M_PI / 2;
|
||||
|
||||
@@ -63,7 +63,7 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni
|
||||
if (bot->CanUseItem(item) != EQUIP_ERR_OK)
|
||||
return false;
|
||||
|
||||
if (bot->IsNonMeleeSpellCast(true))
|
||||
if (bot->IsNonMeleeSpellCast(false))
|
||||
return false;
|
||||
|
||||
uint8 bagIndex = item->GetBagSlot();
|
||||
|
||||
Reference in New Issue
Block a user