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

@@ -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);
}