public override void UseAbility(AbstractUnit unit) { base.UseAbility(unit); unit.HealFor(1); unit.buffs.Add(new BookaDef(unit)); Thread.Sleep(1000); }
public Move(int much, AbstractUnit host) { this.host = host; if (much == 0) { throw new Exception("f**k no!"); } string whereName = ""; this.much = much; if (much > 0) { whereName = "forward " + much; } else { whereName = "back " + Math.Abs(much); } BaseStats("Move " + whereName, (much > 0) ? new List <int>() { 2, 3, 4 } : new List <int>() { 1, 2, 3 }, new List <int>() { }, 1, true, 100, 0, "Move " + whereName + " in a party."); moveHost = much; }
public override void UseAbility(AbstractUnit units) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\n\nPassed a turn"); Console.ForegroundColor = ConsoleColor.Gray; Console.Beep(120, 500); Thread.Sleep(500); }
public override void UseAbility(AbstractUnit unit) { host.MoveFor = much; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\n\nMoved forward!"); Console.ForegroundColor = ConsoleColor.Gray; Console.Beep(500, 500); Thread.Sleep(500); }
public void BaseStats(string name, string descr, int applyChance, char symbol, int turnsLeft, AbstractUnit target) { enabled = false; this.turnsLeft = turnsLeft; this.name = name; this.descr = descr; this.symbol = symbol; this.target = target; this.applyChance = applyChance; }
public static int Versus(AbstractUnit unit, string tag, int caseSuccess, string param) { int extradamage = 0; if (unit.Is(tag)) { extradamage = caseSuccess; Console.WriteLine(String.Format(" >{0} is {1}. Ability gain +{2}{3}", unit.ToString(), tag, caseSuccess, param)); } return(extradamage); }
public BookaBomb(AbstractUnit host) { this.host = host; BaseStats("Poison bomb", new List <int>() { 3, 4 }, new List <int>() { 3 }, 2, false, 60, 3, "Apply poison for far enemies."); }
public virtual void TryUseAbility(AbstractUnit host, List <AbstractUnit> to) { int nowIn = Console.CursorTop; Console.Beep(100, 50); Random rnd = new Random(); UseAbilityHostEffect(host); host.MoveFor = moveHost; Thread.Sleep(100); Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine(String.Format("Used a '{0}' on a...", skillName)); foreach (AbstractUnit a in to) { int rolled = rnd.Next(100); if (host.Acc + acc > rolled) { if (host.Acc + acc - a.Ddg > rolled) { UseAbility(a); a.MoveFor = moveTarget; } else { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine(String.Format("= = base ACC: {0}%; skill ACC: {1}%; target DDG: {2};", host.Acc, acc, a.Ddg)); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("... " + a.ToString() + " -- DODGE"); for (int i = 0; i < 3; i++) { Console.Beep(rnd.Next(800, 1000), 50); } Thread.Sleep(300); } } else { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine(String.Format("= = base ACC: {0}%; skill ACC: {1}%;", host.Acc, acc)); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("... " + a.ToString() + " -- MISS"); Console.Beep(300, 500); Thread.Sleep(300); } } awaitEndOfAbility(400 * (Console.CursorTop - nowIn)); }
public override void UseAbility(AbstractUnit unit) { base.UseAbility(unit); unit.RecieveDamage(1); Poison p = new Poison(unit, 2, 3, 70); p.TurnOn(80, unit.MOD.ResistBleed); unit.buffs.Add(p); Thread.Sleep(1000); }
bool MoveIn(AbstractUnit a, List <AbstractUnit> where, int much) { if (a as Corpse != null) { a.RecieveDamage(a.getMaxHealth + 1); } int res = Math.Max(1, Math.Min(where.Count, a.position - much)), side = (much > 0) ? 1 : -1; foreach (AbstractUnit b in where) { if (b != a && ((much > 0 && b.position < a.position && b.position >= res) || (much < 0 && b.position > a.position && b.position <= res))) { b.position += side; } } a.position = res; a.MoveFor = 0; return(true); }
public Poison(AbstractUnit who, int turnDamage, int turnLength, int baseApplyChange) { this.turnDamage = turnDamage; BaseStats("Poisoned", String.Format("This unit takes {0} dmg by poisoned each turn.", turnDamage), baseApplyChange, 'p', turnLength, who); }
public static bool TraceFighters(int position, out AbstractUnit unit, List <AbstractUnit> left, List <AbstractUnit> right) { return(TraceFighters(position, out unit, left, right, 0)); }
void PlayerControl(AbstractUnit unit) { unit.TrySelectAbility(left, right); }
public BookaDef(AbstractUnit who) { BaseStats("Wonderfull defence", "Has +50 DEF for 5 turns", 100, 'D', 2, who); }
public virtual void UseAbilityHostEffect(AbstractUnit host) { }
public virtual void UseAbility(AbstractUnit unit) { Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("... " + unit.ToString() + " -- success"); Console.Beep(600, 100); }
public bool Turn() { List <int> idexes = new List <int>(); List <int> speeds = new List <int>(); for (int i = 0; i < left.Count; i++) { if (left[i] as Corpse == null) { idexes.Add(i + 1); speeds.Add(left[i].Spd); } } for (int i = 0; i < right.Count; i++) { if (right[i] as Corpse == null) { idexes.Add(-i - 1); speeds.Add(right[i].Spd); } } idexes = sortBySpd(idexes, speeds); for (int i = 0; i < idexes.Count; i++) { int pos = 0; AbstractUnit a = null; if (idexes[i] > 0) { a = left[idexes[i] - 1]; pos = left[idexes[i] - 1].position; } if (idexes[i] < 0) { a = right[-idexes[i] - 1]; pos = -right[-idexes[i] - 1].position; } Random rnd = new Random(); AbstractUnit unit = null; bool isEnemy = !TraceFighters(pos, out unit, left, right); unit.TickAllBuffs(); if (!unit.isDead() && unit as Corpse == null) { if (!unit.Is("stunned")) { if (isEnemy) { unit.TryRandomlySelectAbility(rnd, right, left); } else { //unit.TryRandomlySelectAbility(rnd, left, right); PlayerControl(unit); } CheckMovement(); } else { unit.Unstun(); } } List <int> deadIndexes = CheckForDeath(); // remove dead characters from a queue for (int j = 0; j < deadIndexes.Count; j++) { idexes.Remove(deadIndexes[j]); for (int k = 0; k < idexes.Count; k++) { if (idexes[k] < deadIndexes[j] && deadIndexes[j] < 0) { idexes[k]++; } if (idexes[k] > deadIndexes[j] && deadIndexes[j] > 0) { idexes[k]--; } } for (int z = 0; z < 5; z++) { Console.Beep(rnd.Next(100, 150), rnd.Next(50, 100)); } AbstractUnit misc; TraceFighters(pos, out misc, left, right); Thread.Sleep(500); // kostil } if (CountNonDead(left) == 0 || CountNonDead(right) == 0) { return(true); } } return(false); }
public static bool TraceFighters(int position, out AbstractUnit unit, List <AbstractUnit> left, List <AbstractUnit> right, int far) { Console.Clear(); bool isAlly = false, isEnemy = false; AbstractUnit a = null, b = null; for (int i = 0; i < left.Count; i++) { isAlly = left[i].position == position; Console.ForegroundColor = ((far >= 0) ? (left[i].position >= position && left[i].position <= position + far) : isAlly) ? ConsoleColor.DarkGreen : ConsoleColor.Gray; Console.SetCursorPosition((4 - left[i].position) * wid, Ystart); Console.Write(left[i].ToString()); Console.SetCursorPosition((4 - left[i].position) * wid, Ystart + 1); Console.Write(left[i].HealthToString(widHP)); Console.SetCursorPosition((4 - left[i].position) * wid, Ystart + 2); Console.Write(left[i].HealthToInt().PadLeft(widHP)); Console.SetCursorPosition((4 - left[i].position) * wid, Ystart + 3); Console.Write(left[i].BuffsToString().PadLeft(widHP)); if (isAlly) { a = left[i]; } } for (int i = 0; i < right.Count; i++) { isEnemy = right[i].position == -position; Console.ForegroundColor = ((far <= 0) ? (right[i].position >= -position && right[i].position <= -position - far) : isEnemy) ? ConsoleColor.DarkRed : ConsoleColor.Gray; Console.SetCursorPosition((4 + right[i].position) * wid, Ystart); Console.Write(right[i].ToString()); Console.SetCursorPosition((4 + right[i].position) * wid, Ystart + 1); Console.Write(right[i].HealthToString(widHP)); Console.SetCursorPosition((4 + right[i].position) * wid, Ystart + 2); Console.Write(right[i].HealthToInt().PadLeft(widHP)); Console.SetCursorPosition((4 + right[i].position) * wid, Ystart + 3); Console.Write(right[i].BuffsToString().PadLeft(widHP)); if (isEnemy) { b = right[i]; } } Console.SetCursorPosition(wid * 9 / 2 - 2, Ystart + 1); Console.ForegroundColor = ConsoleColor.Red; Console.Write("VS"); Console.SetCursorPosition(0, Ystart + 4); Console.ForegroundColor = ConsoleColor.Gray; if (a != null) { unit = a; return(true); } unit = b; return(false); }
public StunResist(AbstractUnit who, int duration) { BaseStats("Stun resist", "Has more resist to stun!", 100, '^', 1, who); }
public override void UseAbility(AbstractUnit unit) { base.UseAbility(unit); unit.RecieveDamage(300); Thread.Sleep(1000); }
public Stun(AbstractUnit who, int duration, int baseApplyChance) { BaseStats("Stunned", "Unit is stunned and will skil it next turn.", baseApplyChance, '*', duration, who); }