private static void DealDamage(IThing Target) { if (OnDealDamage != null) { Target = OnDealDamage(Target); } Int32 Armor = 0; if (Extensions.GetInterface(Target, typeof(IDefender))) { Armor = (Target as IDefender).Armor.Int(); } else { Armor = 0; } Int32 Dmg = State.Current.Hero.Attack(Armor); (Target as IAttackable).Chp -= Dmg; IO.DrawerLine Line = new IO.DrawerLine(); Line.DefaultBackgroundColor = ConsoleColor.Black; Line.DefaultForegroundColor = ConsoleColor.DarkGreen; Line += IO.DCLine.New("You", State.Current.Hero.Color, State.Current.Hero.Back); Line += " deal "; Line += IO.DCLine.New(Dmg.ToString(), ConsoleColor.White, ConsoleColor.Black); Line += " damage!"; State.Current.Chat.Message(Line); State.Current.GameField.Activate(State.Current.Hero.Position); }
public static void Yell(DCLine StatName, Int32 _Value, Coord Position, Action IncreaseEffect, DrawerLine DisposeString) { while (true) { IO.DrawerLine line = new IO.DrawerLine(); line.DefaultForegroundColor = ConsoleColor.White; line.DefaultBackgroundColor = ConsoleColor.Red; line += "It's improvement pack! You taked " + State.Current.Hero.ImpPackCurrent + "/" + State.Current.Hero.ImpPackMax + ", take this one? Y/N"; State.Current.Chat.Message(line); switch (Console.ReadKey(true).Key) { case ConsoleKey.Y: { IO.DrawerLine linew = new IO.DrawerLine(); linew.DefaultForegroundColor = ConsoleColor.Cyan; linew.DefaultBackgroundColor = ConsoleColor.DarkRed; linew += DCLine.New("You", State.Current.Hero.Color, State.Current.Hero.Back); linew += " use IPack and inc "; linew += StatName; linew += " on the "; linew += DCLine.New(_Value.ToString(), ConsoleColor.Red, ConsoleColor.Cyan); linew += "!"; State.Current.Chat.Message(linew); if (State.Current.Hero.ImpPackCurrent < State.Current.Hero.ImpPackMax) { State.Current.Hero.ImpPackIncrease(); IncreaseEffect(); } else { DrawerLine newline = new DrawerLine(); newline.DefaultForegroundColor = ConsoleColor.Red; newline.DefaultBackgroundColor = ConsoleColor.White; newline += "Oh no! You cant't take more improvements at this level!"; } State.Current.GameField.Map[Position.X, Position.Y] = new Objects.Mapped.EThing(); State.Current.GameField.Draw(); return; } case ConsoleKey.N: { State.Current.Chat.Message(DisposeString); State.Current.GameField.Map[Position.X, Position.Y] = new Objects.Mapped.EThing(); State.Current.GameField.Draw(); return; } } } }
public void Activate(IThing Target) { (Target as IAttackable).Chp -= this._Dmg; IO.DrawerLine line = new IO.DrawerLine(); line += IO.DCLine.New(Target.Name, Target.Color, Target.Back); line += "get "; line += IO.DCLine.New(this._Dmg.ToString(), ConsoleColor.Red, ConsoleColor.White); line += " damage!"; State.Current.Chat.Message(line); State.Current.GameField.Map[Position.X, Position.Y] = new Objects.Mapped.EThing(); State.Current.GameField.Draw(); }
private static void Educable() { State.Current.Hero.Cexp.OnSet((Int32 Prev) => { if (State.Current.Hero.Cexp.Int() + Prev >= State.Current.Hero.Mexp.Int()) { IO.DrawerLine linew = new IO.DrawerLine(); linew.DefaultForegroundColor = ConsoleColor.Green; linew.DefaultBackgroundColor = ConsoleColor.Yellow; linew += DCLine.New("You", State.Current.Hero.Color, State.Current.Hero.Back); linew += " reach a new level!"; State.Current.Chat.Message(linew); State.Current.Hero.Improve(); return(0); } else { return(Prev); } }); }
public void Action() { IO.DrawerLine linew = new IO.DrawerLine(); linew.DefaultForegroundColor = State.Current.Hero.Color; linew.DefaultBackgroundColor = ConsoleColor.White; linew += IO.DCLine.New("You", State.Current.Hero.Color, State.Current.Hero.Back); linew += "restore ~" + _Sp + " points!"; State.Current.Chat.Message(linew); State.Current.GameField.Map[Position.X, Position.Y] = new Objects.Mapped.EThing(); if (State.Current.Hero.Csp.Int() < State.Current.Hero.Msp.Int()) { if (State.Current.Hero.Csp += _Sp > State.Current.Hero.Msp) { State.Current.Hero.Csp = State.Current.Hero.Msp; } else { State.Current.Hero.Csp += _Sp; } } State.Current.Info.Draw(); State.Current.GameField.Draw(); }
public override void Handle() { while (true) { ISkill Skill = null; switch (Console.ReadKey(true).Key) { case ConsoleKey.NumPad1: case ConsoleKey.D1: Skill = State.Current.Hero.Q; break; case ConsoleKey.NumPad2: case ConsoleKey.D2: Skill = State.Current.Hero.W; break; case ConsoleKey.NumPad3: case ConsoleKey.D3: Skill = State.Current.Hero.E; break; case ConsoleKey.NumPad4: case ConsoleKey.D4: Skill = State.Current.Hero.R; break; } if (Skill != null) { IO.DrawerLine linew = new IO.DrawerLine(); linew.DefaultForegroundColor = ConsoleColor.Cyan; linew.DefaultBackgroundColor = ConsoleColor.DarkRed; linew += DCLine.New("You", State.Current.Hero.Color, State.Current.Hero.Back); linew += " increase "; linew += DCLine.New(Skill.Name, Skill.Color, Skill.Back); linew += " by one point!"; State.Current.Chat.Message(linew); Skill.LevelUp(); break; } } }