optimize class spell

This commit is contained in:
Yunfan Li
2023-09-08 12:44:38 +08:00
parent 762ac0142b
commit 243a4df967
20 changed files with 169 additions and 97 deletions

View File

@@ -940,13 +940,13 @@ void PlayerbotAI::ChangeEngine(BotState type)
switch (type)
{
case BOT_STATE_COMBAT:
LOG_DEBUG("playerbots", "=== {} COMBAT ===", bot->GetName().c_str());
// LOG_DEBUG("playerbots", "=== {} COMBAT ===", bot->GetName().c_str());
break;
case BOT_STATE_NON_COMBAT:
LOG_DEBUG("playerbots", "=== {} NON-COMBAT ===", bot->GetName().c_str());
// LOG_DEBUG("playerbots", "=== {} NON-COMBAT ===", bot->GetName().c_str());
break;
case BOT_STATE_DEAD:
LOG_DEBUG("playerbots", "=== {} DEAD ===", bot->GetName().c_str());
// LOG_DEBUG("playerbots", "=== {} DEAD ===", bot->GetName().c_str());
break;
}
}
@@ -2060,18 +2060,18 @@ bool PlayerbotAI::CanCastSpell(std::string const name, Unit* target, Item* itemT
bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, Item* itemTarget)
{
if (!spellid) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. No spellid. - spellid: {}, bot name: {}",
// spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Can cast spell failed. No spellid. - spellid: {}, bot name: {}",
spellid, bot->GetName());
}
return false;
}
if (bot->HasUnitState(UNIT_STATE_LOST_CONTROL)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Unit state lost control. - spellid: {}, bot name: {}",
// spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Can cast spell failed. Unit state lost control. - spellid: {}, bot name: {}",
spellid, bot->GetName());
}
return false;
}
@@ -2079,7 +2079,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
if (!target)
target = bot;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup())
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// LOG_DEBUG("playerbots", "Can cast spell? - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
@@ -2088,42 +2088,42 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
return true;
if (checkHasSpell && !bot->HasSpell(spellid)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Bot not has spell. - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Can cast spell failed. Bot not has spell. - target name: {}, spellid: {}, bot name: {}",
target->GetName(), spellid, bot->GetName());
}
return false;
}
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr) {
// LOG_DEBUG("playerbots", "CanCastSpell() target name: {}, spellid: {}, bot name: {}, failed because has current channeled spell",
// target->GetName(), spellid, bot->GetName());
LOG_DEBUG("playerbots", "CanCastSpell() target name: {}, spellid: {}, bot name: {}, failed because has current channeled spell",
target->GetName(), spellid, bot->GetName());
return false;
}
if (bot->HasSpellCooldown(spellid)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Spell not has cooldown. - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Can cast spell failed. Spell not has cooldown. - target name: {}, spellid: {}, bot name: {}",
target->GetName(), spellid, bot->GetName());
}
return false;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "Can cast spell failed. No spellInfo. - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Can cast spell failed. No spellInfo. - target name: {}, spellid: {}, bot name: {}",
target->GetName(), spellid, bot->GetName());
}
return false;
}
uint32 CastingTime = !spellInfo->IsChanneled() ? spellInfo->CalcCastTime(bot) : spellInfo->GetDuration();
if (CastingTime && bot->isMoving()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "Casting time and bot is moving - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Casting time and bot is moving - target name: {}, spellid: {}, bot name: {}",
target->GetName(), spellid, bot->GetName());
}
return false;
}
@@ -2147,10 +2147,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
// }
if (target->IsImmunedToSpell(spellInfo)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "target is immuned to spell - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "target is immuned to spell - target name: {}, spellid: {}, bot name: {}",
target->GetName(), spellid, bot->GetName());
}
return false;
}
@@ -2159,7 +2159,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
// for (uint8 i = EFFECT_0; i <= EFFECT_2; i++)
// {
// if (target->IsImmunedToSpellEffect(spellInfo, i)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "target is immuned to spell effect - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
// }
@@ -2169,10 +2169,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
// }
if (bot != target && sServerFacade->GetDistance2d(bot, target) > sPlayerbotAIConfig->sightDistance) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "target is out of sight distance - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "target is out of sight distance - target name: {}, spellid: {}, bot name: {}",
target->GetName(), spellid, bot->GetName());
}
return false;
}
}
@@ -2188,7 +2188,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
SpellCastResult result = spell->CheckCast(true);
delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
// LOG_DEBUG("playerbots", "CanCastSpell - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellid, bot->GetName(), result);
@@ -2209,12 +2209,11 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
case SPELL_FAILED_NOT_SHAPESHIFT:
return true;
default:
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
// LOG_DEBUG("playerbots", "CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellid, bot->GetName(), result);
// }
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
LOG_DEBUG("playerbots", "CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
target->GetName(), spellid, bot->GetName(), result);
}
return false;
}
}
@@ -2381,7 +2380,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
aiObjectContext->GetValue<time_t>("stay time")->Set(0);
if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast is flying - target name: {}, spellid: {}, bot name: {}}",
// target->GetName(), spellId, bot->GetName());
// }
@@ -2411,7 +2410,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
if (failWithDelay)
{
SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast fail with delay - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellId, bot->GetName());
// }
@@ -2430,7 +2429,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
{
bot->GetTradeData()->SetSpell(spellId);
delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast no item - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellId, bot->GetName());
// }
@@ -2485,7 +2484,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// spell->m_targets.SetUnitTarget(target);
// SpellCastResult spellSuccess = spell->CheckCast(true);
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast result - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellId, bot->GetName(), spellSuccess);
// }
@@ -2495,7 +2494,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
SpellCastResult result = spell->prepare(&targets);
if (result != SPELL_CAST_OK) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellId, bot->GetName(), result);
// }
@@ -2508,7 +2507,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// {
// spell->cancel();
// delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast loot - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellId, bot->GetName());
// }

View File

@@ -206,11 +206,11 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls
player->setCinematic(2);
player->SetAtLoginFlag(AT_LOGIN_NONE);
// player->SaveToDB(true, false);
// if (player->getClass() == CLASS_DEATH_KNIGHT)
// {
// player->learnSpell(50977, false);
// }
player->SaveToDB(true, false);
if (player->getClass() == CLASS_DEATH_KNIGHT)
{
player->learnSpell(50977, false);
}
// player->RewardQuest(const Quest *quest, uint32 reward, Object *questGiver)
LOG_DEBUG("playerbots", "Random bot created for account {} - name: \"{}\"; race: {}; class: {}", accountId, name.c_str(), race, cls);

View File

@@ -63,10 +63,10 @@ bool CastSpellAction::Execute(Event event)
bool CastSpellAction::isPossible()
{
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}",
// bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}",
bot->GetName());
}
return false;
}
@@ -75,10 +75,10 @@ bool CastSpellAction::isPossible()
if (spell == "mount" && bot->IsInCombat())
{
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}",
// bot->GetName());
// }
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster())) {
LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}",
bot->GetName());
}
bot->Dismount();
return false;
}

View File

@@ -66,10 +66,10 @@ class CastDebuffSpellOnAttackerAction : public CastDebuffSpellAction
// ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
};
class CastDebuffSpellOnMeleeAttackerAction : public CastAuraSpellAction
class CastDebuffSpellOnMeleeAttackerAction : public CastDebuffSpellAction
{
public:
CastDebuffSpellOnMeleeAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true) : CastAuraSpellAction(botAI, spell, isOwner) { }
CastDebuffSpellOnMeleeAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true, float needLifeTime = 8.0f) : CastDebuffSpellAction(botAI, spell, isOwner, needLifeTime) { }
Value<Unit*>* GetTargetValue() override;
std::string const getName() override { return spell + " on attacker"; }

View File

@@ -80,12 +80,14 @@ BloodDKStrategy::BloodDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI)
NextAction** BloodDKStrategy::getDefaultActions()
{
return NextAction::array(0,
new NextAction("rune strike", ACTION_NORMAL + 7),
new NextAction("icy touch", ACTION_NORMAL + 6),
new NextAction("heart strike", ACTION_NORMAL + 5),
new NextAction("blood strike", ACTION_NORMAL + 4),
new NextAction("rune strike", ACTION_NORMAL + 8),
new NextAction("icy touch", ACTION_NORMAL + 7),
new NextAction("heart strike", ACTION_NORMAL + 6),
new NextAction("blood strike", ACTION_NORMAL + 5),
new NextAction("dancing rune weapon", ACTION_NORMAL + 4),
new NextAction("death coil", ACTION_NORMAL + 3),
new NextAction("plague strike", ACTION_NORMAL + 2),
new NextAction("horn of winter", ACTION_NORMAL + 1),
new NextAction("melee", ACTION_NORMAL),
NULL);
}

View File

@@ -113,17 +113,23 @@ class CastIcyTouchAction : public CastSpellAction
class CastIcyTouchOnAttackerAction : public CastDebuffSpellOnMeleeAttackerAction
{
public:
CastIcyTouchOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "icy touch", true) { }
CastIcyTouchOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "icy touch", true, .0f) { }
};
//debuff ps
BEGIN_DEBUFF_ACTION(CastPlagueStrikeAction, "plague strike")
END_SPELL_ACTION()
class CastPlagueStrikeAction : public CastSpellAction
{
public:
CastPlagueStrikeAction(PlayerbotAI* ai) : CastSpellAction(ai, "plague strike") {}
};
// BEGIN_DEBUFF_ACTION(CastPlagueStrikeAction, "plague strike")
// END_SPELL_ACTION()
class CastPlagueStrikeOnAttackerAction : public CastDebuffSpellOnMeleeAttackerAction
{
public:
CastPlagueStrikeOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "plague strike", true) { }
CastPlagueStrikeOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "plague strike", true, .0f) { }
};
//debuff
@@ -142,10 +148,10 @@ class CastUnholyBlightAction : public CastBuffSpellAction
CastUnholyBlightAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "unholy blight") { }
};
class CastSummonGargoyleAction : public CastBuffSpellAction
class CastSummonGargoyleAction : public CastSpellAction
{
public:
CastSummonGargoyleAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "summon gargoyle") { }
CastSummonGargoyleAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "summon gargoyle") { }
};
class CastGhoulFrenzyAction : public CastBuffSpellAction
@@ -230,10 +236,10 @@ class CastDeathAndDecayAction : public CastSpellAction
CastDeathAndDecayAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "death and decay") { }
};
class CastHornOfWinterAction : public CastBuffSpellAction
class CastHornOfWinterAction : public CastSpellAction
{
public:
CastHornOfWinterAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "horn of winter") { }
CastHornOfWinterAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "horn of winter") { }
};
class CastImprovedIcyTalonsAction : public CastBuffSpellAction
@@ -260,10 +266,10 @@ class CastDeathRuneMasteryAction : public CastBuffSpellAction
CastDeathRuneMasteryAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "death rune mastery") { }
};
class CastDancingWeaponAction : public CastBuffSpellAction
class CastDancingRuneWeaponAction : public CastSpellAction
{
public:
CastDancingWeaponAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "dancing weapon") { }
CastDancingRuneWeaponAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "dancing rune weapon") { }
};
class CastEmpowerRuneWeaponAction : public CastBuffSpellAction

View File

@@ -85,6 +85,8 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext<Trigger>
creators["raise dead"] = &DeathKnightTriggerFactoryInternal::raise_dead;
creators["chains of ice"] = &DeathKnightTriggerFactoryInternal::chains_of_ice;
creators["unbreakable armor"] = &DeathKnightTriggerFactoryInternal::unbreakable_armor;
creators["high blood rune"] = &DeathKnightTriggerFactoryInternal::high_blood_rune;
creators["freezing fog"] = &DeathKnightTriggerFactoryInternal::freezing_fog;
}
private:
@@ -106,6 +108,9 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext<Trigger>
static Trigger* raise_dead(PlayerbotAI* botAI) { return new RaiseDeadTrigger(botAI); }
static Trigger* chains_of_ice(PlayerbotAI* botAI) { return new ChainsOfIceSnareTrigger(botAI); }
static Trigger* unbreakable_armor(PlayerbotAI* botAI) { return new UnbreakableArmorTrigger(botAI); }
static Trigger* high_blood_rune(PlayerbotAI* botAI) { return new HighBloodRuneTrigger(botAI); }
static Trigger* freezing_fog(PlayerbotAI* botAI) { return new FreezingFogTrigger(botAI); }
};
class DeathKnightAiObjectContextInternal : public NamedObjectContext<Action>
@@ -164,7 +169,7 @@ class DeathKnightAiObjectContextInternal : public NamedObjectContext<Action>
creators["death pact"] = &DeathKnightAiObjectContextInternal::death_pact;
creators["death rune_mastery"] = &DeathKnightAiObjectContextInternal::death_rune_mastery;
//creators["hysteria"] = &DeathKnightAiObjectContextInternal::hysteria;
creators["dancing weapon"] = &DeathKnightAiObjectContextInternal::dancing_weapon;
creators["dancing rune weapon"] = &DeathKnightAiObjectContextInternal::dancing_rune_weapon;
creators["dark command"] = &DeathKnightAiObjectContextInternal::dark_command;
}
@@ -221,7 +226,7 @@ class DeathKnightAiObjectContextInternal : public NamedObjectContext<Action>
static Action* death_pact(PlayerbotAI* botAI) { return new CastDeathPactAction(botAI); }
static Action* death_rune_mastery(PlayerbotAI* botAI) { return new CastDeathRuneMasteryAction(botAI); }
//static Action* hysteria(PlayerbotAI* botAI) { return new CastHysteriaAction(botAI); }
static Action* dancing_weapon(PlayerbotAI* botAI) { return new CastDancingWeaponAction(botAI); }
static Action* dancing_rune_weapon(PlayerbotAI* botAI) { return new CastDancingRuneWeaponAction(botAI); }
static Action* dark_command(PlayerbotAI* botAI) { return new CastDarkCommandAction(botAI); }
static Action* mind_freeze_on_enemy_healer(PlayerbotAI* botAI) { return new CastMindFreezeOnEnemyHealerAction(botAI); }
};

View File

@@ -27,4 +27,9 @@ bool PestilenceTrigger::IsActive() {
return true;
}
return false;
}
bool HighBloodRuneTrigger::IsActive() {
// bot->Say(std::to_string(bot->GetBaseRune(0)) + "_" + std::to_string(bot->GetRuneCooldown(0)) + " " + std::to_string(bot->GetBaseRune(1)) + "_" + std::to_string(bot->GetRuneCooldown(1)), LANG_UNIVERSAL);
return !bot->GetRuneCooldown(0) && !bot->GetRuneCooldown(1);
}

View File

@@ -12,19 +12,31 @@ class PlayerbotAI;
BUFF_TRIGGER(HornOfWinterTrigger, "horn of winter");
BUFF_TRIGGER(BoneShieldTrigger, "bone shield");
BUFF_TRIGGER(ImprovedIcyTalonsTrigger, "improved icy talons");
DEBUFF_CHECKISOWNER_TRIGGER(PlagueStrikeDebuffTrigger, "blood plague");
DEBUFF_CHECKISOWNER_TRIGGER(IcyTouchDebuffTrigger, "frost fever");
// DEBUFF_CHECKISOWNER_TRIGGER(PlagueStrikeDebuffTrigger, "blood plague");
class PlagueStrikeDebuffTrigger : public DebuffTrigger
{
public:
PlagueStrikeDebuffTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "blood plague", true, .0f) { }
};
// DEBUFF_CHECKISOWNER_TRIGGER(IcyTouchDebuffTrigger, "frost fever");
class IcyTouchDebuffTrigger : public DebuffTrigger
{
public:
IcyTouchDebuffTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "frost fever", true, .0f) { }
};
BUFF_TRIGGER(UnbreakableArmorTrigger, "unbreakable armor");
class PlagueStrikeDebuffOnAttackerTrigger : public DebuffOnMeleeAttackerTrigger
{
public:
PlagueStrikeDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "blood plague", true) { }
PlagueStrikeDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "blood plague", true, .0f) { }
};
class IcyTouchDebuffOnAttackerTrigger : public DebuffOnMeleeAttackerTrigger
{
public:
IcyTouchDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "frost fever", true) { }
IcyTouchDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "frost fever", true, .0f) { }
};
class DKPresenceTrigger : public BuffTrigger
@@ -114,4 +126,17 @@ class StrangulateOnEnemyHealerTrigger : public InterruptEnemyHealerTrigger
StrangulateOnEnemyHealerTrigger(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, "strangulate") { }
};
class HighBloodRuneTrigger : public Trigger
{
public:
HighBloodRuneTrigger(PlayerbotAI* botAI) : Trigger(botAI, "high blood rune") { }
bool IsActive() override;
};
class FreezingFogTrigger : public HasAuraTrigger
{
public:
FreezingFogTrigger(PlayerbotAI* botAI) : HasAuraTrigger(botAI, "freezing fog") { }
};
#endif

View File

@@ -82,6 +82,7 @@ NextAction** FrostDKStrategy::getDefaultActions()
new NextAction("frost strike", ACTION_NORMAL + 4),
// new NextAction("death strike", ACTION_NORMAL + 3),
new NextAction("empower rune weapon", ACTION_NORMAL + 2),
new NextAction("horn of winter", ACTION_NORMAL),
new NextAction("melee", ACTION_NORMAL),
NULL
);
@@ -91,6 +92,9 @@ void FrostDKStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
GenericDKStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("unbreakable armor", NextAction::array(0, new NextAction("unbreakable armor", ACTION_NORMAL + 4), nullptr)));
triggers.push_back(new TriggerNode("high blood rune", NextAction::array(0, new NextAction("blood strike", ACTION_NORMAL + 1), nullptr)));
triggers.push_back(new TriggerNode("freezing fog", NextAction::array(0, new NextAction("howling blast", ACTION_HIGH + 1), nullptr)));
// triggers.push_back(new TriggerNode("empower rune weapon", NextAction::array(0, new NextAction("empower rune weapon", ACTION_NORMAL + 4), nullptr)));
}

View File

@@ -72,12 +72,14 @@ UnholyDKStrategy::UnholyDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI
NextAction** UnholyDKStrategy::getDefaultActions()
{
return NextAction::array(0,
new NextAction("scourge strike", ACTION_NORMAL + 6),
new NextAction("blood strike", ACTION_NORMAL + 5),
new NextAction("ghoul frenzy", ACTION_NORMAL + 4),
new NextAction("scourge strike", ACTION_NORMAL + 7),
new NextAction("blood strike", ACTION_NORMAL + 6),
new NextAction("ghoul frenzy", ACTION_NORMAL + 5),
new NextAction("summon gargoyle", ACTION_NORMAL + 4),
new NextAction("death coil", ACTION_NORMAL + 3),
new NextAction("plague strike", ACTION_NORMAL + 2),
new NextAction("icy touch", ACTION_NORMAL + 1),
new NextAction("icy touch", ACTION_NORMAL + 1),
new NextAction("horn of winter", ACTION_NORMAL),
new NextAction("melee", ACTION_NORMAL),
nullptr);
}

View File

@@ -136,6 +136,7 @@ class CastHurricaneAction : public CastSpellAction
{
public:
CastHurricaneAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "hurricane") { }
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
};
class CastMoonfireAction : public CastDebuffSpellAction

View File

@@ -17,6 +17,8 @@ class GenericDruidNonCombatStrategyActionNodeFactory : public NamedObjectFactory
// creators["innervate"] = &innervate;
creators["regrowth_on_party"] = &regrowth_on_party;
creators["rejuvenation on party"] = &rejuvenation_on_party;
creators["remove curse on party"] = &remove_curse_on_party;
creators["abolish poison on party"] = &abolish_poison_on_party;
}
private:
@@ -65,6 +67,20 @@ class GenericDruidNonCombatStrategyActionNodeFactory : public NamedObjectFactory
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* remove_curse_on_party(PlayerbotAI* ai)
{
return new ActionNode ("remove curse on party",
/*P*/ NextAction::array(0, new NextAction("caster form"), nullptr),
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* abolish_poison_on_party(PlayerbotAI* ai)
{
return new ActionNode ("abolish poison on party",
/*P*/ NextAction::array(0, new NextAction("caster form"), nullptr),
/*A*/ NULL,
/*C*/ NULL);
}
// static ActionNode* innervate([[maybe_unused]] PlayerbotAI* botAI)
// {
// return new ActionNode ("innervate",
@@ -84,7 +100,7 @@ void GenericDruidNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& trig
NonCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("mark of the wild", NextAction::array(0, new NextAction("mark of the wild", 14.0f), nullptr)));
triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", 12.0f), nullptr)));
// triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", 12.0f), nullptr)));
// triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("abolish poison", 21.0f), nullptr)));
triggers.push_back(new TriggerNode("party member cure poison", NextAction::array(0, new NextAction("abolish poison on party", 20.0f), nullptr)));
triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new NextAction("revive", ACTION_CRITICAL_HEAL + 10), nullptr)));
@@ -106,6 +122,9 @@ void GenericDruidNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& trig
triggers.push_back(new TriggerNode("party member almost full health",
NextAction::array(0, new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2), NULL)));
triggers.push_back(new TriggerNode("party member remove curse",
NextAction::array(0, new NextAction("remove curse on party", ACTION_DISPEL + 7), NULL)));
}
GenericDruidBuffStrategy::GenericDruidBuffStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI)

View File

@@ -53,6 +53,7 @@ BEGIN_RANGED_SPELL_ACTION(CastMultiShotAction, "multi-shot")
END_SPELL_ACTION()
BEGIN_RANGED_SPELL_ACTION(CastVolleyAction, "volley")
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
END_SPELL_ACTION()
DEBUFF_CHECKISOWNER_ACTION(CastSerpentStingAction, "serpent sting");

View File

@@ -37,7 +37,7 @@ class ArcaneMageStrategyActionNodeFactory : public NamedObjectFactory<ActionNode
{
return new ActionNode ("arcane missiles",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("firebolt"), nullptr),
/*A*/ NextAction::array(0, new NextAction("fireball"), nullptr),
/*C*/ nullptr);
}

View File

@@ -21,13 +21,13 @@ class GenericMageStrategyActionNodeFactory : public NamedObjectFactory<ActionNod
creators["blast wave"] = &blast_wave;
creators["remove curse"] = &remove_curse;
creators["remove curse on party"] = &remove_curse_on_party;
creators["firebolt"] = &firebolt;
creators["fireball"] = &fireball;
}
private:
static ActionNode* frostbolt([[maybe_unused]] PlayerbotAI* botAI)
static ActionNode* fireball([[maybe_unused]] PlayerbotAI* botAI)
{
return new ActionNode ("frostbolt",
return new ActionNode ("fireball",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("shoot"), nullptr),
/*C*/ nullptr);

View File

@@ -61,6 +61,7 @@ class CastFlamestrikeAction : public CastSpellAction
{
public:
CastFlamestrikeAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "flamestrike") { }
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
};
class CastFrostNovaAction : public CastSpellAction

View File

@@ -147,6 +147,7 @@ class FanOfKnivesAction : public CastMeleeSpellAction
{
public:
FanOfKnivesAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "fan of knives") {}
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
};
#endif

View File

@@ -342,7 +342,7 @@ class DebuffOnAttackerTrigger : public DebuffTrigger
class DebuffOnMeleeAttackerTrigger : public DebuffTrigger
{
public:
DebuffOnMeleeAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true) : DebuffTrigger(botAI, spell, 1, checkIsOwner) { }
DebuffOnMeleeAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true, float needLifeTime = 8.0f) : DebuffTrigger(botAI, spell, 1, checkIsOwner, needLifeTime) { }
Value<Unit*>* GetTargetValue() override;
std::string const getName() override { return spell + " on attacker"; }

View File

@@ -148,6 +148,7 @@ class CastRainOfFireAction : public CastSpellAction
{
public:
CastRainOfFireAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "rain of fire") { }
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
};
class CastShadowfuryAction : public CastSpellAction