diff options
author | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-25 23:47:12 +0100 |
---|---|---|
committer | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-25 23:47:12 +0100 |
commit | e8f230f24e55469f1aa832bc8dad73db8018ffe1 (patch) | |
tree | abccca0bef086c4f2eda8497fa757433464e3b23 /source/cPassiveMonster.cpp | |
parent | - fixed the code from the last commit :) (diff) | |
download | cuberite-e8f230f24e55469f1aa832bc8dad73db8018ffe1.tar cuberite-e8f230f24e55469f1aa832bc8dad73db8018ffe1.tar.gz cuberite-e8f230f24e55469f1aa832bc8dad73db8018ffe1.tar.bz2 cuberite-e8f230f24e55469f1aa832bc8dad73db8018ffe1.tar.lz cuberite-e8f230f24e55469f1aa832bc8dad73db8018ffe1.tar.xz cuberite-e8f230f24e55469f1aa832bc8dad73db8018ffe1.tar.zst cuberite-e8f230f24e55469f1aa832bc8dad73db8018ffe1.zip |
Diffstat (limited to 'source/cPassiveMonster.cpp')
-rw-r--r-- | source/cPassiveMonster.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/cPassiveMonster.cpp b/source/cPassiveMonster.cpp new file mode 100644 index 000000000..bbfbc83ed --- /dev/null +++ b/source/cPassiveMonster.cpp @@ -0,0 +1,37 @@ +#include "cPassiveMonster.h"
+
+
+cPassiveMonster::cPassiveMonster()
+{
+ m_EMPersonality = PASSIVE;
+}
+
+cPassiveMonster::~cPassiveMonster()
+{
+}
+
+void cPassiveMonster::TakeDamage(int a_Damage, cEntity* a_Instigator)
+{
+ cMonster::TakeDamage(a_Damage, a_Instigator);
+ m_EMState = ESCAPING;
+}
+
+void cPassiveMonster::Tick(float a_Dt)
+{
+ cMonster::Tick(a_Dt);
+
+ m_SeePlayerInterval += a_Dt;
+
+ if(m_SeePlayerInterval > 1)
+ {
+ int rem = rand() % 3 + 1; //check most of the time but miss occasionally
+
+ m_SeePlayerInterval = 0.0;
+ if(rem >= 2) {
+ if(m_EMState == ESCAPING)
+ {
+ CheckEventLostPlayer();
+ }
+ }
+ }
+}
\ No newline at end of file |