示例#1
0
        public bool CheckEnableMove(Unit self, Grid grid, bool bSurinuke, bool ignoreObject = false)
        {
            if (self == null || grid == null)
            {
                return(false);
            }
            int moveCount = self.GetMoveCount(false);

            for (int index1 = 0; index1 < self.SizeX; ++index1)
            {
                for (int index2 = 0; index2 < self.SizeY; ++index2)
                {
                    Grid grid1 = this[grid.x + index1, grid.y + index2];
                    if (grid1 == null)
                    {
                        return(false);
                    }
                    GeoParam geo = grid1.geo;
                    if (geo != null && ((bool)geo.DisableStopped || (int)geo.cost > moveCount))
                    {
                        return(false);
                    }
                    Unit gimmickAtGrid = this.mBattle.FindGimmickAtGrid(grid1, false, self);
                    if (gimmickAtGrid != null && !gimmickAtGrid.IsIntoUnit)
                    {
                        return(false);
                    }
                    if (!ignoreObject)
                    {
                        Unit unitAtGrid = this.mBattle.FindUnitAtGrid(grid1);
                        if (unitAtGrid != null && self != unitAtGrid)
                        {
                            if (bSurinuke)
                            {
                                if (self.Side != unitAtGrid.Side)
                                {
                                    return(false);
                                }
                            }
                            else if (!unitAtGrid.IsIntoUnit)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            return(true);
        }
示例#2
0
        public bool CalcMoveRoutes(Unit self)
        {
            if (self == null)
            {
                return(false);
            }
            this.mMoveRoutes.Clear();
            this.mMoveStep = 0;
            Grid current = this[self.x, self.y];

            this.mMoveRoutes.Add(current);
            int moveCount = self.GetMoveCount(false);

            for (int index = 0; index < moveCount; ++index)
            {
                bool last = index == moveCount - 1;
                Grid grid = this.CalcNextMoveRoutes(self, current, last);
                if (grid != null)
                {
                    this.mMoveRoutes.Add(grid);
                    current = grid;
                }
                else
                {
                    break;
                }
            }
            for (int index = this.mMoveRoutes.Count - 1; index > 0; --index)
            {
                if (!this.CheckEnableMove(self, this.mMoveRoutes[index], false, false))
                {
                    this.mMoveRoutes.RemoveAt(index);
                }
                else if (self.AI != null && self.AI.CheckFlag(AIFlags.CastSkillFriendlyFire) && this.mBattle.CheckFriendlyFireOnGridMap(self, this.mMoveRoutes[index]))
                {
                    this.mMoveRoutes.RemoveAt(index);
                }
                else
                {
                    break;
                }
            }
            return(this.mMoveRoutes.Count > 1);
        }