Beispiel #1
0
        /// <summary>
        /// 获取经验值
        /// </summary>
        /// <param name="n"></param>
        public static void GetExp(float n)
        {
            var currentExp = Exp + n;

            if (currentExp >= MaxExp)
            {
                currentExp = currentExp - MaxExp;
                LevelUp();
                BattleUpdater.UpdateStageInfo();
            }
            PropertyPanelUpdater.Update();
        }
Beispiel #2
0
        public static void RecoverHealth(float n)
        {
            Health = Math.Min(MaxHealth, Convert.ToSingle(Math.Round(Convert.ToDouble(Health + n))));
            //死亡
            if (Health < 1)
            {
                GameInfo.EndType = GameEndType.死亡;
                GameInfo.End();
                return;
            }

            PropertyPanelUpdater.Update();
        }
 public static void GenerateHotelEvent(BaseEvent e)
 {
     e.Title       = "荒原酒馆";
     e.Description = "花费金币休息有可能得到意外的惊喜!";
     e.Choose1Name = "驻足";
     e.Choose2Name = "大吃一顿";
     e.Choose3Name = "住宿休息";
     e.Choose1Desc = "恢复最大生命值和魔法值的20%";
     e.Choose2Desc = "花费50金币\n恢复最大生命值和魔法值的50%";
     e.Choose3Desc = "花费100金币\n恢复所有生命值和魔法值";
     e.Sprite      = SpriteHelper.GetEventSprite(e.Type);
     e.Choose1     = () =>
     {
         Hero.Health = Math.Min(Hero.MaxHealth, Hero.Health + Hero.MaxHealth * 0.2f);
         Hero.Mana   = Math.Min(Hero.MaxMana, Hero.Mana + Hero.MaxMana * 0.2f);
         PropertyPanelUpdater.Update();
         GameInfo.NewStage();
     };
     e.Choose2 = () =>
     {
         if (GameInfo.Money < 50)
         {
             BattleUpdater.UpdateMessage("别逗我,你太穷了");
             return;
         }
         GameInfo.Money -= 50;
         Hero.RecoverHealth(Hero.MaxHealth * 0.5f);
         Hero.RecoverMana(Hero.MaxMana * 0.5f);
         BattleUpdater.UpdateStageInfo();
         GameInfo.NewStage();
     };
     e.Choose3 = () =>
     {
         if (GameInfo.Money < 100)
         {
             BattleUpdater.UpdateMessage("别逗我,你太穷了");
             return;
         }
         GameInfo.Money -= 100;
         Hero.RecoverHealth(Hero.MaxHealth);
         Hero.RecoverMana(Hero.MaxMana);
         BattleUpdater.UpdateStageInfo();
         GameInfo.NewStage();
     };
 }
        /// <summary>
        /// 开始一场新的对局
        /// </summary>
        public static void NewGame()
        {
            CurrentScene       = SceneType.BattleMain;
            EndType            = GameEndType.None;
            ActivedProps       = new List <BaseProp>();
            GainedProps        = new List <PropName>();
            ActivedSkills      = new List <BaseSkill>();
            LearnedSkills      = new List <BaseSkill>();
            EventList          = new List <BaseEvent>();
            OccurredEvents     = new List <BaseEvent>();
            CurrentStageEvents = new List <BaseEvent>();

            HeroRoleList = new List <BaseHeroRole>();
            Day          = 0;
            Money        = 1200;

            //初始化照相机信息
            CameraSetter.Init();
            //初始化宝物信息
            PropIniter.Init();
            //初始化技能信息
            SkillIniter.Init(Role);
            //初始化事件信息
            EventIniter.Init();
            //初始化怪物列表
            MonsterIniter.Init();
            //初始化职业信息
            HeroRoleIniter.Init();
            //初始化英雄属性
            Hero.New(Role);

            Hero.Health = 40;
            Hero.Mana   = 1;
            //更新英雄属性面板
            PropertyPanelUpdater.Update();
            //更新关卡信息面板
            BattleUpdater.UpdateStageInfo();

            BattleUpdater.UpdateMessage("欢迎来到荒原之城!");

            BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.ChooseEvent);
            BattleCanvasSetter.SwitchBattleScene();
            NewStage();
        }
        public static void Init()
        {
            GameInfo.ActivedProps.Clear();
            GameInfo.GainedProps.Clear();

            {
                var prop = new BaseProp();
                prop.Name        = PropName.生锈的铁锤;
                prop.DisplayName = "生锈的铁锤";
                prop.Description = "被人遗弃的铁锤,增加8点物理攻击力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.PhysicalAttack = Hero.PhysicalAttack + 8;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }

            {
                var prop = new BaseProp();
                prop.Name        = PropName.学徒木杖;
                prop.DisplayName = "学徒木杖";
                prop.Description = "初级魔法师使用的武器,增加8点法术攻击力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.MagicAttack = Hero.MagicAttack + 8;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }

            {
                var prop = new BaseProp();
                prop.Name        = PropName.新兵盾牌;
                prop.DisplayName = "新兵盾牌";
                prop.Description = "士兵使用的盾牌,增加5点物理防御力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.PhysicalArmor = Hero.PhysicalArmor + 5;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }

            {
                var prop = new BaseProp();
                prop.Name        = PropName.魔法硬币;
                prop.DisplayName = "魔法硬币";
                prop.Description = "魔法世界的通用货币,增加5点法术防御力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.MagicArmor = Hero.MagicArmor + 5;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }

            {
                var prop = new BaseProp();
                prop.Name        = PropName.息烈焰;
                prop.DisplayName = "不息烈焰";
                prop.Description = "永不熄灭的火焰,增加1点火焰之力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.FirePower = Hero.FirePower + 1;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }

            {
                var prop = new BaseProp();
                prop.Name        = PropName.纯净之瓶;
                prop.DisplayName = "纯净之瓶";
                prop.Description = "精灵饮水所需的容器,增加1点纯净之力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.PurePower = Hero.PurePower + 1;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }

            {
                var prop = new BaseProp();
                prop.Name        = PropName.乌鸦披风;
                prop.DisplayName = "乌鸦披风";
                prop.Description = "乌鸦之神早年间使用的披风,增加1点暗影之力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.ShadowPower = Hero.ShadowPower + 1;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }


            {
                var prop = new BaseProp();
                prop.Name        = PropName.太阳挂坠;
                prop.DisplayName = "太阳挂坠";
                prop.Description = "带有太阳图标的挂坠,增加1点神圣之力";
                prop.Type        = PropType.Normal;
                prop.Price       = 66;
                prop.Gains       = () =>
                {
                    Hero.HolyPower = Hero.HolyPower + 1;
                    PropertyPanelUpdater.Update();
                };
                GameInfo.ActivedProps.Add(prop);
            }

            //for (int i = 0; i < 50; i++)
            //{
            //    GameInfo.GainProp(PropName.生锈的铁锤);
            //}
        }
Beispiel #6
0
 public static void RecoverMana(float n)
 {
     Mana = Math.Min(MaxMana, Convert.ToSingle(Math.Round(Convert.ToDouble(Mana + n))));
     Mana = Mana < 0 ? 0 : Mana;
     PropertyPanelUpdater.Update();
 }