Ejemplo n.º 1
0
        public bool UseSkill()
        {
            if (equipSkill == null)
            {
                return(false);
            }

            if (equipSkill.UseSkill(this.towards, this.pos_v, this.pos_h) == GameDef.UseSkillStatus.RunOutTimes)
            {
                equipSkill = null;
                return(true);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public bool EatElement()
        {
            if (this.liftUpELemStack.Count == 0)
            {
                Debug.WriteLine("[Player] no element can be eaten");
                return(false);
            }

            var e = liftUpELemStack.Peek();

            if (!e.canBeEaten())
            {
                Debug.WriteLine("[Player] element {0} can not be eatean", e.name);
                return(false);
            }

            //TODO: Opt 吃金元素逻辑
            if (e.type == GameDef.GameObj.Glod)
            {
                e.BeEatean();
            }
            else             // 技能类元素,吃同一种元素,剩余使用次数叠加
            {
                if (this.equipSkill != null && this.equipSkill.type == GameDef.GlobalData.SkillMap[e.type])
                {
                    this.equipSkill.remain_use_time += e.remain_time;
                }
                else
                {
                    this.equipSkill = new FlameBomb(e.remain_time);
                }
            }

            // Common logic
            Debug.WriteLine("Eat Element {0} ", e.name);
            gsm.stage.activateElement.Remove(e);
            this.liftUpELemStack.Pop();

            return(true);
        }