Skip to content

Commit 6eca140

Browse files
committed
spell target reach
1 parent 46f8d75 commit 6eca140

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/modules/Bots/playerbot/strategy/actions/GenericSpellActions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ namespace ai
9797
}
9898
else if (range > ATTACK_DISTANCE)
9999
{
100+
context->GetValue<float>("reach spell distance")->Set(range);
100101
return NextAction::merge( NextAction::array(0, new NextAction("reach spell"), NULL), Action::getPrerequisites());
101102
}
102103
else

src/modules/Bots/playerbot/strategy/actions/ReachTargetActions.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ namespace ai
5252
class ReachSpellAction : public ReachTargetAction
5353
{
5454
public:
55-
ReachSpellAction(PlayerbotAI* ai, float distance = sPlayerbotAIConfig.spellDistance) : ReachTargetAction(ai, "reach spell", distance) {}
55+
ReachSpellAction(PlayerbotAI* ai) : ReachTargetAction(ai, "reach spell", sPlayerbotAIConfig.spellDistance) {}
56+
virtual bool Execute(Event event)
57+
{
58+
distance = AI_VALUE(float, "reach spell distance");
59+
return ReachTargetAction::Execute(event);
60+
}
61+
virtual bool isUseful()
62+
{
63+
distance = AI_VALUE(float, "reach spell distance");
64+
return ReachTargetAction::isUseful();
65+
}
5666
};
5767
}

src/modules/Bots/playerbot/strategy/values/ValueContext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ namespace ai
139139
creators["bag space"] = &ValueContext::bag_space;
140140
creators["enemy healer target"] = &ValueContext::enemy_healer_target;
141141
creators["item usage"] = &ValueContext::item_usage;
142+
creators["reach spell distance"] = &ValueContext::reach_spell_distance;
142143
}
143144

144145
private:
145146
static UntypedValue* item_usage(PlayerbotAI* ai) { return new ItemUsageValue(ai); }
147+
static UntypedValue* reach_spell_distance(PlayerbotAI* ai) { return new ManualSetValue<float>(ai, sPlayerbotAIConfig.spellDistance, "reach spell distance"); }
146148
static UntypedValue* mana_save_level(PlayerbotAI* ai) { return new ManaSaveLevelValue(ai); }
147149
static UntypedValue* invalid_target(PlayerbotAI* ai) { return new InvalidTargetValue(ai); }
148150
static UntypedValue* balance(PlayerbotAI* ai) { return new BalancePercentValue(ai); }

0 commit comments

Comments
 (0)