private double GetCellSpeed(int cellId, bool throughEntities) { BlueSheep.Data.D2p.Map data = MapData.Data; var speed = data.Cells[cellId].Speed; MapPoint cell = new MapPoint(cellId); if (throughEntities) { if (!(MapData.NoEntitiesOnCell(cellId))) { return(20); } if (speed >= 0) { return(1 + (5 - speed)); } return(1 + (11 + Math.Abs(speed))); } var cost = 1.0D; MapPoint adjCell = null; if (!(MapData.NoEntitiesOnCell(cellId))) { cost += 0.3; } adjCell = new MapPoint(cell.X + 1, cell.Y); if (adjCell != null && !(MapData.NoEntitiesOnCell(adjCell.CellId))) { cost += 0.3; } adjCell = new MapPoint(cell.X, cell.Y + 1); if (adjCell != null && !(MapData.NoEntitiesOnCell(adjCell.CellId))) { cost += 0.3; } adjCell = new MapPoint(cell.X - 1, cell.Y); if (adjCell != null && !(MapData.NoEntitiesOnCell(adjCell.CellId))) { cost += 0.3; } adjCell = new MapPoint(cell.X, cell.Y - 1); if (adjCell != null && !(MapData.NoEntitiesOnCell(adjCell.CellId))) { cost += 0.3; } // todo // if (m_context.IsCellMarked(cell)) // cost += 0.2; return(cost); }
// Methods public Pathfinder(BlueSheep.Data.D2p.Map Map, Map map) { this.Map = map; this.MapData = Map; if (Map.Id == 2561) { this.ListCellIdFighters.Add(53); } }
/// <summary> /// Actualize and display the new location. /// </summary> public void ParseLocation(int mapId, int subAreaId) { Data = BlueSheep.Data.D2p.MapsManager.FromId(mapId); Data.SubAreaId = subAreaId; DataClass subArea = GameData.GetDataObject(D2oFileEnum.SubAreas, subAreaId); string mapName = I18N.GetText((int)GameData.GetDataObject(D2oFileEnum.Areas, (int)subArea.Fields["areaId"]).Fields["nameId"]); string subAreaName = I18N.GetText((int)subArea.Fields["nameId"]); m_Account.ModifBar(5, 0, 0, "[" + X + ";" + Y + "]" + " " + mapName + " (" + subAreaName + ")"); }
private bool IsCellWalkable(int cellId) { BlueSheep.Data.D2p.Map MapData = (BlueSheep.Data.D2p.Map)m_Account.Map.Data; if (m_Account.Map.Data.IsWalkable(cellId)) { var selectedFighter = Fighters.FirstOrDefault((f) => f.CellId == cellId || MapData.Cells[cellId].NonWalkableDuringFight()); if (selectedFighter != null) { return(false); } else { return(true); } } return(false); }
public bool IsChangeZone(int fCell, int sCell) { BlueSheep.Data.D2p.Map data = MapData.Data; return(data.Cells[fCell].MoveZone != data.Cells[sCell].MoveZone && System.Math.Abs(data.Cells[fCell].Floor) == System.Math.Abs(data.Cells[sCell].Floor)); }