summaryrefslogtreecommitdiffstats
path: root/src/MonsterConfig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MonsterConfig.cpp')
-rw-r--r--src/MonsterConfig.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp
index 28132607e..fdd15e01e 100644
--- a/src/MonsterConfig.cpp
+++ b/src/MonsterConfig.cpp
@@ -3,6 +3,7 @@
#include "MonsterConfig.h"
#include "Mobs/Monster.h"
+#include "Mobs/Behaviors/BehaviorAttacker.h"
#include "IniFile.h"
@@ -90,11 +91,17 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na
{
if (itr->m_Name.compare(a_Name) == 0)
{
- a_Monster->SetAttackDamage (itr->m_AttackDamage);
- a_Monster->SetAttackRange (itr->m_AttackRange);
- a_Monster->SetSightDistance(itr->m_SightDistance);
- a_Monster->SetAttackRate (static_cast<float>(itr->m_AttackRate));
+ cBehaviorAttacker * Attacker = a_Monster->GetBehaviorAttacker();
+
+ if (Attacker != nullptr)
+ {
+ Attacker->SetAttackDamage (itr->m_AttackDamage);
+ Attacker->SetAttackRange (itr->m_AttackRange);
+ Attacker->SetAttackRate (static_cast<float>(itr->m_AttackRate));
+ }
+
a_Monster->SetMaxHealth (itr->m_MaxHealth);
+ a_Monster->SetSightDistance(itr->m_SightDistance);
a_Monster->SetIsFireproof (itr->m_IsFireproof);
return;
}