Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some of the NPC attacking logic #49907

Merged
merged 22 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 18 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
2 changes: 1 addition & 1 deletion data/json/items/ammo.json
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@
"category": "spare_parts",
"material": [ "stone" ],
"ammo_type": "rock",
"flags": [ "TRADER_AVOID" ],
"flags": [ "TRADER_AVOID", "NPC_THROWN" ],
"weight": "657 g",
"volume": "250 ml",
"bashing": 7,
Expand Down
5 changes: 5 additions & 0 deletions src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2672,6 +2672,11 @@ int npc::closest_enemy_to_friendly_distance() const
return ai_cache.closest_enemy_to_friendly_distance();
}

const std::vector<weak_ptr_fast<Creature>> &npc::get_cached_friends() const
{
return ai_cache.friends;
}

std::string npc_attitude_name( npc_attitude att )
{
switch( att ) {
Expand Down
6 changes: 6 additions & 0 deletions src/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,7 @@ class npc : public player

// accessors to ai_cache functions
int closest_enemy_to_friendly_distance() const;
const std::vector<weak_ptr_fast<Creature>> &get_cached_friends() const;

private:
npc_attitude attitude = NPCATT_NULL; // What we want to do to the player
Expand All @@ -1292,6 +1293,11 @@ class npc : public player
const std::shared_ptr<npc_attack> &get_current_attack() const {
return ai_cache.current_attack;
}

const npc_attack_rating &get_current_attack_evaluation() const {
return ai_cache.current_attack_evaluation;
}

/**
* Global position, expressed in map square coordinate system
* (the most detailed coordinate system), used by the @ref map.
Expand Down
Loading