static async Task DamageInvaderHealthByItsOwnStrife(TokenCountDictionary tokens, HealthToken originalInvader) { var newInvader = originalInvader.AddDamage(originalInvader.StrifeCount); if (newInvader == originalInvader) { return; } if (newInvader.IsDestroyed) { await tokens.Destroy(originalInvader, tokens[originalInvader]); } else { tokens.Adjust(newInvader, tokens[originalInvader]); tokens.Init(originalInvader, 0); } }
static async Task ReduceInvaderHealthByItsOwnStrife(TokenCountDictionary tokens, HealthToken originalInvader, int minimum) { int newHealth = Math.Min(minimum, originalInvader.FullHealth - originalInvader.StrifeCount); var newInvader = new HealthToken(originalInvader.Class, newHealth, originalInvader.Damage, originalInvader.StrifeCount); if (newInvader == originalInvader) { return; } if (newInvader.IsDestroyed) { await tokens.Destroy(originalInvader, tokens[originalInvader]); } else { tokens.Adjust(newInvader, tokens[originalInvader]); tokens.Init(originalInvader, 0); // !!! Need something at end of turn to restore health. } }
public void Init(Token token, int count) => _tokens.Init(token, count);
public void Init(int count) => tokens.Init(token, count);