diff --git a/VS.2015/Barony/Barony.vcxproj.filters b/VS.2015/Barony/Barony.vcxproj.filters
index 611d2dd39..16e3c9a21 100644
--- a/VS.2015/Barony/Barony.vcxproj.filters
+++ b/VS.2015/Barony/Barony.vcxproj.filters
@@ -249,66 +249,9 @@
Source Files
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
Source Files\magic
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
Source Files\interface
@@ -318,15 +261,9 @@
Source Files\interface
-
- Source Files\interface
-
Source Files\interface
-
- Source Files\interface
-
Source Files\interface
@@ -336,9 +273,6 @@
Source Files\interface
-
- Source Files\interface
-
Source Files\interface
@@ -369,6 +303,69 @@
Source Files\magic
+
+ Source Files\interface
+
+
+ Source Files\interface
+
+
+ Source Files\interface
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
@@ -443,27 +440,15 @@
Header Files
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
Header Files\interface
Header Files\magic
+
+ Header Files
+
diff --git a/VS.2015/editor/editor.vcxproj.filters b/VS.2015/editor/editor.vcxproj.filters
index be346846e..708c21122 100644
--- a/VS.2015/editor/editor.vcxproj.filters
+++ b/VS.2015/editor/editor.vcxproj.filters
@@ -80,18 +80,12 @@
Source Files
-
+
Source Files
Source Files
-
- Source Files
-
-
- Source Files
-
diff --git a/src/actmonster.cpp b/src/actmonster.cpp
index ae2c932ec..ab242a4d1 100644
--- a/src/actmonster.cpp
+++ b/src/actmonster.cpp
@@ -1994,6 +1994,8 @@ void actMonster(Entity* my)
}
}
+ CheckForPlayerHostility(my, myStats);
+
// state machine
if ( my->monsterState == MONSTER_STATE_WAIT ) // wait state
{
@@ -5156,3 +5158,61 @@ int numTargetsAroundEntity(Entity* my, double distToFind, real_t angleToSearch,
}
return count;
}
+
+/* actmonster.cpp
+ * @param pMonster - A pointer to the Monster's Entity
+ * @param pMonsterStats - A pointer to the Monster's Stats
+ * Checks to see if a Player has been hostile towards this Monster. Currently only handles Humans
+ * If a Player was Hostile, then this Human will be permanently Hostile towards only that Player
+ * Sets 'pMonster->hostilePlayers[iPlayerIndex] = true' if there was hostility
+ * If @pMonster is a Follower of the Hostile Player, then they will be removed from the 'stats[iPlayerIndex]->FOLLOWERS' list
+ */
+void CheckForPlayerHostility(Entity* const pMonster, Stat* const pMonsterStats)
+{
+ // Check if a Player has been Hostile
+ if ( pMonsterStats->type == HUMAN && pMonsterStats->HP > 0 && pMonster->monsterTarget > 0 )
+ {
+ // Individual Humans hold a grudge against individual Players
+ for ( Uint8 iPlayerIndex = 0; iPlayerIndex < MAXPLAYERS; iPlayerIndex++ )
+ {
+ if ( players[iPlayerIndex] && players[iPlayerIndex]->entity )
+ {
+ // Skip already hostile Players
+ if ( pMonster->hostilePlayers[iPlayerIndex] == true )
+ {
+ continue;
+ }
+
+ // Only process hostility on this Human against that Player
+ if ( pMonster->monsterTarget != players[iPlayerIndex]->entity->getUID() )
+ {
+ continue;
+ }
+
+ // If the Player is the target, then hold a grudge
+ if ( pMonster->monsterTarget == players[iPlayerIndex]->entity->getUID() )
+ {
+ pMonster->hostilePlayers[iPlayerIndex] = true;
+
+ // If the Player is your Leader, stop being a Follower
+ if ( pMonsterStats->leader_uid != 0 )
+ {
+ Entity* pOldLeader = uidToEntity(pMonsterStats->leader_uid);
+
+ if ( pOldLeader == players[iPlayerIndex]->entity )
+ {
+ Stat* pOldLeaderStats = pOldLeader->getStats();
+
+ if ( pOldLeaderStats != nullptr )
+ {
+ list_RemoveNodeWithElement(pOldLeaderStats->FOLLOWERS, pMonster->getUID());
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/entity.cpp b/src/entity.cpp
index f017a97a5..699647e2a 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -5385,6 +5385,22 @@ bool Entity::checkEnemy(Entity* your)
return false;
}
+ if ( myStats->type == HUMAN )
+ {
+ // Individual Humans hold a grudge against individual Players
+ for ( Uint8 iPlayerIndex = 0; iPlayerIndex < MAXPLAYERS; iPlayerIndex++ )
+ {
+ if ( players[iPlayerIndex] && players[iPlayerIndex]->entity )
+ {
+ // Check if this Player is an Enemy
+ if ( players[iPlayerIndex]->entity == your )
+ {
+ return hostilePlayers[iPlayerIndex];
+ }
+ }
+ }
+ }
+
// if you have a leader, check whether we are enemies instead
Entity* yourLeader = NULL;
if ( yourStats->leader_uid )
@@ -5557,6 +5573,23 @@ bool Entity::checkFriend(Entity* your)
}
if ( !foundFollower )
{
+ // First do a check to see if there is a grudge against the Player
+ if ( myStats->type == HUMAN )
+ {
+ // Individual Humans hold a grudge against individual Players
+ for ( Uint8 iPlayerIndex = 0; iPlayerIndex < MAXPLAYERS; iPlayerIndex++ )
+ {
+ if ( players[iPlayerIndex] && players[iPlayerIndex]->entity )
+ {
+ // Check if this Player is an Enemy
+ if ( players[iPlayerIndex]->entity == your )
+ {
+ return !hostilePlayers[iPlayerIndex];
+ }
+ }
+ }
+ }
+
// no leader, default to allegiance table
result = monsterally[myStats->type][yourStats->type];
}
diff --git a/src/entity.hpp b/src/entity.hpp
index d6cfa8582..4af09f600 100644
--- a/src/entity.hpp
+++ b/src/entity.hpp
@@ -41,6 +41,8 @@ struct spell_t;
// entity class
class Entity
{
+
+private:
Sint32& char_gonnavomit;
Sint32& char_heal;
Sint32& char_energize;
@@ -127,6 +129,8 @@ class Entity
list_t children; // every entity has a list of child objects
Uint32 parent; // id of the entity's "parent" entity
+ bool hostilePlayers[4] = {false}; // An array of whether or not the Player is hostile, position in array corresponds to position in players[] array
+
//--PUBLIC CHEST SKILLS--
//skill[4]
@@ -521,3 +525,13 @@ bool isLevitating(Stat * myStats);
int getWeaponSkill(Item* weapon);
int getStatForProficiency(int skill);
void setSpriteAttributes(Entity* entityToSet, Entity* entityToCopy, Entity* entityStatToCopy);
+
+/* actmonster.cpp
+ * @param pMonster - A pointer to the Monster's Entity
+ * @param pMonsterStats - A pointer to the Monster's Stats
+ * Checks to see if a Player has been hostile towards this Monster. Currently only handles Humans
+ * If a Player was Hostile, then this Human will be permanently Hostile towards only that Player
+ * Sets 'pMonster->hostilePlayers[iPlayerIndex] = true' if there was hostility
+ * If @pMonster is a Follower of the Hostile Player, then they will be removed from the 'stats[iPlayerIndex]->FOLLOWERS' list
+ */
+void CheckForPlayerHostility(Entity* const pMonster, Stat* const pMonsterStats);
\ No newline at end of file