예제 #1
0
        public static HeroInfo CreateRandomHero(byte hType, int crLevel)
        {
            HeroInfo info = new HeroInfo();

            if (hType == 2)
            {
                info.SetRace((byte)Dice(1, SingletonFactory <RaceConfig> .Instance.GetMaxId(hType), 100));
            }
            else
            {
                info.SetRace((byte)Dice(1, SingletonFactory <RaceConfig> .Instance.GetMaxId(hType)));
            }
            info.SetClassLevel((byte)Dice(1, SingletonFactory <ClassConfig> .Instance.GetMaxId()), 1);

            int diceNum, dice;

            switch (crLevel)
            {
            case 1:
                diceNum = 1;
                dice    = 4;
                break;

            default:
                diceNum = 3;
                dice    = 6;
                break;
            }

            Dictionary <enmPropType, int> basePoints = new Dictionary <enmPropType, int>();

            for (enmPropType type = enmPropType.BP_MIN + 1; type < enmPropType.BP_MAX; type++)
            {
                basePoints[type] = Dice(diceNum, dice);
            }
            info.InitBasePoints(basePoints);

            return(info);
        }
예제 #2
0
        private enmCommandResult DoChooseRace(object[] param)
        {
            if (mCreatingHero == null)
            {
                mCreatingHero = new HeroInfo();
            }

            byte raceId = 0;

            try
            {
                raceId = byte.Parse(param[0].ToString());
            }
            catch (Exception)
            {
                return(enmCommandResult.FAILED);
            }

            mCreatingHero.SetRace(raceId);

            return(enmCommandResult.SUCCESS);
        }