Exemplo n.º 1
0
    /// <summary>
    /// 创建功法
    /// </summary>
    public static void CreateRandomGongfa(int lv, GongfaType gongfa_typ, int color, List <GongfaStaticData> gongfa_list, List <ItemStaticData> item_list)
    {
        create_id = gongfa_list.Count;
        GongfaStaticData gongfa;
        ItemSubType      sub_type = ItemSubType.Heart;

        if ((gongfa_typ & GongfaType.heart) == GongfaType.heart)
        {
            gongfa = new HeartGongfaStaticData(lv, gongfa_typ, color, create_id);
        }
        else
        {
            gongfa = new SkillGongfaStaticData(lv, gongfa_typ, color, create_id);
            if ((gongfa_typ & GongfaType.attack) == GongfaType.attack)
            {
                sub_type = ItemSubType.Attack;
            }
            else if ((gongfa_typ & GongfaType.body) == GongfaType.body)
            {
                sub_type = ItemSubType.Body;
            }
            else if ((gongfa_typ & GongfaType.skill) == GongfaType.skill)
            {
                sub_type = ItemSubType.Skill;
            }
            else if ((gongfa_typ & GongfaType.magic) == GongfaType.magic)
            {
                sub_type = ItemSubType.Magic;
            }
        }

        if (gongfa != null)
        {
            gongfa_list.Add(gongfa);
            CreateGongfaItem(gongfa, item_list, sub_type);
        }
    }
Exemplo n.º 2
0
    public static void CreateGongfaItem(GongfaStaticData gongfa, List <ItemStaticData> item_list, ItemSubType sub_type)
    {
        StringBuilder des = new StringBuilder();

        if (gongfa is HeartGongfaStaticData)
        {
            HeartGongfaStaticData gf = (HeartGongfaStaticData)gongfa;
            des.AppendFormat("道点消耗:{0}", gf.need_daodian);
        }
        else if (gongfa is SkillGongfaStaticData)
        {
            SkillGongfaStaticData gf = (SkillGongfaStaticData)gongfa;
            des.AppendFormat("技能冷却:{0}", gf.cool);
            des.AppendLine();
            des.AppendFormat("施法消耗:{0}", gf.cost);
        }
        des.AppendLine();
        des.AppendLine("——————————————————");

        bool isSkill = true;

        for (int i = 0; i < gongfa.attr_id.Length; i++)
        {
            var            attr_id        = gongfa.attr_id[i];
            GongfaAttrData main_attr_data = GongfaAttrConfig.GetAttrConfig(attr_id);
            if (!main_attr_data.isSkill && isSkill)
            {
                isSkill = false;
                des.AppendLine("<color=#E28225FF>装备后可获得以下属性</color>");
            }
            if (isSkill)
            {
                des.AppendLine(DesFormat(main_attr_data.des, gongfa.attr_value[i]));
            }
            else
            {
                des.AppendLine(" " + DesFormat(main_attr_data.des, gongfa.attr_value[i]));
            }
        }
        des.AppendLine("——————————————————");
        for (int i = 0; i < gongfa.ex_id.Length; i++)
        {
            GongfaAttrData congfa_attr_data = GongfaAttrConfig.GetAttrConfig(gongfa.ex_id[i]);
            des.AppendFormat(" <size=10>{1}</size>:<color=#{0}>", GameConst.item_color_str[gongfa.ex_color[i]], GameConst.attr_level_name[i]);
            des.Append(DesFormat(congfa_attr_data.des, gongfa.ex_values[i]));
            des.AppendLine("</color>");
        }
        des.AppendLine("——————————————————");
        if (gongfa.attr_condition[0].Length == 1)
        {
            RoleAttrConfig[] attribute_config = RoleAttrConfigData.GetAttrConfig();
            des.AppendFormat("学习条件:{0}达到{1}", attribute_config[(int)gongfa.attr_condition[0][0]].name, gongfa.value_condition[0]);
        }
        else
        {
            des.AppendFormat("任意一项战斗资质达到{0}", gongfa.value_condition[0]);
        }



        int item_static_id = item_list.Count;
        var item           = new ItemStaticData()
        {
            id       = item_static_id,
            type     = ItemType.Gongfa,
            sub_ype  = sub_type,
            price    = gongfa.price,
            maxcount = 1,
            param    = new int[] { gongfa.id },

            name  = gongfa.name,
            icon  = ItemSubType.Magic - sub_type,
            color = gongfa.color,
            level = gongfa.level,

            des         = des.ToString(),
            attributes  = null,
            attr_values = null,
        };

        item_list.Add(item);
    }