コード例 #1
0
    static public StatInfo GetStatInfo(XmlNode stat_node, eAttackType AttackType)
    {
        StatInfo info = new StatInfo();

        foreach (XmlAttribute attr in stat_node.Attributes)
        {
            eStatType stat_type = StatInfo.GetStatType(attr.Name);
            int       value     = int.Parse(attr.Value);

            switch (stat_type)
            {
            case eStatType.Attack:
                info.SetValue(eStatType.PhysicAttack, value);
                info.SetValue(eStatType.MagicAttack, value);
                info.SetValue(eStatType.Heal, value);
                break;

            case eStatType.Defense:
                switch (AttackType)
                {
                case eAttackType.physic:
                    info.SetValue(eStatType.PhysicDefense, value);
                    info.SetValue(eStatType.MagicDefense, (int)(value * StatInfo.DefenseTypeRatio));
                    break;

                case eAttackType.magic:
                    info.SetValue(eStatType.PhysicDefense, (int)(value * StatInfo.DefenseTypeRatio));
                    info.SetValue(eStatType.MagicDefense, value);
                    break;

                case eAttackType.heal:
                    info.SetValue(eStatType.PhysicDefense, (int)(value * StatInfo.DefenseTypeRatio));
                    info.SetValue(eStatType.MagicDefense, (int)(value * StatInfo.DefenseTypeRatio));
                    break;
                }
                break;

            default:
                info.SetValue(stat_type, value);
                break;
            }
        }
        return(info);
    }
コード例 #2
0
    StatInfo LoadStatPresetInfo(XmlNode node)
    {
        StatInfo info = new StatInfo();

        foreach (XmlAttribute attr in node.Attributes)
        {
            eStatType stat_type = StatInfo.GetStatType(attr.Name);
            int       value     = int.Parse(attr.Value);
            info.SetValue(stat_type, value);
        }

        return(info);
    }
コード例 #3
0
ファイル: CreatureStat.cs プロジェクト: tapenjoyGame/cry
    public void CalculateStat(List <Buff> buffs)
    {
        Stat = new StatInfo();
        foreach (eStatType type in Enum.GetValues(typeof(eStatType)))
        {
            if ((int)type >= 100)
            {
                continue;
            }

            int value = Base.GetValue(type);
            Stat.SetValue(type, value);
        }

        if (buffs != null)
        {
            foreach (Buff buff in buffs)
            {
                if (buff.IsFinish == true)
                {
                    continue;
                }

                switch (buff.ActionInfo.actionType)
                {
                case eActionType.buff:
                case eActionType.debuff:
                {
                    int buff_value = buff.Value;
                    switch (buff.ActionInfo.statType)
                    {
                    case eStatType.Attack:
                    {
                        Stat.AddValue(eStatType.PhysicAttack, buff_value);
                        Stat.AddValue(eStatType.MagicAttack, buff_value);
                        Stat.AddValue(eStatType.Heal, buff_value);
                    }
                    break;

                    case eStatType.Defense:
                    {
                        Stat.AddValue(eStatType.PhysicDefense, buff_value);
                        Stat.AddValue(eStatType.MagicDefense, buff_value);
                    }
                    break;

                    default:
                        Stat.AddValue(buff.ActionInfo.statType, buff_value);
                        break;
                    }
                }
                break;

                case eActionType.buff_percent:
                case eActionType.debuff_percent:
                {
                    long buff_value = buff.ActionInfo.actionType == eActionType.buff_percent ? buff.Value : -buff.Value;
                    switch (buff.ActionInfo.statType)
                    {
                    case eStatType.Attack:
                    {
                        Stat.AddValue(eStatType.PhysicAttack, (int)(Base.GetValue(eStatType.PhysicAttack) * buff_value / 10000));
                        Stat.AddValue(eStatType.MagicAttack, (int)(Base.GetValue(eStatType.MagicAttack) * buff_value / 10000));
                        Stat.AddValue(eStatType.Heal, (int)(Base.GetValue(eStatType.Heal) * buff_value / 10000));
                    }
                    break;

                    case eStatType.Defense:
                    {
                        Stat.AddValue(eStatType.PhysicDefense, (int)(Base.GetValue(eStatType.PhysicAttack) * buff_value / 10000));
                        Stat.AddValue(eStatType.MagicDefense, (int)(Base.GetValue(eStatType.MagicDefense) * buff_value / 10000));
                    }
                    break;

                    default:
//                                     if (StatInfo.IsPercentValue(buff.ActionInfo.statType) == true)
//                                         Stat.AddValue(buff.ActionInfo.statType, buff_value);
//                                     else
                        Stat.AddValue(buff.ActionInfo.statType, (int)(Base.GetValue(buff.ActionInfo.statType) * buff_value / 10000));
                        break;
                    }
                }
                break;
                }
            }
        }
    }