Ejemplo n.º 1
0
        public bool CanUseWeapon(Cell cell, WeaponTemplate weapon)
        {
            if (!IsFighterTurn())
            {
                return(false);
            }

            if (HasState((int)SpellStatesEnum.AFFAIBLI_42))
            {
                return(false);
            }

            var point = new MapPoint(cell);

            if ((weapon.CastInDiagonal && (point.EuclideanDistanceTo(Position.Point) > weapon.WeaponRange || point.EuclideanDistanceTo(Position.Point) < weapon.MinRange)) ||
                (!weapon.CastInDiagonal && point.ManhattanDistanceTo(Position.Point) > weapon.WeaponRange || point.ManhattanDistanceTo(Position.Point) < weapon.MinRange))
            {
                return(false);
            }

            if (m_weaponUses >= weapon.MaxCastPerTurn)
            {
                return(false);
            }

            return(AP >= weapon.ApCost && Fight.CanBeSeen(cell, Position.Cell));
        }
Ejemplo n.º 2
0
        public WorldMapGraveyardRecord GetNearestGraveyard(Map currentMap)
        {
            var actualPoint = new MapPoint(currentMap.Position);

            return(GetGraveyards().OrderBy(x => actualPoint.EuclideanDistanceTo(new MapPoint(x.Map.Position)))
                   .OrderByDescending(x => x.Map.Area.Id == currentMap.Area.Id)
                   .OrderByDescending(x => x.SubAreaId == currentMap.SubArea.Id).FirstOrDefault());
        }