void RateFireLocation(PlanOfAttack poa, AttackOption option)
    {
        if (poa.ability != null)
        {
            AbilityRange range = poa.ability.GetComponent <AbilityRange>();
            List <Tile>  tiles = range.GetTilesInRange(owner.board);
            option.targets = tiles;
            for (int i = 0; i < tiles.Count; ++i)
            {
                Tile tile = tiles[i];
                if (!poa.ability.GetComponent <AbilityEffectTarget>().IsTarget(tile))
                {
                    continue;
                }

                bool isMatch = IsAbilityTargetMatch(poa, tile);
                if (isMatch && poa.ability.GetComponent <BaseAbilityEffect>() is HealAbilityEffect)
                {
                    if (tile.content.GetComponent <Health>().FullHP)
                    {
                        option.AddMark(tile, false);
                        option.AddMark(tile, false);
                    }
                    else
                    {
                        option.AddMark(tile, isMatch);
                    }
                }
                option.AddMark(tile, isMatch);
            }
        }
    }
예제 #2
0
        private void PlanDirectionIndependent(PlanOfAttack poa)
        {
            Tile         startTile    = actor.tile;
            var          map          = new Dictionary <Tile, AttackOption>();
            AbilityRange abilityRange = poa.ability.GetComponent <AbilityRange>();
            List <Tile>  moveOptions  = GetMoveOptions();

            // Loop on the move options (movement range).
            for (int i = 0; i < moveOptions.Count; ++i)
            {
                Tile moveTile = moveOptions[i];
                actor.Place(moveTile);
                List <Tile> fireOptions = abilityRange.GetTilesInRange(bc.board);

                // Loop on the fire options (ability range).
                for (int j = 0; j < fireOptions.Count; ++j)
                {
                    Tile         fireTile     = fireOptions[j];
                    AttackOption attackOption = null;
                    if (map.ContainsKey(fireTile))
                    {
                        attackOption = map[fireTile];
                    }
                    else
                    {
                        attackOption           = new AttackOption();
                        attackOption.target    = fireTile;
                        attackOption.direction = actor.dir;
                        map[fireTile]          = attackOption;
                        RateFireLocation(poa, attackOption);
                    }

                    attackOption.AddMoveTarget(moveTile);
                }
            }

            // Place the actor back to the initial tile. If we didn't do this, the
            // AI would be out of sync with the visuals.
            actor.Place(startTile);
            var list = new List <AttackOption>(map.Values);

            PickBestOption(poa, list);
        }
예제 #3
0
    void PlanDirectionIndependent(PlanOfAttack poa)
    {
        Tile startTile = actor.tile;
        Dictionary <Tile, AttackOption> map = new Dictionary <Tile, AttackOption>();
        AbilityRange ar          = poa.ability.GetComponent <AbilityRange>();
        List <Tile>  moveOptions = GetMoveOptions();

        for (int i = 0; i < moveOptions.Count; ++i)
        {
            Tile moveTile = moveOptions[i];
            actor.Place(moveTile);
            List <Tile> fireOptions = ar.GetTilesInRange(bc.board);

            for (int j = 0; j < fireOptions.Count; ++j)
            {
                Tile         fireTile = fireOptions[j];
                AttackOption ao       = null;
                if (map.ContainsKey(fireTile))
                {
                    ao = map[fireTile];
                }
                else
                {
                    ao            = new AttackOption();
                    map[fireTile] = ao;
                    ao.target     = fireTile;
                    ao.direction  = actor.dir;
                    RateFireLocation(poa, ao);
                }

                ao.AddMoveTarget(moveTile);
            }
        }

        actor.Place(startTile);
        List <AttackOption> list = new List <AttackOption>(map.Values);

        PickBestOption(poa, list);
    }
예제 #4
0
 void SelectTiles()
 {
     tiles = ar.GetTilesInRange(board);
     board.SelectTiles(tiles);
 }
예제 #5
0
    public override List <Tile> GetTilesInArea(Board board, Point pos)
    {
        AbilityRange ar = GetComponent <AbilityRange>();

        return(ar.GetTilesInRange(board));
    }
예제 #6
0
 void SelectTiles()
 {
     tiles = ar.GetTilesInRange(board);
     Debug.Log(tiles.Count);
     board.SelectTiles(tiles, 2);
 }