Ejemplo n.º 1
0
    public override void Use()
    {
        TileAttributes t = specs.owner.tile;

        if (t.north != null && t.north.containedCharacter != null)
        {
            t.north.containedCharacter.damage(1);
        }
        if (t.south != null && t.south.containedCharacter != null)
        {
            t.south.containedCharacter.damage(1);
        }
        if (t.east != null && t.east.containedCharacter != null)
        {
            t.east.containedCharacter.damage(1);
        }
        if (t.west != null && t.west.containedCharacter != null)
        {
            t.west.containedCharacter.damage(1);
        }

        map = specs.owner.tile.map;
        map.highlighter.mode    = Highlighter.SelectionMode.PIECE_TO_USE;
        specs.owner.usedAbility = true;
        cooldownTimer           = cooldown;
    }
Ejemplo n.º 2
0
    public List <TileAttributes> GetPossibleMoves()
    {
        t   = moved.owner.tile;
        map = t.map;
        m   = map.tileMap;

        possibilities = new List <TileAttributes> ();

        times = new double[m.GetLength(0), m.GetLength(1)];
        paths = new List <TileAttributes> [m.GetLength(0), m.GetLength(1)];

        propogateTimes(t, timeSpent - tileTypeTimes[moved.owner.tile.type], new List <TileAttributes>());

        times [moved.owner.x, moved.owner.y] = 0;

        for (int n = 0; n < times.GetLength(0); n++)
        {
            for (int nn = 0; nn < times.GetLength(1); nn++)
            {
                if (times [n, nn] != 0)
                {
                    possibilities.Add(m [n, nn]);
                }
            }
        }

        return(possibilities);
    }
Ejemplo n.º 3
0
    public void propogateTimes(TileAttributes t, double time, List <TileAttributes> path)
    {
        double newTime = time + tileTypeTimes[t.type];
        List <TileAttributes> newPath = new List <TileAttributes> (path);

        newPath.Add(t);

        if (newTime <= timeToMove &&
            (newTime < times[t.x, t.y] || times[t.x, t.y] == 0))
        {
            times[t.x, t.y]  = newTime;
            paths [t.x, t.y] = newPath;

            if (t.north != null && t.north.containedCharacter == null)
            {
                propogateTimes(t.north, newTime, newPath);
            }
            if (t.south != null && t.south.containedCharacter == null)
            {
                propogateTimes(t.south, newTime, newPath);
            }
            if (t.east != null && t.east.containedCharacter == null)
            {
                propogateTimes(t.east, newTime, newPath);
            }
            if (t.west != null && t.west.containedCharacter == null)
            {
                propogateTimes(t.west, newTime, newPath);
            }
        }
    }
Ejemplo n.º 4
0
    public void kill()
    {
        //Remove this if statement if we Finish/Remove active effects after a character dies

        team.TeamDamage(this.type.morale);
        team.activePieces--;
        x    = -500;
        y    = -500;
        tile = null;

        //team.TeamDamage(this.type.morale); //inflicts damage to team's morale
        //foreach(ActiveEffect a in activeEffects)
        //{
        //	a.Finish();
        //}
        EffectCheck();
        GameObject.Destroy(this.gameObject);

        /*if(type.type==ClassSpecifications.CharacterType.Priest)
         * {
         *      passive.Finish();
         * }*/
        if (team.activePieces <= 0)
        {
            team.manager.RemoveTeam(team);
        }
    }
Ejemplo n.º 5
0
 public static void RemoveAttributeFromSelectedTiles(TileAttributes ta)
 {
     foreach (var i in SelectedTiles)
     {
         SourceImages[SelectedSource].RemoveAttribute(i, ta);
     }
 }
Ejemplo n.º 6
0
 public void AddAttribute(TileAttributes ta)
 {
     if (!Attributes.Contains(ta))
     {
         Attributes.Add(ta);
     }
 }
Ejemplo n.º 7
0
 public static void AddAttributeToSelectedTiles(TileAttributes ta)
 {
     foreach (var i in SelectedTiles)
     {
         SourceImages[SelectedSource].AddAttribute(i, ta);
     }
 }
Ejemplo n.º 8
0
 public void RemoveAttribute(int index, TileAttributes ta)
 {
     if (TileData.ContainsKey(index))
     {
         TileData[index].RemoveAttribute(ta);
     }
 }
Ejemplo n.º 9
0
    public override void Generate(GridMaintaner gridMaintaner)
    {
        if (_pointOfInterestPrefabs.Count == 0)
        {
            GrabPOIPrefabs();
        }

        #region TEMP
        List <Vector2Int> points = gridMaintaner.GetComponent <TEMP_SpecificPointsOfInterest>().Points;
        foreach (Vector2Int point in points)
        {
            PointOfInterest   poi     = _pointOfInterestPrefabs[PointsOfInterest.POIType.DEAD_END];
            List <Vector2Int> offsets = poi.GetPointOffsets();
            foreach (Vector2Int offset in offsets)
            {
                TileAttributes attr = gridMaintaner.GetTileAt(point + offset);
                attr.SetOpenDirections(poi.GetOpenDirectionsOfTile(offset));
                attr.SetTileType(Attributes.TileType.POINT_OF_INTEREST);
            }
            TileAttributes ti = gridMaintaner.GetTileAt(point);
            ti.SetTileType(Attributes.TileType.POINT_OF_INTEREST_MAIN);
        }
        #endregion

        LogSuccess("points of interest");
    }
Ejemplo n.º 10
0
 public void RemoveAttribute(TileAttributes ta)
 {
     if (Attributes.Contains(ta))
     {
         Attributes.Remove(ta);
     }
 }
Ejemplo n.º 11
0
    void moveInDirection(Direction d)
    {
        switch (d)
        {
        case Direction.west:
            if (selectedTile.west != null)
            {
                selectedTile = selectedTile.west;
            }
            break;

        case Direction.north:
            if (selectedTile.north != null)
            {
                selectedTile = selectedTile.north;
            }
            break;

        case Direction.south:
            if (selectedTile.south != null)
            {
                selectedTile = selectedTile.south;
            }
            break;

        case Direction.east:
            if (selectedTile.east != null)
            {
                selectedTile = selectedTile.east;
            }
            break;
        }

        this.gameObject.transform.position = selectedTile.transform.position;
    }
Ejemplo n.º 12
0
 public void Move(TileAttributes t)
 {
     tile.containedCharacter = null;
     this.transform.position = t.transform.position;
     tile = t;
     tile.containedCharacter = this;
     x = t.x;
     y = t.y;
 }
Ejemplo n.º 13
0
    public void putOnBoard()
    {
        x = (int)Math.Round(this.transform.position.x - team.map.LowX);
        y = (int)Math.Round(this.transform.position.y - team.map.LowY);

        tile     = team.map.tileMap[x, y];
        lastTile = team.map.tileMap[x, y];
        tile.containedCharacter = this;
    }
Ejemplo n.º 14
0
 public void Enqueue8Pixels(int[] pixelLine, TileAttributes tileAttributes)
 {
     foreach (var p in pixelLine)
     {
         _pixels.Enqueue(p);
         _palettes.Enqueue(tileAttributes.GetColorPaletteIndex());
         _priorities.Enqueue(tileAttributes.IsPriority() ? 100 : -1);
     }
 }
Ejemplo n.º 15
0
 public new void Init(CharacterCharacter c, int rounds)
 {
     attackBonus = Dround(c.type.attack * (attackPercent));
     healthBonus = Dround(c.type.maximumHealth * (healthPercent));
     base.Init(c, rounds);
     lastTile = c.tile;
     NewTile();
     specs = c.type;
 }
Ejemplo n.º 16
0
 void BreakBridge(TileAttributes t)
 {
     t.type = TileAttributes.TileType.brokenBridge;
     t.GetComponent <Renderer>().material = brokenBridgeMat;
     if (t.containedCharacter != null)
     {
         t.containedCharacter.returnToStart();
     }
 }
Ejemplo n.º 17
0
    public override void Generate(GridMaintaner gridMaintaner)
    {
        TileAttributes tile = gridMaintaner.GetTileAt(Vector2Int.zero);

        tile.SetTileType(Attributes.TileType.STARTING_TILE);
        tile.SetOpenDirections(Attributes.OpenDirections.ALL);

        LogSuccess("first tile");
    }
Ejemplo n.º 18
0
        public static void DeselectFromAttribute(TileAttributes ta)
        {
            if (SelectedTiles.Count == 0)
            {
                return;
            }
            var tiles = GetSelectedTiles().Where(t => !t.Attributes.Contains(ta));

            SelectedTiles = tiles.Select(t => t.Index).ToList();
        }
Ejemplo n.º 19
0
        static TileAttributes()
        {
            Attributes = new TileAttributes[256];

            for (var i = 0; i < 256; i++)
            {
                Attributes[i] = new TileAttributes(i);
            }

            Empty = Attributes[0];
        }
Ejemplo n.º 20
0
 public void AddAttribute(int index, TileAttributes ta)
 {
     if (TileData.ContainsKey(index))
     {
         TileData[index].AddAttribute(ta);
     }
     else
     {
         var t = new Tile(index);
         t.AddAttribute(ta);
         TileData[index] = t;
     }
 }
Ejemplo n.º 21
0
    public Move(GameObject subject, TileAttributes source, TileAttributes target, double speed)
    {
        this.subject = subject;
        sourceX      = source.x;
        sourceY      = source.y;
        targetX      = target.x;
        targetY      = target.y;
        this.speed   = speed;
        direction    = (new Vector3((float)(targetX - sourceX), (float)(targetY - sourceY), 0.0f));
        direction    = direction.normalized;
        direction.Scale(new Vector3((float)speed, (float)speed, (float)speed));

        map = target.map;
    }
Ejemplo n.º 22
0
    public void Start()
    {
        subject   = GetComponentInParent <TileAttributes>();
        source    = subject.map.teams.teams[0];
        turnsLeft = 100;
        buffed    = GetComponent <MeshRenderer>().material;

        buffHighlighter = Instantiate(subject.map.highlighter.possibleMovesHighlighter);
        buffHighlighter.GetComponent <Renderer>().material = buffed;
        buffHighlighter.transform.SetParent(subject.transform);
        RectTransform rt = buffHighlighter.GetComponent <RectTransform> ();

        rt.anchoredPosition = new Vector2(0, 0);
    }
Ejemplo n.º 23
0
        /*
         * lcdc.0
         *
         * when 0 => sprites are always displayed on top of the bg
         *
         * bg tile attribute.7
         *
         * when 0 => use oam priority bit
         * when 1 => bg priority
         *
         * sprite attribute.7
         *
         * when 0 => sprite above bg
         * when 1 => sprite above bg color 0
         */

        public void SetOverlay(int[] pixelLine, int offset, TileAttributes spriteAttr, int oamIndex)
        {
            for (var j = offset; j < pixelLine.Length; j++)
            {
                var p = pixelLine[j];
                var i = j - offset;
                if (p == 0)
                {
                    continue; // color 0 is always transparent
                }

                var oldPriority = _priorities.Get(i);

                var put = false;
                if ((oldPriority == -1 || oldPriority == 100) && !_lcdc.IsBgAndWindowDisplay())
                {
                    // this one takes precedence
                    put = true;
                }
                else if (oldPriority == 100)
                {
                    // bg with priority
                    put = _pixels.Get(i) == 0;
                }
                else if (oldPriority == -1 && !spriteAttr.IsPriority())
                {
                    // bg without priority
                    put = true;
                }
                else if (oldPriority == -1 && spriteAttr.IsPriority() && _pixels.Get(i) == 0)
                {
                    // bg without priority
                    put = true;
                }
                else if (oldPriority >= 0 && oldPriority < 10)
                {
                    // other sprite
                    put = oldPriority > oamIndex;
                }

                if (put)
                {
                    _pixels.Set(i, p);
                    _palettes.Set(i, spriteAttr.GetColorPaletteIndex());
                    _priorities.Set(i, oamIndex);
                }
            }
        }
Ejemplo n.º 24
0
            public void EditTerrain(int X, int Y, int LayerIndex)
            {
                Terrain        SelectedTerrain = GetTerrain(X, Y, LayerIndex);
                TileAttributes TA = new TileAttributes(new Terrain(SelectedTerrain));

                if (TA.ShowDialog() == DialogResult.OK)
                {
                    ReplaceTerrain(X, Y, new Terrain(X, Y,
                                                     SelectedTerrain.TerrainTypeIndex,
                                                     TA.MVEnterCost,
                                                     TA.MVMoveCost,
                                                     TA.ListActivation.ToArray(),
                                                     TA.ListBonus.ToArray(),
                                                     TA.ListBonusValue.ToArray()), LayerIndex);
                }
            }
Ejemplo n.º 25
0
    public void GetEnemyTargetsUnderPercent(int x, int y, float range, Team team)
    {
        double underHPpercent             = .3;
        List <CharacterCharacter> inRange = GetTargetsInRange(x, y, range);

        foreach (GameObject g in GameObject.FindGameObjectsWithTag("Possible Move Highlighters"))
        {
            GameObject.Destroy(g);
        }
        map.highlighter.mode = Highlighter.SelectionMode.SELECT_TARGETS;
        if (instructionLabel.text.Equals("Select " + targetsToAquire + "pieces.") == false)
        {
            GameObject.Destroy(GameObject.FindGameObjectWithTag("Ability Selector"));
        }
        instructionLabel.text = "Select " + targetsToAquire + " pieces.";

        if (targets.Count > 0)
        {
            TileAttributes t = targets [0];
            if (t.containedCharacter != null)
            {
                if (inRange.Contains(t.containedCharacter) && t.containedCharacter.team != team && (double)t.containedCharacter.currentHP / t.containedCharacter.type.maximumHealth <= underHPpercent)
                {
                    charachterTargets.Add(t.containedCharacter);
                    targetsToAquire--;
                }
                else
                {
                    map.highlighter.mode  = Highlighter.SelectionMode.PIECE_TO_USE;
                    instructionLabel.text = "";
                }
            }
            else
            {
                instructionLabel.text = "";
                map.highlighter.mode  = Highlighter.SelectionMode.PIECE_TO_USE;
            }
            targets.Remove(t);
        }

        if (targetsToAquire <= 0)
        {
            targetsAquired        = true;
            instructionLabel.text = "";
        }
    }
Ejemplo n.º 26
0
    public void GetTargets(int x, int y, float range)
    {
        List <CharacterCharacter> inRange = GetTargetsInRange(x, y, range);

        foreach (GameObject g in GameObject.FindGameObjectsWithTag("Possible Move Highlighters"))
        {
            GameObject.Destroy(g);
        }
        map.highlighter.mode = Highlighter.SelectionMode.SELECT_TARGETS;
        if (instructionLabel.text.Equals("Select " + targetsToAquire + "pieces.") == false)
        {
            GameObject.Destroy(GameObject.FindGameObjectWithTag("Ability Selector"));
        }
        instructionLabel.text = "Select " + targetsToAquire + " pieces.";

        if (targets.Count > 0)
        {
            TileAttributes t = targets [0];
            if (t.containedCharacter != null)
            {
                if (inRange.Contains(t.containedCharacter))
                {
                    charachterTargets.Add(t.containedCharacter);
                    targetsToAquire--;
                }
                else
                {
                    map.highlighter.mode  = Highlighter.SelectionMode.PIECE_TO_USE;
                    instructionLabel.text = "";
                }
            }
            else
            {
                instructionLabel.text = "";
                map.highlighter.mode  = Highlighter.SelectionMode.PIECE_TO_USE;
            }
            targets.Remove(t);
        }

        if (targetsToAquire <= 0)
        {
            targetsAquired        = true;
            instructionLabel.text = "";
        }
    }
Ejemplo n.º 27
0
    TileAttributes NearestSafeTile(TileAttributes t, int r)
    {
        int j;

        TileAttributes[,] map = t.map.tileMap;
        for (int i = -1 * r; i <= r; i++)
        {
            j = Math.Abs(i) - r;
            if (map[t.x + i, t.y + j] != null && map[t.x + i, t.y + j].containedCharacter == null && ((LimitedSpaces)(type.movement)).tileTypeTimes[map[t.x + i, t.y + j].type] < 9000)
            {
                return(map[t.x + i, t.y + j]);
            }
            j = -1 * j;
            if (map[t.x + i, t.y + j] != null && map[t.x + i, t.y + j].containedCharacter == null && ((LimitedSpaces)(type.movement)).tileTypeTimes[map[t.x + i, t.y + j].type] < 9000)
            {
                return(map[t.x + i, t.y + j]);
            }
        }

        return(NearestSafeTile(t, r + 1));
    }
Ejemplo n.º 28
0
 void DestroyNearbyBridges(TileAttributes t)
 {
     if (specs.owner.tile.north != null && t.north.type == TileAttributes.TileType.breakableBridge)
     {
         BreakBridge(t.north);
         DestroyNearbyBridges(t.north);
     }
     if (specs.owner.tile.east != null && t.east.type == TileAttributes.TileType.breakableBridge)
     {
         BreakBridge(t.east);
         DestroyNearbyBridges(t.east);
     }
     if (specs.owner.tile.south != null && t.south.type == TileAttributes.TileType.breakableBridge)
     {
         BreakBridge(t.south);
         DestroyNearbyBridges(t.south);
     }
     if (specs.owner.tile.west != null && t.west.type == TileAttributes.TileType.breakableBridge)
     {
         BreakBridge(t.west);
         DestroyNearbyBridges(t.west);
     }
 }
Ejemplo n.º 29
0
 void RepairNearbyBridges(TileAttributes t)
 {
     if (specs.owner.tile.north != null && t.north.type == TileAttributes.TileType.brokenBridge)
     {
         FixBridge(t.north);
         RepairNearbyBridges(t.north);
     }
     if (specs.owner.tile.east != null && t.east.type == TileAttributes.TileType.brokenBridge)
     {
         FixBridge(t.east);
         RepairNearbyBridges(t.east);
     }
     if (specs.owner.tile.south != null && t.south.type == TileAttributes.TileType.brokenBridge)
     {
         FixBridge(t.south);
         RepairNearbyBridges(t.south);
     }
     if (specs.owner.tile.west != null && t.west.type == TileAttributes.TileType.brokenBridge)
     {
         FixBridge(t.west);
         RepairNearbyBridges(t.west);
     }
 }
Ejemplo n.º 30
0
    public void Move(TileAttributes t)
    {
        List <Animation> movements = new List <Animation>();

        movements.Add(new global::Move(this.moved.owner.gameObject, moved.owner.tile, (paths [t.x, t.y]) [0], 1.0));

        for (int i = 1; i < paths [t.x, t.y].Count; i++)
        {
            movements.Add(new global::Move(this.moved.owner.gameObject, (paths [t.x, t.y]) [i - 1], (paths [t.x, t.y]) [i], 1.0));
        }

        map.AddAnimationSequence(movements);

        t.containedCharacter = moved.owner;
        moved.owner.tile.containedCharacter = null;
        moved.owner.tile = t;
        //moved.owner.transform.position = t.transform.position;
        moved.owner.x = t.x;
        moved.owner.y = t.y;

        timeSpent = times[t.x, t.y];
        //timeSpent = timeToMove;
    }