Ejemplo n.º 1
0
 public TiledModifier(ModifierCore core, int adderObjectId, string rangeKey,
                      HashSet <HexTileCoord> tiles, int leftWeek)
 {
     _core            = core;
     AdderObjectId    = adderObjectId;
     _infos[rangeKey] = new TiledModifierInfo(tiles, leftWeek);
 }
Ejemplo n.º 2
0
        /// <summary>
        ///     Returns pure added tile effect range
        /// </summary>
        public HashSet <HexTileCoord> AddTileInfo(string rangeKey, HashSet <HexTileCoord> tiles, int leftWeek)
        {
            if (_infos.ContainsKey(rangeKey))
            {
                return(new HashSet <HexTileCoord>());
            }

            var result = new HashSet <HexTileCoord>(
                from t in tiles
                where _infos.Values.All(info => !info.Tiles.Contains(t))
                select t);

            _infos[rangeKey] = new TiledModifierInfo(tiles, leftWeek);

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Returns removed range and newly affected range
        /// </summary>
        /// <returns></returns>
        public (HashSet <HexTileCoord> removed, HashSet <HexTileCoord> added) MoveTileInfo(
            string rangeKey, HashSet <HexTileCoord> newTiles)
        {
            if (!_infos.ContainsKey(rangeKey))
            {
                return(new HashSet <HexTileCoord>(), new HashSet <HexTileCoord>());
            }

            var pureAdded = new HashSet <HexTileCoord>(
                from t in newTiles
                where _infos.Values.All(info => !info.Tiles.Contains(t))
                select t);

            var originalTile = _infos[rangeKey].Tiles;

            _infos[rangeKey] = new TiledModifierInfo(newTiles, _infos[rangeKey].LeftWeek);

            var pureRemoved = new HashSet <HexTileCoord>(
                from t in originalTile
                where _infos.Values.All(info => !info.Tiles.Contains(t))
                select t);

            return(pureRemoved, pureAdded);
        }