Exemple #1
0
 public override IEnumerator CardBehaviour(CardActionResult outcome)
 {
     GameplayContext.Manager.DiscardHand();
     GameplayContext.Manager.AttemptDrawCard(n: cardsToDraw);
     outcome.Complete();
     yield break;
 }
Exemple #2
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();
        }
    }
Exemple #3
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        Hex pos = GameplayContext.Player.Position;

        //TODO: replace this with a line of sight check maybe?
        List <Entity> targets =
            GridHelper.GetEntitiesInRange(GameplayContext.Grid, pos, range);

        List <Hex> allpositions = GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 999);


        //don't let the player shoot themselves
        targets.Remove(GameplayContext.Player);

        SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(targets);

        yield return(new WaitUntil(target.IsReadyOrCancelled));

        if (!target.WasCancelled())
        {
            Entity victim = target.GetResult();
            GameplayContext.Player.DealDamageTo(victim, baseDamage);
            victim.ApplyStatusEffect(new StunStatusEffect());
            victim.MoveTo(allpositions.PopRandom());
            GameplayContext.Player.TriggerAttackEvent(victim);
            //GameplayContext.Ui.FireTracerBetween(GameplayContext.Player, victim);
            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #4
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();
        }
    }
Exemple #5
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        Hex pos = GameplayContext.Player.Position;

        //TODO: replace this with a line of sight check maybe?
        List <Entity> targets =
            GridHelper.GetEntitiesInRange(GameplayContext.Grid, pos, range);

        //don't let the player shoot themselves
        targets.Remove(GameplayContext.Player);

        SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(targets);

        yield return(new WaitUntil(target.IsReadyOrCancelled));

        if (!target.WasCancelled())
        {
            Entity victim = target.GetResult();
            GameplayContext.Player.DealDamageTo(victim, baseDamage);
            GameplayContext.Player.TriggerAttackEvent(victim);

            FXHelper.FireTracerBetween(GameplayContext.Player, victim);
            FXHelper.PlaySound("rifleShot");
            FXHelper.PlaySound(victim.rangedHitSoundName, 0.1f);

            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #6
0
 public override IEnumerator CardBehaviour(CardActionResult outcome)
 {
     GameplayContext.Player.ApplyStatusEffect(new ArmourLockStatusEffect(blockPercentage));
     GameplayContext.Manager.EndPlayerTurn();
     outcome.Complete();
     yield break;
 }
Exemple #7
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        //get a list of adjacent entities
        List <Entity> adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid,
                                                                    GameplayContext.Player.Position);

        //let the player select one of the adjacent entities
        SingleEntityResult target =
            GameplayContext.Ui.OfferSingleEntitySelection(adjacentEnts);

        //wait for the player to make a selection
        yield return(new WaitUntil(target.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!target.WasCancelled())
        {
            //hit 'em
            Entity victim = target.GetResult();
            GameplayContext.Player.DealDamageTo(victim, baseDamage);
            victim.ApplyStatusEffect(new StunStatusEffect());
            GameplayContext.Player.TriggerAttackEvent(victim);
            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #8
0
    //what should the card do when its played, remember to do outcome.Complete or outcome.Cancel
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        Hex pos = GameplayContext.Player.Position;

        //TODO: replace this with a line of sight check maybe?
        List <Entity> targets =
            GridHelper.GetEntitiesInRange(GameplayContext.Grid, pos, range);

        targets.Remove(GameplayContext.Player);

        SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(targets);

        yield return(new WaitUntil(target.IsReadyOrCancelled));

        if (!target.WasCancelled())
        {
            Entity victim = target.GetResult();
            if (victim.Health.HealthAsFraction() <= 0.5f)
            {
                baseDamage = baseDamage * 2;
            }
            GameplayContext.Player.DealDamageTo(victim, baseDamage);
            GameplayContext.Player.TriggerAttackEvent(victim);
            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #9
0
    //what should the card do when its played, remember to do outcome.Complete or outcome.Cancel
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        //get a list of ranged entities
        List <Entity> rangedEnts = GridHelper.GetEntitiesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 3);

        //let the player select one of the enties
        SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(rangedEnts);

        //wait for the player to make a selection
        yield return(new WaitUntil(target.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!target.WasCancelled())
        {
            //hit 'em
            Entity victim = target.GetResult();
            for (int i = 1; i <= 30; i++)
            {                             // 30 attacks
                if (Random.value <= 0.1f) // 10% chance to hit
                {
                    GameplayContext.Player.DealDamageTo(victim, baseDamage);
                }
            }
            GameplayContext.Player.TriggerAttackEvent(victim);
            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #10
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();
        }
    }
Exemple #11
0
    //TODO: come back and fix this once resistance exists
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        OverclockStatusEffect effect = new OverclockStatusEffect(healthPenalty, damageMultiplier);

        GameplayContext.Player.ApplyStatusEffect(effect);
        outcome.Complete();
        yield break;
    }
Exemple #12
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();
        }
    }
Exemple #13
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        //get a list of adjacent entities
        List <Entity> adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid,
                                                                    GameplayContext.Player.Position);

        //let the player select one of the adjacent entities
        SingleEntityResult target =
            GameplayContext.Ui.OfferSingleEntitySelection(adjacentEnts);

        //wait for the player to make a selection
        yield return(new WaitUntil(target.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!target.WasCancelled())
        {
            Entity victim = target.GetResult();
            if (victim.Health.HealthAsFraction() <= 0.5f)
            {
                baseDamage = baseDamage * 2;
            }
            GameplayContext.Player.DealDamageTo(victim, baseDamage);
            GameplayContext.Player.TriggerAttackEvent(victim);
            adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid, victim.Position);
            if (adjacentEnts.Contains(GameplayContext.Player))
            {
                adjacentEnts.Remove(GameplayContext.Player);
            }
            foreach (Entity toZap in adjacentEnts)
            {
                //don't hit terrain
                if (!toZap.AcceptsStatusEffects)
                {
                    continue;
                }
                //hit 'em
                Entity victims = target.GetResult();
                if (toZap.HasStatusEffect(typeof(WetStatusEffect)))
                {
                    GameplayContext.Player.DealDamageTo(victims, baseDamage * 2);
                    toZap.ApplyStatusEffect(new StunStatusEffect());
                }
                else
                {
                    GameplayContext.Player.DealDamageTo(victims, baseDamage);
                }
            }

            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #14
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        foreach (Entity victim in GameplayContext.Manager.allEnemies)
        {
            //find who's standing there
            if (victim != null)
            {
                //hurt them
                GameplayContext.Player.DealDamageTo(victim, 7);
                victim.ApplyStatusEffect(new StunStatusEffect());
                GameplayContext.Player.TriggerAttackEvent(victim);
            }
        }

        outcome.Complete();
        yield break;
    }
Exemple #15
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        //get a list of adjacent entities
        List <Entity> adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid, GameplayContext.Player.Position);


        //let the player select one of the adjacent entities
        SingleEntityResult target =
            GameplayContext.Ui.OfferSingleEntitySelection(adjacentEnts);

        //wait for the player to make a selection
        yield return(new WaitUntil(target.IsReadyOrCancelled));

        // If the player didn't cancel the selection
        if (!target.WasCancelled())
        {
            //hit 'em
            Entity victim = target.GetResult();

            //get all 6 spots around the player
            Hex        diffVector  = GameplayContext.Player.Position - victim.Position;
            List <Hex> spotsToBurn =
                GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 1, false);

            spotsToBurn.Remove(diffVector + GameplayContext.Player.Position); //remove the spot behind the target
            spotsToBurn.Remove(GameplayContext.Player.Position);              //don't hit the player

            foreach (Hex h in spotsToBurn)
            {
                if (GameplayContext.Grid.GetEntityAtHex(h) is Entity toHit)
                {
                    GameplayContext.Player.DealDamageTo(toHit, baseDamage);
                    toHit.ApplyStatusEffect(new BurnStatusEffect(baseDamage, damagePerTurn, turnsRemaining));
                    GameplayContext.Player.TriggerAttackEvent(toHit);
                }
            }

            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #16
0
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        //get all 6 spots around the player
        List <Hex> spotsToWet =
            GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 1, false);

        spotsToWet.Remove(GameplayContext.Player.Position);     //don't hit the player
        List <Hex> allpositions = GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 999);

        foreach (Hex h in spotsToWet)
        {
            if (GameplayContext.Grid.GetEntityAtHex(h) is Entity toHit)
            {
                GameplayContext.Player.DealDamageTo(toHit, baseDamage);
                toHit.MoveTo(allpositions.PopRandom());
                toHit.ApplyStatusEffect(new WetStatusEffect(baseDamage, turnsRemaining));
                GameplayContext.Player.TriggerAttackEvent(toHit);
            }
        }

        outcome.Complete();
        yield break;
    }
Exemple #17
0
 public override IEnumerator CardBehaviour(CardActionResult outcome)
 {
     GameplayContext.Player.ApplyStatusEffect(new IgniteStatusEffect(increasePrecentage));
     outcome.Complete();
     yield break;
 }
Exemple #18
0
 public override IEnumerator CardBehaviour(CardActionResult outcome)
 {
     GameplayContext.Player.ApplyStatusEffect(new WaterWallStatusEffect(blockPercentage, turns));
     outcome.Complete();
     yield break;
 }
Exemple #19
0
 public override IEnumerator CardBehaviour(CardActionResult outcome)
 {
     GameplayContext.Player.ApplyStatusEffect(new ChargeStatusEffect());
     outcome.Complete();
     yield break;
 }
Exemple #20
0
 //what should the card do when its played, remember to do outcome.Complete or outcome.Cancel
 public override IEnumerator CardBehaviour(CardActionResult outcome)
 {
     GameplayContext.Manager.energy += energyIncrease;
     outcome.Complete();
     yield break;
 }