示例#1
0
 /// <summary>
 /// 类型:方法
 /// 名称:Character
 /// 作者:taixihuase
 /// 作用:通过用户信息构造一个角色对象
 /// 编写日期:2015/7/22
 /// </summary>
 /// <param name="user"></param>
 public Character(UserInfo user)
     : base(user)
 {
     Position = new Position();
     Experience = new Experience();
     Occupation = new Occupation();
     Attribute = new CharacterAttribute();
     Weapons = new WeaponCollection();
     Armors = new ArmorCollection();
     Jewels = new JewelCollection();
     Skills = new SkillCollection();
 }
示例#2
0
 /// <summary>
 /// 类型:方法
 /// 名称:Character
 /// 作者:taixihuase
 /// 作用:通过已有的角色信息构造一个新的角色实例
 /// 编写日期:2015/8/20
 /// </summary>
 /// <param name="character"></param>
 public Character(Character character)
     : base(character.Guid, character.Account, character.UniqueId, character.Nickname, character.Status)
 {
     WorldEnterTime = character.WorldEnterTime;
     Position = character.Position;
     Experience = character.Experience;
     Occupation = character.Occupation;
     Weapons = character.Weapons;
     Armors = character.Armors;
     Jewels = character.Jewels;
     Skills = character.Skills;
     Attribute = new CharacterAttribute();
     Type type = character.Attribute.GetType();
     var pi = type.GetProperties();
     foreach (var info in pi)
     {
         info.SetValue(Attribute, info.GetValue(character.Attribute, null), null);
     }
 }
示例#3
0
 /// <summary>
 /// 类型:方法
 /// 名称:Cancel
 /// 作者:taixihuase
 /// 作用:禁用职业基础属性值
 /// 编写日期:2015/8/20
 /// </summary>
 /// <param name="attribute"></param>
 public void Cancel(CharacterAttribute attribute)
 {
     if (_apply)
     {
         attribute.HitPointBase -= BaseHitPoint;
         attribute.HitPoint = (int) (attribute.HitPointBase*(100 + attribute.LifeIncreasePercent)*0.01);
         attribute.ManaBase -= BaseMana;
         attribute.Mana = (int) (attribute.ManaBase*(100 + attribute.ManaIncreasePercent)*0.01);
         attribute.LifeRecovery -= BaseLifeRecovery;
         attribute.ManaRecovery -= BaseManaRecovery;
         _apply = false;
     }
 }
示例#4
0
 /// <summary>
 /// 类型:方法
 /// 名称:Apply
 /// 作者:taixihuase
 /// 作用:启用职业基础属性值
 /// 编写日期:2015/8/20
 /// </summary>
 /// <param name="attribute"></param>
 public void Apply(CharacterAttribute attribute)
 {
     if (!_apply)
     {
         attribute.HitPointBase += BaseHitPoint;
         attribute.HitPoint = (int) (attribute.HitPointBase*(100 + attribute.LifeIncreasePercent)*0.01);
         attribute.ManaBase += BaseMana;
         attribute.Mana = (int) (attribute.ManaBase*(100 + attribute.ManaIncreasePercent)*0.01);
         attribute.LifeRecovery += BaseLifeRecovery;
         attribute.ManaRecovery += BaseManaRecovery;
         _apply = true;
     }
 }