Example #1
0
    public static int DamageFrom1StrifedInvaders(TokenCountDictionary tokens)
    {
        var strifedInvaderWithMostDamage = tokens.Invaders().OfType <HealthToken>()
                                           .OrderByDescending(x => x.FullHealth)
                                           .FirstOrDefault();

        return(strifedInvaderWithMostDamage != null ? strifedInvaderWithMostDamage.FullHealth : 0);
    }
Example #2
0
    static async Task EachInvaderReduceHealthByStrifeCount(TokenCountDictionary tokens, int minimum)
    {
        var strifedInvaders = tokens.Invaders()
                              .Where(x => 0 < x.StrifeCount)
                              .OrderBy(x => x.RemainingHealth)
                              .ToArray(); // get the lowest ones first so we can reduce without them cascading

        foreach (HealthToken strifedInvader in strifedInvaders)
        {
            await ReduceInvaderHealthByItsOwnStrife(tokens, strifedInvader, minimum);
        }
    }
Example #3
0
    static async Task EachInvaderTakesDamageByStrifeCount(TokenCountDictionary tokens)
    {
        var strifedInvaders = tokens.Invaders()
                              .Where(x => 0 < x.StrifeCount)
                              .OrderBy(x => x.RemainingHealth)
                              .ToArray(); // get the lowest ones first so we can reduce without them cascading

        // !!! ??? Do badlands cause damage here?

        foreach (HealthToken strifedInvader in strifedInvaders)
        {
            await DamageInvaderHealthByItsOwnStrife(tokens, strifedInvader);
        }
    }
Example #4
0
 public static TokenFrom1Space ForStrife(TokenCountDictionary tokens, params TokenClass[] groups)
 => new TokenFrom1Space("Add Strife",
                        tokens.Space,
                        (groups != null && groups.Length > 0) ? tokens.OfAnyType(groups) : tokens.Invaders(),
                        Present.Always
                        );
Example #5
0
 public static int DamageFromStrifedInvaders(TokenCountDictionary tokens)
 {
     return(tokens.Invaders().OfType <HealthToken>().Where(x => x.StrifeCount > 0).Sum(si => si.FullHealth * tokens[si]));
 }