public void Attack(BattleUnitStack from, List <BattleUnitStack> to) { to.ForEach(stack => { var dealt = from.OnAttack(stack); var inReturn = stack.OnDefense(from, dealt); from.DecreaseHealth(inReturn); }); }
public void UseSpell(BattleUnitStack from, List <BattleUnitStack> to, ISpell spell) { if (!from.GetSpells().Contains(spell)) { throw new ArgumentOutOfRangeException("From stack does not contain provided spell"); } Console.WriteLine($"Using spell {spell}"); to.ForEach(stack => spell.Apply(stack)); }
public int OnDefense(BattleUnitStack from, int received) { //var received = Utils.CalculateDamage(from, this); DecreaseHealth(received); // Calculate damage in return if (Count < 0) { return(0); } return(Utils.CalculateDamage(this, from)); }
public static int CalculateDamage(BattleUnitStack first, BattleUnitStack second) { var random = new Random(); var result = first.Count * random.Next(first.UnitType.Damage.Item1, first.UnitType.Damage.Item2); if (first.Attack > second.Defense) { return((int)Math.Round(result * (1 + 0.05 * (first.Attack - second.Defense)))); } else { return((int)Math.Round(result * (1 + 0.05 * (second.Defense - first.Attack)))); } }
public void Await(BattleUnitStack stack) { if (firstQueue.Count == 0) { throw new Exception("Queue is empty"); } if (!firstQueue.Contains(stack)) { throw new Exception("Stack is not in the queue!"); } if (!firstQueue.Peek().Equals(stack)) { throw new Exception("Stack is not first"); } var toAwait = firstQueue.Dequeue(); awaitQueue.Push(toAwait); }
public int OnAttack(BattleUnitStack to) { return(Utils.CalculateDamage(this, to)); }
public void Await(BattleUnitStack stack) { Queue.Await(stack); }
public void Defense(BattleUnitStack stack) { stack.AddEffect(new Effects.DefenseBuff(stack)); }
public Effect(BattleUnitStack stack) { Stack = stack; }
public PassiveRange(BattleUnitStack stack) : base(stack) { }
public PunishingStrikeBuff(BattleUnitStack stack) : base(stack) { }
public DefenseBuff(BattleUnitStack stack) : base(stack) { }
public void Apply(BattleUnitStack stack) { stack.AddEffect(new Effects.PunishingStrikeBuff(stack)); }