From 0b560d10934bcd29c47c0a98e380b0d5770a8624 Mon Sep 17 00:00:00 2001 From: Deskull Date: Sun, 9 Mar 2014 21:01:25 +0900 Subject: [PATCH] Add feed point to Creature class. --- Deeangband/Creature.cpp | 50 ++++++++++++++++++++++++++++++------------------- Deeangband/Creature.h | 15 +++++++++++++++ Deeangband/Deeangband.h | 1 + 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/Deeangband/Creature.cpp b/Deeangband/Creature.cpp index 75341e9..5c4a663 100644 --- a/Deeangband/Creature.cpp +++ b/Deeangband/Creature.cpp @@ -84,14 +84,15 @@ Creature::Creature(ID id, TAG tag, GameWorld *gameWorld) : GameElement(id, tag, Creature::Creature(void) { int statID; - name = "ƒ_ƒ~["; - currentMp = maxMp = maxMaxMp = 10; - currentSoul = maxSoul = Creature::soulLevel[0]; - currentDiscipilne.SetPoint(0, 0, 0, 0, 0); - height = 160; - weight = 50; - + this->name = "ƒ_ƒ~["; + this->currentMp = this->maxMp = this->maxMaxMp = 10; + this->currentSoul = this->maxSoul = Creature::soulLevel[0]; + this->currentDiscipilne.SetPoint(0, 0, 0, 0, 0); + this->height = 160; + this->weight = 50; + this->divineLevel = -1; savings.Set(10, 10, 10); + this->currentFeed = this->maxFeed = 20000; for(statID = 0; statID < CS_MAX; statID++) { @@ -185,7 +186,7 @@ void Creature::setMP(MP amount) string Creature::GetName(void) { - return name; + return this->name; } LEVEL Creature::GetLevel(void) @@ -202,57 +203,57 @@ LEVEL Creature::GetLevel(void) HP Creature::GetCurHP(void) { - return currentHp; + return this->currentHp; } HP Creature::GetMaxHP(void) { - return max_hp; + return this->max_hp; } HP Creature::GetNorMaxHP(void) { - return this->hpTable[0]; + return this->hpTable[this->GetLevel()]; } MP Creature::GetCurMP(void) { - return currentMp; + return this->currentMp; } MP Creature::GetMaxMP(void) { - return maxMp; + return this->maxMp; } MP Creature::GetNorMaxMP(void) { - return maxMaxMp; + return this->maxMaxMp; } AC Creature::GetArmorSaving(void) { - return savings.GetArmor(); + return this->savings.GetArmor(); } EV Creature::GetEvasionSaving(void) { - return savings.GetEvasion(); + return this->savings.GetEvasion(); } VO Creature::GetVolitionSaving(void) { - return savings.GetVolition(); + return this->savings.GetVolition(); } SOUL Creature::GetCurrentSoul(void) { - return currentSoul; + return this->currentSoul; } SOUL Creature::GetMaxSoul(void) { - return maxSoul; + return this->maxSoul; } BASE_STATUS Creature::GetCurrentStatus(CREATURE_STATUS stat) @@ -322,9 +323,20 @@ void Creature::LostSoul(SOUL amount) { this->currentSoul -= amount; this->maxSoul -= amount / 20; + if(this->currentSoul < 1) this->die(); } LEVEL Creature::GetDivineLevel(void) { return this->divineLevel; } + +FEED Creature::GetCurrentFeedPoint(void) +{ + return this->currentFeed; +} + +FEED Creature::GetMaxFeedPoint(void) +{ + return this->maxFeed; +} diff --git a/Deeangband/Creature.h b/Deeangband/Creature.h index 95e7328..b3394a7 100644 --- a/Deeangband/Creature.h +++ b/Deeangband/Creature.h @@ -40,6 +40,9 @@ private: HEIGHT height; //!< g’· HEIGHT weight; //!< ‘̏d + FEED currentFeed; //!< Œ»ÝŽ —{’l + FEED maxFeed; //!< Å‘厠—{’l + Discipline currentDiscipilne; /*!< Œ»Ý‚̏C—{’l */ LEVEL divineLevel; //!< _«ƒŒƒxƒ‹ @@ -297,5 +300,17 @@ public: */ LEVEL Creature::GetDivineLevel(void); + /*! + * @brief Œ»ÝŽ —{’l‚ð•Ô‚· + * @return Œ»ÝŽ —{’l + */ + FEED Creature::GetCurrentFeedPoint(void); + + /*! + * @brief Å‘厠—{’l‚ð•Ô‚· + * @return Å‘厠—{’l + */ + FEED Creature::GetMaxFeedPoint(void); + }; diff --git a/Deeangband/Deeangband.h b/Deeangband/Deeangband.h index e5ad96d..e052b74 100644 --- a/Deeangband/Deeangband.h +++ b/Deeangband/Deeangband.h @@ -89,6 +89,7 @@ typedef int BASE_STATUS; //!< typedef int LEVEL; //!< LEVEL‚̕ϐ”Œ^ typedef int HP; //!< HP‚̕ϐ”Œ^ typedef int MP; //!< MP‚̕ϐ”Œ^ +typedef int FEED; //!< Ž —{“x‚̕ϐ”Œ^ typedef int64_t SOUL; //!< ƒ\ƒEƒ‹‚̕ϐ”Œ^ typedef int DISCIPLINE_POINT; //!< C—{’l‚̕ϐ”Œ^ typedef int AC; //!< ŠæŒ’« -- 2.11.0