Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ namespace ai
}
else if (range > ATTACK_DISTANCE)
{
context->GetValue<float>("reach spell distance")->Set(range);
return NextAction::merge( NextAction::array(0, new NextAction("reach spell"), NULL), Action::getPrerequisites());
}
else
Expand Down
12 changes: 11 additions & 1 deletion src/modules/Bots/playerbot/strategy/actions/ReachTargetActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ namespace ai
class ReachSpellAction : public ReachTargetAction
{
public:
ReachSpellAction(PlayerbotAI* ai, float distance = sPlayerbotAIConfig.spellDistance) : ReachTargetAction(ai, "reach spell", distance) {}
ReachSpellAction(PlayerbotAI* ai) : ReachTargetAction(ai, "reach spell", sPlayerbotAIConfig.spellDistance) {}
virtual bool Execute(Event event)
{
distance = AI_VALUE(float, "reach spell distance");
return ReachTargetAction::Execute(event);
}
virtual bool isUseful()
{
distance = AI_VALUE(float, "reach spell distance");
return ReachTargetAction::isUseful();
}
};
}
2 changes: 2 additions & 0 deletions src/modules/Bots/playerbot/strategy/values/ValueContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ namespace ai
creators["bag space"] = &ValueContext::bag_space;
creators["enemy healer target"] = &ValueContext::enemy_healer_target;
creators["item usage"] = &ValueContext::item_usage;
creators["reach spell distance"] = &ValueContext::reach_spell_distance;
}

private:
static UntypedValue* item_usage(PlayerbotAI* ai) { return new ItemUsageValue(ai); }
static UntypedValue* reach_spell_distance(PlayerbotAI* ai) { return new ManualSetValue<float>(ai, sPlayerbotAIConfig.spellDistance, "reach spell distance"); }
static UntypedValue* mana_save_level(PlayerbotAI* ai) { return new ManaSaveLevelValue(ai); }
static UntypedValue* invalid_target(PlayerbotAI* ai) { return new InvalidTargetValue(ai); }
static UntypedValue* balance(PlayerbotAI* ai) { return new BalancePercentValue(ai); }
Expand Down
Loading