public IEnumerable <Skill> AllAvailableSkills() { if (this.ActiveDebuffs.ContainsKey(Constants.Debuff.Stun)) { yield return(Skill.StunRecovery); yield break; } if (this.TurnCount < this.startupSkillOrder.Count) { SkillInBattle skillToUse = this.skillsToUse.First(s => s.Skill.Id == this.startupSkillOrder[this.TurnCount]); if (skillToUse.CooldownsRemaining > 0) { throw new Exception(string.Format("Startup skills for champion {0} on turn {1} tried to use skill {2} but it is still on cooldown!", this.Champ.Name, this.TurnCount, this.startupSkillOrder[this.TurnCount])); } yield return(skillToUse.Skill); yield break; } else { foreach (SkillInBattle sib in this.skillsToUse) { if (sib.CooldownsRemaining > 0) { continue; } yield return(sib.Skill); } } }
public Skill NextAISkill() { if (this.ActiveDebuffs.ContainsKey(Constants.Debuff.Stun)) { return(Skill.StunRecovery); } SkillInBattle skillToUse = null; if (this.TurnCount < this.startupSkillOrder.Count) { skillToUse = this.skillsToUse.First(s => s.Skill.Id == this.startupSkillOrder[this.TurnCount]); if (skillToUse.CooldownsRemaining > 0) { throw new Exception(string.Format("Startup skills for champion {0} on turn {1} tried to use skill {2} but it is still on cooldown!", this.Champ.Name, this.TurnCount, this.startupSkillOrder[this.TurnCount])); } } if (skillToUse == null) { foreach (SkillInBattle sib in this.skillsToUse) { if (sib.CooldownsRemaining > 0) { continue; } skillToUse = sib; break; } } return(skillToUse.Skill); }
private void TakeTurn(Skill skill, bool isAdditionalAttack) { if (skill.Id != Constants.SkillId.RE) { SkillInBattle skillToUse = this.skillsToUse.FirstOrDefault(sib => sib.Skill == skill); if (skillToUse == null || skillToUse.CooldownsRemaining != 0) { throw new ArgumentException(string.Format("Skill {0} ({1}) is not available!", skill.Id, skill.Name)); } skillToUse.CooldownsRemaining = skillToUse.Skill.Cooldown; } if (!isAdditionalAttack) { foreach (SkillInBattle sib in this.skillsToUse) { if (sib.CooldownsRemaining > 0) { sib.CooldownsRemaining--; } } foreach (Constants.Buff buff in new List <Constants.Buff>(this.ActiveBuffs.Keys)) { this.ActiveBuffs[buff]--; if (this.ActiveBuffs[buff] == 0) { this.ActiveBuffs.Remove(buff); } } foreach (Constants.Debuff debuff in new List <Constants.Debuff>(this.ActiveDebuffs.Keys)) { this.ActiveDebuffs[debuff]--; if (this.ActiveDebuffs[debuff] == 0) { this.ActiveDebuffs.Remove(debuff); } } this.TurnMeter = 0; } this.TurnCount++; }
public SkillInBattle(SkillInBattle other) { this.Skill = other.Skill; this.CooldownsRemaining = other.CooldownsRemaining; }