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)); }
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()); }