public int ApplyDefaultCooldownToCharacter_CharacterCooldownUpdatedCorrectly(double agi) { var character = this.CreateCharacterWithAgi(agi); var battleCharacter = new BattleCharacter(character, Const.Team.Player); var service = new TurnOrderService(); service.ApplyDefaultCooldownToCharacter(battleCharacter); return battleCharacter.ActionCooldown; }
public int ApplySkillCooldownToCharacter_CharacterCooldownUpdatedCorrectly(double agi, int rank) { var character = this.CreateCharacterWithAgi(agi); var battleCharacter = new BattleCharacter(character, Const.Team.Player); var skill = this.CreateSkillWithRank(rank); var service = new TurnOrderService(); service.ApplySkillCooldownToCharacter(battleCharacter, skill); return battleCharacter.ActionCooldown; }
public void GetActionOrder_ReturnsListOrderedByCooldown() { var service = new TurnOrderService(); this.ApplyDefaultCooldown(this._battleCharacters); var orderedList = service.GetActionOrder(this._battleCharacters); // 2 is first because of the BattleCharacterid... Assert.AreEqual(orderedList[0].character.BattleCharacterId, 2); Assert.AreEqual(orderedList[1].character.BattleCharacterId, 1); Assert.AreEqual(orderedList[2].character.BattleCharacterId, 4); Assert.AreEqual(orderedList[3].character.BattleCharacterId, 3); }
public void GetActionOrder_MinCooldownSubtractedForAllCharacters() { var service = new TurnOrderService(); this.ApplyDefaultCooldown(this._battleCharacters); var orderedList = service.GetActionOrder(this._battleCharacters); // default cooldown is 12, 12, 15, 21 // after ticking should be 0, 0, 3, 9 Assert.AreEqual(orderedList[0].character.ActionCooldown, 0); Assert.AreEqual(orderedList[1].character.ActionCooldown, 0); Assert.AreEqual(orderedList[2].character.ActionCooldown, 3); Assert.AreEqual(orderedList[3].character.ActionCooldown, 9); }
public void GetActionOrder_IgnoresDeadCharacter() { this._battleCharacters[0].CurrentHp = 0; var deadId = this._battleCharacters[0].BattleCharacterId; var service = new TurnOrderService(); this.ApplyDefaultCooldown(this._battleCharacters); var orderedList = service.GetActionOrder(this._battleCharacters); Assert.AreEqual(orderedList.Count, 10); Assert.AreEqual(orderedList[0].character.BattleCharacterId, 2); Assert.AreEqual(orderedList[1].character.BattleCharacterId, 4); Assert.AreEqual(orderedList[2].character.BattleCharacterId, 3); //make sure dead character does not exist var deadCharacter = orderedList.Find(x => x.character.BattleCharacterId == deadId); Assert.IsNull(deadCharacter); }
private void ApplyDefaultCooldown(List<BattleCharacter> characters) { var service = new TurnOrderService(); foreach (var c in characters) { service.ApplyDefaultCooldownToCharacter(c); } }