diff options
author | Kiyoshi Kyokai <kiyoshi.kyokai@gmail.com> | 2005-02-20 08:49:16 +0000 |
---|---|---|
committer | Kiyoshi Kyokai <kiyoshi.kyokai@gmail.com> | 2005-02-20 08:49:16 +0000 |
commit | 3df76a3104320d7b15e5596cd0511be61c225c15 (patch) | |
tree | d7a09d61e7da50174fc6f2fcf0a8e9de8752c151 /src/main.cpp | |
parent | 4be5313a359b326f80ee6e5903123c2bc298a8e6 (diff) | |
download | mana-client-3df76a3104320d7b15e5596cd0511be61c225c15.tar.gz mana-client-3df76a3104320d7b15e5596cd0511be61c225c15.tar.bz2 mana-client-3df76a3104320d7b15e5596cd0511be61c225c15.tar.xz mana-client-3df76a3104320d7b15e5596cd0511be61c225c15.zip |
added skill functionality
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 256b2943..4163b239 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -386,3 +386,35 @@ int main(int argc, char *argv[]) PHYSFS_deinit(); return 0; } + +// GetSkill Function +// Retrieves the level of the skill for the ID value given. +// This function also increases the XP of the skill by the given parameter. +// Call n_base to return the actual value, regardless of equipment modifiers. +// ---by Kyokai +int PLAYER_INFO::GetSkill(int n_ID, int n_XP, int n_base) +{ + if(n_ID>N_SKILLS||n_ID<0) // out of cheese error, abort function + return 0; + // 1. raise the exp value + m_Skill[n_ID].exp+=(n_XP*m_Skill[n_ID].mod); + + // 2. Check for level up + if(m_Skill[n_ID].exp >= 20 * ((m_Skill[n_ID].level)^(6/5))) + { + m_Skill[n_ID].level += 1; + m_Skill[n_ID].exp = 0; + // TO DO: send the user a message that tells him his + // skill just leveled up! + } + + // 3. getting the return value + int r = m_Skill[n_ID].level; + if(n_base) + { + // TO DO: alter values based on equipment bonuses + } + + return r; // return the value +} + |