Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cell"></param>
        /// <returns></returns>
        public FightActionResultEnum SetCell(FightCell cell)
        {
            if (IsFighterDead)
            {
                return(FightActionResultEnum.RESULT_DEATH);
            }

            if (Cell != null)
            {
                if (Cell == cell)
                {
                    return(FightActionResultEnum.RESULT_NOTHING);
                }

                var removeResult = Cell.RemoveObject(this);
                if (removeResult != FightActionResultEnum.RESULT_NOTHING)
                {
                    return(removeResult);
                }
            }

            Cell = cell;

            if (Cell != null)
            {
                var moveResult = Cell.AddObject(this);
                if (moveResult != FightActionResultEnum.RESULT_NOTHING)
                {
                    return(moveResult);
                }

                var buffResult = BuffManager.EndMove();
                if (buffResult != FightActionResultEnum.RESULT_NOTHING)
                {
                    return(buffResult);
                }

                if (Fight.LoopState != FightLoopStateEnum.STATE_ENDED)
                {
                    return(Fight.TryKillFighter(this, this));
                }
            }

            if (Fight.State != FightStateEnum.STATE_FIGHTING)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }