/// <summary>
/// BaseStat.cs
/// High Sword
/// July 27, 2012
///
/// This is the base class for a stats in game
/// </summary>
public class BaseStat {
public const int STARTING_EXP_COST = 100; // publicly accessable value for all base stats to start at
private int _baseValue; // the base value of this stat(base ability for character)
private int _buffValue; // range of adjust base value
private int _expToLevel; // the total amount of experience needed to raise this skill
private float _levelModifier; // the modifier applied to the experience to raise the skill
/// <summary>
/// Initializes a new instance of the <see cref="BaseStat"/> class.
/// </summary>
public BaseStat () {
_baseValue = 0;
_buffValue = 0;
_levelModifier = 1.1f;
_expToLevel = STARTING_EXP_COST;
}
#region Basic Setters and Getters
/// <summary>
/// Gets or sets the _baseValue.
/// </summary>
/// <value>
/// The _baseValue.
/// </value>
public int BaseValue {
get{ return _baseValue; }
set{ _baseValue = value; }
}
/// <summary>
/// Gets or sets the _buffValue.
/// </summary>
/// <value>
/// The _buffValue.
/// </value>
public int BuffValue {
get{ return _buffValue; }
set{ _buffValue = value; }
}
/// <summary>
/// Gets or sets the _expToLevel.
/// </summary>
/// <value>
/// The _expToLevel.
/// </value>
public int ExpToLevel {
get{ return _expToLevel; }
set{ _expToLevel = value; }
}
/// <summary>
/// Gets or sets the _levelModifier.
/// </summary>
/// <value>
/// The _levelModifier.
/// </value>
public float LevelModifier {
get{ return _levelModifier; }
set{ _levelModifier = value; }
}
#endregion
// Calculate experience needed for the next level
/// <summary>
/// Calculates the exp to level.
/// </summary>
/// <returns>
/// The exp to level.
/// </returns>
private int CalculateExpToLevel () {
return (int)(_expToLevel * _levelModifier);
}
/// <summary>
/// Assign the new value to _expToLevel and then increase the _baseValue by one
/// </summary>
public void LevelUp () {
_expToLevel = CalculateExpToLevel();
_baseValue++;
}
/// <summary>
/// Recalculate the adjuste base value and return it
/// </summary>
/// <value>
/// The adjusted base value.
/// </value>
public int AdjustedBaseValue {
get{return _baseValue + _buffValue;}
}
}
分享到:
相关推荐
在ASP.NET WebForm开发中,`.designer.cs`文件是一个非常关键的部分,它与`.aspx`页面对应,用于存储自动生成的控件声明和事件处理程序。当你删除了`.designer.cs`文件,需要手动恢复这个文件并重新设计及绑定服务端...
在C#编程中,自动生成.cs文件是一种常见的需求,它可以帮助开发者提高效率,减少重复劳动,尤其是在处理大量相似代码或需要遵循特定模板时。本文将深入探讨如何在C#环境中自动生成.cs文件,并涵盖相关技术点。 首先...
在`MsSqlHelper.cs`文件中,这些方法通常会包含以下步骤: - 连接字符串的获取:通过配置文件或者硬编码来获取数据库连接字符串。 - SqlConnection对象的创建:使用连接字符串初始化数据库连接。 - SqlCommand对象的...
BarCodeToHTML.cs CacheHelper.cs Captcha.cs CNDate.cs ConvertJson.cs CsvHelper.cs EcanConvertToCh.cs Encrypt.cs ExcelHelper.cs FileDown.cs FileManager.cs FileUp.cs FTPClient.cs FTPHelper....
SqlHelper.cs 微软官方版本 ===========================================================================
IniConfig.cs(C# INI文件读写,自动生成配置文件,实际内容根据项目自定义)
海康威视下载视频方法需要的CHCNetSDK_X64.cs配置文件,海康威视下载图片方法需要的CHCNetSDK_X64.cs配置文件。
edu.stanford.cs106_2.0.1.201603271702.jar stanford公开课使用eclipse需要的插件
.NET 中 JavaScript 帮助类
DataHelper.cs 完全 DataHelper.cs 完全 DataHelper.cs 完全 DataHelper.cs 完全 DataHelper.cs 完全 DataHelper.cs 完全
最新的雷赛运动控制卡SDK,LTDMC.cs带中文注释
作C#桌面程序时,有时我们会遇到很复杂的功能,如果所有功能的实现都写在一个.cs文件中,会让这个.cs文件显得很臃肿,而且不便于以后管理。本程序提供一种方法,可以将不同功能分写在不同的.cs文件文件中。即能将很...
mssqlhelper.cs和jshelper.cs的jshelper.cs
mssqlhelper.cs和jshelper.cs 的mssqlhelper.cs
C#数据库连接类库DbHelp.cs DbHelp.cs是一个C#数据库连接类库,用于实现数据库的连接、插入、更新和删除操作。该类库提供了多个方法来执行SQL语句,包括插入、更新和删除操作。下面是DbHelp.cs类库的详细知识点: ...
《IK Multimedia T-RackS CS Complete v4.10 - 音频处理的恐龙级工具》 IK Multimedia的T-RackS CS Complete v4.10是一款备受推崇的专业级音频处理软件,被誉为“恐龙级”的音频插件。这款强大的工具集涵盖了混音、...
Properties.Resources.Designer.cs.dll
C#通过s7通讯,读写plc内部寄存器数值,可做上位机通讯
xna VideoPlayer.cs xna VideoPlayer.cs xna VideoPlayer.cs
http://www.cs.waikato.ac.nz/ml/weka/ weka主页