public void Die(Game game) { LOGS.Add(name + " died"); dead = true; DRAW.die(game.rnd, lastHo, lastVe, 6, 2, 500, true, "*"); this.TriggerEvent(Event.death, game, this); DRAW.die(game.rnd, lastHo, lastVe, 6, 2, 500, false, " "); Field at = game.FriendField(this); int rowIndex, charIndex = at.IndexOf(this, out rowIndex); Row row = at.getRow(rowIndex); if (!at.isBlue) { game.pingBoard(new Point(lastHo, lastVe), new Point(52, 36), ConsoleColor.Gray, 10, 500, true, false, false); } else { game.pingBoard(new Point(lastHo, lastVe), new Point(30, 36), ConsoleColor.Gray, 10, 500, true, true, true); } row.removeAt(this); row.RedrawAll(); game.AddToGraveyard(at.isBlue, this); this.currentHealth = this.basePower; this.armorCount = 0; this.buffBonus = 0; }
public bool Damage(int dmg, String from) { LOGS.Add(from + " deal " + dmg + " damage to " + name); if (armorCount > 0 && dmg >= armorCount) { Console.Beep(400, 200); } Console.Beep(1200, 200); DRAW.message(lastHo, lastVe, ("-" + dmg).PadLeft(3, ' '), ConsoleColor.Black, ConsoleColor.Red, 800); if (armorCount >= dmg) { armorCount -= dmg; dmg = 0; } else if (armorCount > 0 && dmg > 0) { dmg -= armorCount; armorCount = 0; } if (buffBonus > 0) { dmg -= buffBonus; buffBonus = 0; } currentHealth -= dmg; if (currentHealth < 0) { currentHealth = 0; } Redraw(); return(currentHealth <= 0); }
public void Strengthlen(int str, Card from) { LOGS.Add(from.name + " strengt " + name + " for +" + str); Console.Beep(400, 100); DRAW.message(lastHo, lastVe, ("+" + str).PadLeft(3, ' '), ConsoleColor.Black, ConsoleColor.White, 800); basePower += str; currentHealth += str; }
public void BoostArmor(int buff, Card from) { LOGS.Add(from.name + " added to " + name + " " + buff + " armor"); Console.Beep(300, 50); DRAW.message(lastHo, lastVe, ("+" + buff).PadLeft(3, ' '), ConsoleColor.Black, ConsoleColor.Yellow, 800); armorCount += buff; Redraw(); }
public void Boost(int buff, String from) { LOGS.Add(from + " boost " + name + " for +" + buff); Console.Beep(1400, 100); DRAW.message(lastHo, lastVe, ("+" + buff).PadLeft(3, ' '), ConsoleColor.Black, ConsoleColor.Green, 800); buffBonus += buff; Redraw(); }
public void ChangeStatus(Ability a) { if (abilities.IndexOf(a) < 0) { abilities.Add(a); } else { abilities.Remove(a); } LOGS.Add(name + "'s " + a.ToString() + " status is now " + (abilities.IndexOf(a) >= 0)); }
public void ApplyHazzardToRow(int rowIndex, Hazard hazzardType) { rows[rowIndex].effect = hazzardType; if (hazzardType == Hazard.None) { LOGS.Add("Cleared all and boons from a row;"); } else { LOGS.Add("Applied a hazzard to row;"); } rows[rowIndex].RedrawAll(); }
public static List <Card> selectFrom(string what, int count, bool exactly, List <Card> from) { LOGS.Add(what); DRAW.PushColor(ConsoleColor.DarkGreen); DRAW.setBuffTo(39 - what.Length / 2, 32); DRAW.str(" " + what + " : "); DRAW.PopColor(); List <Card> res = new List <Card>(); for (int i = 0; i < Math.Min(count, from.Count); i++) { int currentSelected = 0, prevSelected = 0; ConsoleKey k = ConsoleKey.Enter; do { from[prevSelected].RedrawSelected(false); from[currentSelected].RedrawSelected(true); k = Console.ReadKey().Key; prevSelected = currentSelected; if (k == ConsoleKey.DownArrow) { currentSelected++; } if (k == ConsoleKey.UpArrow) { currentSelected--; } currentSelected += from.Count; currentSelected %= from.Count; TraceCardInfo(from[currentSelected]); } while (k != ConsoleKey.Enter); from[currentSelected].RedrawSelected(false); res.Add(from[currentSelected]); from.Remove(from[currentSelected]); } DRAW.setBuffTo(20, 32); DRAW.str("".PadLeft(40)); return(res); }
public Card DrawACard(bool left, filter f) { int time = 0;//400; if (left) { if (leftDeck.Count == 0) { return(null); } int index = -1; for (int i = 0; i < leftDeck.Count; i++) { if (index == -1 && f(leftDeck[i])) { index = i; } } if (index < 0) { return(null); } Card a = leftDeck[index]; leftDeck.RemoveAt(index); DrawCounts(CountPlace.leftDeck); pingBoard(new Point(31, 35), new Point(30, 34), ConsoleColor.Gray, 10, time, true, true, false); leftHand.Add(a); DrawCounts(CountPlace.leftHand); LOGS.Add("Left player draws '" + a.name + "'"); view.Redraw(); return(a); } else { if (rightDeck.Count == 0) { return(null); } int index = -1; for (int i = 0; i < rightDeck.Count; i++) { if (index == -1 && f(rightDeck[i])) { index = i; } } if (index < 0) { return(null); } Card a = rightDeck[index]; rightDeck.RemoveAt(index); DrawCounts(CountPlace.rightDeck); pingBoard(new Point(52, 35), new Point(52, 34), ConsoleColor.Gray, 10, time, true, false, false); rightHand.Add(a); DrawCounts(CountPlace.rightHand); LOGS.Add("Right player draws '" + a.name + "'"); view.Redraw(); return(a); } //Thread.Sleep(time / 5); }
public void SpawnEffect(Game game) { LOGS.Add(name + " spawned"); DRAW.die(game.rnd, lastHo, lastVe, 6, 2, 0, false, " "); DRAW.die(game.rnd, lastHo, lastVe, 6, 2, 400, false, "%"); }