Пример #1
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();
        }
    }
Пример #2
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();
        }
    }
Пример #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();
        }
    }
Пример #4
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();
        }
    }
Пример #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();
        }
    }
Пример #6
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();
        }
    }
Пример #7
0
 public void Initialize(InterfaceManager manager, ICollection <Entity> candidates,
                        SingleEntityResult result)
 {
     this.manager = manager;
     this.result  = result;
     foreach (Entity ent in candidates)
     {
         Hex pos = ent.Position;
         whoIsWhere.Add(pos, ent);
         GenerateSelectionHex(pos);
     }
 }
Пример #8
0
    public SingleEntityResult OfferSingleEntitySelection(ICollection <Entity> options)
    {
        SingleEntityResult result = new SingleEntityResult();

        SingleEntitySelection ses = Instantiate(singleEntityPromptPrefab);

        ses.Initialize(this, options, result);
        ses.transform.parent = transform;

        activeSelection = ses;
        pendingResult   = result;

        state = InterfaceState.BusyWithSelection;

        return(result);
    }
Пример #9
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();
        }
    }