Esempio n. 1
0
        //-------------------------------------------------
        /// <summary>
        /// Generate a new Skill with the leve zero.
        /// All of the Unit Properties are Basic Unit.
        /// NOTICE: You can't Generate a new skill
        /// with level more than zero.
        /// And all of the Hero Skills Generated by this
        /// method are Basic Unit.
        /// </summary>
        /// <param name="skillName">
        /// The name of this Skill,
        /// this will be shown to the player in the interface.
        /// </param>
        /// <param name="skillIndex">
        /// The Index of this Skill in the
        /// <see cref="HeroSkill.Skills"/> array.
        /// </param>
        /// <param name="skillRate">
        /// The SkillRate of this Skill.
        /// Please NOTICE that we will
        /// beat the next level of the current level of this
        /// skill to the specified value from the skillRate
        /// in order to determine the specified
        /// value of the next level of the skill.
        /// please read the Example part of
        /// this description for more information.
        /// </param>
        /// <param name="owner">
        /// The <see cref="Hero"/> owner of this Skill.
        /// We won't use this owner in the
        /// <see cref="GetForSerialize()"/> nor
        /// in the <see cref="GetForServer()"/>,
        /// so you should pass it by coding
        /// each time.
        /// </param>
        /// <param name="imagePath">
        /// the Image of this Skill,
        /// please use 64x64 images for the skills with
        /// index less than (?).
        /// </param>
        /// <returns>
        /// an object of this class, <see cref="Skill"/>
        /// </returns>
        /// <example>
        /// Look, SkillRate Should not be Basic,
        /// which is mean you should a
        /// good skillRate and when player wants to
        /// upgrade the level of this skill,
        /// we will beat the level (for example level one)
        /// to the Skill rate specified Rate and add it to the
        /// current specified value(for example:
        /// (1 * HP(Unit(10nil))) + HP(Unit(0nil))
        /// ** The second one is the current HP value **
        /// </example>
        public static Skill GenerateSkill(
            string skillName,
            uint skillIndex,
            SkillRate skillRate,
            string heroID,
            string imagePath)
        {
            Skill mySkill = new Skill()
            {
                SkillName  = skillName,
                SkillLevel = 0,
                SkillIndex = skillIndex,
                SkillRate  = skillRate,
                //-----------------------
                HP_Plus    = Unit.GetBasicUnit(),
                ATK_Plus   = Unit.GetBasicUnit(),
                INT_Plus   = Unit.GetBasicUnit(),
                DEF_Plus   = Unit.GetBasicUnit(),
                RES_Plus   = Unit.GetBasicUnit(),
                SPD_Plus   = Unit.GetBasicUnit(),
                PEN_Plus   = Unit.GetBasicUnit(),
                Block_Plus = Unit.GetBasicUnit(),
            };

            File.Copy(imagePath,
                      ThereIsConstants.Path.Datas_Path +
                      ThereIsConstants.Path.DoubleSlash +
                      FirstNameOfImageFile + heroID +
                      OrdinaryFileSeparator +
                      skillIndex + HeroSerialize.EndNameOfFile, true);
            return(mySkill);
        }
Esempio n. 2
0
        public string GetForSerialize()
        {
            string myString =
                SkillName + CharSeparator +
                SkillIndex + CharSeparator +
                SkillRate.ToString() + CharSeparator;

            return(myString);
        }
Esempio n. 3
0
        //-------------------------------------------------
        /// <summary>
        /// This mehod will Parse the specified
        /// serialized string to Skill.
        /// NOTICE: this method won't use <see cref="SetInfoFromServer(string)"/>,
        /// thus the info which should be loaded from
        /// the server, are NULL.
        /// </summary>
        /// <param name="serializedStringValue"></param>
        /// <returns></returns>
        public static Skill Parse(string serializedStringValue, Hero owner)
        {
            string[] myStrings = serializedStringValue.Split(CharSeparator.ToCharArray(),
                                                             StringSplitOptions.RemoveEmptyEntries);
            Skill skill = new Skill(owner)
            {
                SkillName  = myStrings[0],
                SkillIndex = Convert.ToUInt32(myStrings[1]),
                SkillRate  = SkillRate.ParseToSkillRate(myStrings[2])
            };

            return(skill);
        }
Esempio n. 4
0
        //-------------------------------------------------
        public static SkillRate ParseToSkillRate(string stringValue)
        {
            string[] shiro = stringValue.Split(OutCharSeparator.ToCharArray(),
                                               StringSplitOptions.RemoveEmptyEntries);
            SkillRate skillRate = new SkillRate()
            {
                HP_Rate    = Unit.ConvertToUnit(shiro[0]),
                ATK_Rate   = Unit.ConvertToUnit(shiro[1]),
                INT_Rate   = Unit.ConvertToUnit(shiro[2]),
                DEF_Rate   = Unit.ConvertToUnit(shiro[3]),
                RES_Rate   = Unit.ConvertToUnit(shiro[4]),
                SPD_Rate   = Unit.ConvertToUnit(shiro[5]),
                PEN_Rate   = Unit.ConvertToUnit(shiro[6]),
                Block_Rate = Unit.ConvertToUnit(shiro[7]),
            };

            return(skillRate);
        }