关于Silverlight角色扮演游戏Sprite经典属性设计

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ContentSql.Global;//GetImage//EquipmentSet
using ContentSql.sqlText;
using System.Xml;//XmlReader
using System.IO;//StringReader//FileStream

namespace ContentSql.Global
{
    public struct RolesHeart
    {
        /// <summary>
        /// 角色名称
        /// </summary>
        public string RoleName { get; set; }
        /// <summary>
        /// 角色等级
        /// </summary>
        public int RoleLevel { get; set; }
        /// <summary>
        /// 角色经验
        /// </summary>
        public double RoleEXP { get; set; }
        /// <summary>
        /// 角色小头像
        /// </summary>
        public int RolePro { get; set; }
        /// <summary>
        /// 角色性别
        /// </summary>
        public int RoleSex { get; set; }
        /// <summary>
        /// 角色负重
        /// </summary>
        public double RoleBurden { get; set; }
        /// <summary>
        /// 获取物理攻击力最小值MinPhyDamage
        /// </summary>
        public double RoleAttackMin { get; set; }
        /// <summary>
        /// 获取物理攻击力最大值MaxPhyDamage
        /// </summary>
        public double RoleAttackMax { get; set; }
        /// <summary>
        /// 获取命中值Hit
        /// </summary>
        public double RoleHit { get; set; }
        /// <summary>
        /// 获取闪避值Dodge
        /// </summary>
        public double RoleDodge { get; set; }
        /// <summary>
        /// 获取跑步速度(每移动一个单元格的花费时间,越小越快)RunSpeed
        /// </summary>
        public double RoleRunSpeed { get; set; }
        /// <summary>
        /// 获取物攻速度(越小越快)
        /// </summary>
        public double RoleAttackSpeed { get; set; }
        /// <summary>
        /// 获取施法速度(越小越快)
        /// </summary>
        public double RoleMagicSpeed { get; set; }
        /// <summary>
        /// 获取最大生命值
        /// </summary>
        public double RoleLifeMax { get; set; }
        /// <summary>
        /// 获取现在生命值
        /// </summary>
        public double RoleLife { get; set; }
        /// <summary>
        /// 获取物理防御力
        /// </summary>
        public double RoleDefense { get; set; }
        /// <summary>
        /// 获取格档率
        /// </summary>
        public double RoleBlock { get; set; }
        /// <summary>
        /// 获取最大魔法值
        /// </summary>
        public double RoleManaMax { get; set; }
        /// <summary>
        /// 获取现在魔法值
        /// </summary>
        public double RoleMana { get; set; }
        /// <summary>
        /// 获取魔法防御力
        /// </summary>
        public double RoleMagicDefense { get; set; }
        /// <summary>
        /// 获取魔法攻击力最小值
        /// </summary>
        public double RoleMagicMin { get; set; }
        /// <summary>
        /// 获取魔法攻击力最大值
        /// </summary>
        public double RoleMagicMax { get; set; }
        /// <summary>
        /// 获取暴击率
        /// </summary>
        public double RoleBurst { get; set; }
        /// <summary>
        /// 获取或设置力量值STR
        /// </summary>
        public int RolePower { get; set; }
        /// <summary>
        /// 获取或设置敏捷值AGI
        /// </summary>
        public int RoleAgile { get; set; }
        /// <summary>
        /// 获取或设置体质值CON
        /// </summary>
        public int RolePhysique { get; set; }
        /// <summary>
        /// 获取或设置智慧值INT
        /// </summary>
        public int RoleWisdom { get; set; }
        /// <summary>
        /// 获取或设置精神值SPI
        /// </summary>
        public int RoleSpirit { get; set; }
        /// <summary>
        /// 获取或设置幸运值
        /// </summary>
        public double RoleLucky { get; set; }
    }
}

关于属性使用方面,利用一个类来记录。

我自己的设计是使用

先将计算玩家身上的装备所带来的属性(装备基础属性+私人装备属性)

基础装备属性:数据列表中装备基础属性,

私人装备属性:玩家强化装备等级,玩家装备品质,玩家鉴定装备属性。

在获取完所有装备属性并且累计之后。在玩家基本属性

RolePower ---力量

RoleAgile ---敏捷

RoleWisdom ---智力

RoleSpirit ---精神

RolePhysique ---体质

五项属性。

rolebaseSX.RoleLifeMax = IniLifeMax + rolebaseSX.RolePower * 5 + rolebaseSX.RolePhysique * 20;//left=装备+力量*5+体质*20+装备增加的
            rolebaseSX.RoleManaMax = IniManaMax + rolebaseSX.RoleWisdom * 5 + rolebaseSX.RoleSpirit * 30;//mana=装备+智力*5+精神*30
            rolebaseSX.RoleAttackMax = IniAttackMax + rolebaseSX.RolePower * 2 + rolebaseSX.RoleAgile;//最大攻击 =装备+ 力量*2 + 敏捷*1
            rolebaseSX.RoleMagicMax = IniMagicMax + rolebaseSX.RoleWisdom * 3 + rolebaseSX.RoleSpirit;//最大魔法攻击 =装备+ 智力*3 + 精神*1
            rolebaseSX.RoleAttackMin = IniAttackMin + rolebaseSX.RolePower * 1 + rolebaseSX.RoleAgile / 2;//最小物理攻击=
            rolebaseSX.RoleMagicMin = IniMagicMin + rolebaseSX.RoleWisdom * 1.5 + rolebaseSX.RoleSpirit / 2;//最小魔法攻击=

            rolebaseSX.RoleDefense += rolebaseSX.RoleAgile + rolebaseSX.RolePower * 0.5;//物理防御 += 敏捷 + 力量*0.5
            rolebaseSX.RoleMagicDefense += rolebaseSX.RoleWisdom + rolebaseSX.RoleSpirit * 2;//魔法防御 += 智力*1 + 精神*2
            rolebaseSX.RoleBurst = rolebaseSX.RoleLucky + (IniBurst + rolebaseSX.RoleWisdom + rolebaseSX.RoleAgile * 1.5 + rolebaseSX.RolePower) / 50;//暴击=幸运+(魔法+敏捷*1.5+力量)/50 (2倍伤害)
            rolebaseSX.RoleBlock = rolebaseSX.RoleLucky + (IniBlock + rolebaseSX.RolePower) / 35;//格挡=幸运+力量/35  (伤害减少50%)
            rolebaseSX.RoleDodge = rolebaseSX.RoleLucky + (IniDodge + rolebaseSX.RoleAgile) / 75;//闪避=幸运+敏捷/75  (伤害全免)
            rolebaseSX.RoleHit = rolebaseSX.RoleLucky + (IniHit + rolebaseSX.RoleSpirit + rolebaseSX.RolePhysique) / 30;//命中=幸运+(精神+体质)/30

每一个Sprite都拥有一个Heart属性。怪物和NPC和玩家全都继承于Sprite。我设计的方案里面Sprite拥有发饰,身体,武器三项组成部分,

posted @ 2012-02-08 18:59  Tiny&zzh  阅读(354)  评论(0编辑  收藏  举报