Exemple #1
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 #2
0
    //what should the card do when its played, remember to do outcome.Complete or outcome.Cancel
    public override IEnumerator CardBehaviour(CardActionResult outcome)
    {
        //throw new System.NotImplementedException();
        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();

            int damage = 0;

            if (victim.Position.DistanceTo(pos) > 1)
            {
                damage = maxDamage - victim.Position.DistanceTo(pos);
            }
            else
            {
                damage = maxDamage;
            }

            GameplayContext.Player.DealDamageTo(victim, damage);
            GameplayContext.Player.TriggerAttackEvent(victim);

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

            outcome.Complete();
        }
        else
        {
            outcome.Cancel();
        }
    }
Exemple #3
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();
        }
    }