Exemplo n.º 1
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        List <Hex> movementCandidates = new List <Hex>();

        //cast out a line in each direction from the player to determine movement spots
        foreach (Hex dir in Hex.Directions)
        {
            List <Hex> line = GridHelper.CastLineInDirection(GameplayContext.Grid,
                                                             GameplayContext.Player.Position, dir, moveDistance, false, false, true);

            GridHelper.RemoveOccupiedHexes(GameplayContext.Grid, line);

            movementCandidates.AddRange(line);
        }



        // Show the locations to the player and let them pick one
        SingleHexResult moveLocation
            = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates);

        // Wait until the player has made a selection or cancels the action
        yield return(new WaitUntil(moveLocation.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!moveLocation.WasCancelled())
        {
            // Move to the location they selected
            Hex moveDirection = GameplayContext.Player.Position.GetDirectionTo(moveLocation.GetResult());
            Hex moveFrom      = GameplayContext.Player.Position;
            Hex movePosition  = moveLocation.GetResult();
            GameplayContext.Player.MoveTo(moveLocation.GetResult());
            int        spotsToHit  = moveFrom.DistanceTo(GameplayContext.Player.Position);
            List <Hex> spotsInPath = GridHelper.CastLineInDirection(GameplayContext.Grid, moveFrom, moveDirection, spotsToHit, false, false, true);
            spotsInPath.Remove(GameplayContext.Player.Position);
            foreach (Hex spot in spotsInPath)
            {
                if (GameplayContext.Grid.GetEntityAtHex(spot) is Entity hit)
                {
                    if (hit.HasStatusEffect(typeof(WetStatusEffect)))
                    {
                        GameplayContext.Player.DealDamageTo(hit, baseDamage * 2);
                        hit.ApplyStatusEffect(new StunStatusEffect());
                        GameplayContext.Player.TriggerAttackEvent(hit);
                    }
                    else
                    {
                        GameplayContext.Player.DealDamageTo(hit, baseDamage);
                    }
                }
            }
            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemplo n.º 2
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        // Get the list of possible locations to move to
        List <Hex> movementCandidates =
            GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position,
                                       moveDistance);

        movementCandidates.Remove(GameplayContext.Player.Position);

        // Show the locations to the player and let them pick one
        SingleHexResult moveLocation
            = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates);

        // Wait until the player has made a selection or cancels the action
        yield return(new WaitUntil(moveLocation.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!moveLocation.WasCancelled())
        {
            // Move to the location they selected
            GameplayContext.Player.MoveTo(moveLocation.GetResult());
            FXHelper.PlaySound("MechStep");
            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemplo n.º 3
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        List <Hex> movementCandidates = new List <Hex>();

        //cast out a line in each direction from the player to determine movement spots
        foreach (Hex dir in Hex.Directions)
        {
            List <Hex> line = GridHelper.CastLineInDirection(GameplayContext.Grid,
                                                             GameplayContext.Player.Position, dir, moveDistance, includeStart: false);

            movementCandidates.AddRange(line);
        }



        // Show the locations to the player and let them pick one
        SingleHexResult moveLocation
            = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates);

        // Wait until the player has made a selection or cancels the action
        yield return(new WaitUntil(moveLocation.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!moveLocation.WasCancelled())
        {
            // Move to the location they selected
            GameplayContext.Player.MoveTo(moveLocation.GetResult());
            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemplo n.º 4
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        List <Hex> movementCandidates = new List <Hex>();



        //cast out a line in each direction from the player to determine movement spots
        foreach (Hex dir in Hex.Directions)
        {
            List <Hex> line = GridHelper.CastLineInDirection(GameplayContext.Grid,
                                                             GameplayContext.Player.Position, dir, range, includeStart: false);

            movementCandidates.AddRange(line);
            movementCandidates.Remove(GameplayContext.Player.Position);
        }



        // Show the locations to the player and let them pick one
        SingleHexResult moveLocation
            = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates);

        // Wait until the player has made a selection or cancels the action
        yield return(new WaitUntil(moveLocation.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!moveLocation.WasCancelled())
        {
            Hex targetpoint = moveLocation.GetResult();

            //get all 6 hexes around that point
            List <Hex> pointsAroundTarget =
                GridHelper.GetHexesInRange(GameplayContext.Grid, targetpoint, 1, false);

            //add the point we clicked to that list, so we now have all 7 hexes
            pointsAroundTarget.Add(targetpoint);
            pointsAroundTarget.Remove(GameplayContext.Player.Position);

            //for each hex
            foreach (Hex spot in pointsAroundTarget)
            {
                //find who's standing there
                Entity victim = GameplayContext.Grid.GetEntityAtHex(spot);
                if (victim != null)
                {
                    //hurt them
                    GameplayContext.Player.DealDamageTo(victim, 5);
                    victim.ApplyStatusEffect(new StunStatusEffect());
                    GameplayContext.Player.TriggerAttackEvent(victim);
                }
            }

            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }