public PlayerCharacter(Tile tile, Floor floor, Chixel chixel) : base(tile, floor, chixel) { _instance = this; Faction = Faction.Player; Tile = tile; Health = MaxHealth = 100; Items = new Item[26]; Name = "BE-02 (You!)"; Description = "Covered in 4,000 years of dust, rust, and obsolescence."; Energy = MaxEnergy = 270; EnergyPerMove = DefaultEnergyPerMove; EnergyPerMelee = DefaultEnergyPerMelee; EnergyPerRanged = DefaultEnergyPerRanged; MoneyPerRanged = 0; VisionRadius = DefaultVisionRadius; MeleeDamage = DefaultMeleeAttackDamage; RangedDamage = DefaultRangedAttackDamage; OnRangedAttack += DefaultOnRangedAttack; OnMeleeAttack += DefaultOnMeleeAttack; ToHitBonus = 1; DodgeBonus = 1; EquippedItems = new Item[Enum.GetValues(typeof(EquipSlot)).Length]; }
public Chixel(Chixel other) { this.Glyph = other.Glyph; this.ForegroundColor = other.ForegroundColor; this.BackgroundColor = other.BackgroundColor; this.Dirty = true; }
public Character(Tile tile, Floor floor, Chixel chixel) { this.Floor = floor; this.X = tile.X; this.Y = tile.Y; this.Tile = tile; this.Chixel = chixel; this.Floor.AddCharacter(this); }
public void Draw() { int viewOffsetX = Game.Instance.Map.CurrentFloor.ViewOffsetX; int viewOffsetY = Game.Instance.Map.CurrentFloor.ViewOffsetY; // Draw the reticle //FrameBuffer.Instance.SetChixel(X - 1+viewOffsetX, Y+viewOffsetY, '('); //FrameBuffer.Instance.SetChixel(X + 1+viewOffsetX, Y+viewOffsetY, ')'); Chixel ch = FrameBuffer.Instance.GetChixel(X + viewOffsetX, Y + viewOffsetY); if (ch == null) { return; // out of bounds } ch.BackgroundColor = ConsoleColor.Green; ch.Dirty = true; //Rect r = new Rect(X - 1 + viewOffsetX, Y + viewOffsetY, 3, 1); Rect r = new Rect(X + viewOffsetX, Y + viewOffsetY, 1, 1); RedrawRequests.Rects.Add(r); }
public void DrawFrame() { bool forceDirty = false; if (lastWindowWidth != Console.WindowWidth || lastWindowHeight != Console.WindowHeight) { if (_instance == this) { Console.Clear(); } forceDirty = true; lastWindowWidth = Console.WindowWidth; lastWindowHeight = Console.WindowHeight; } for (int y = 0; y < Height; y++) { if (y < Console.WindowHeight) { for (int x = 0; x < Width; x++) { if (x < Console.WindowWidth) { Chixel ch = this.chixels[x, y]; if (ch != null && (ch.Dirty == true || forceDirty)) { Console.SetCursorPosition(x + Left, y + Top); Console.ForegroundColor = ch.ForegroundColor; Console.BackgroundColor = ch.BackgroundColor; Console.Write(ch.Glyph); ch.Dirty = false; } } } } } }
public void SetChixel(int x, int y, Char c, ConsoleColor fg_color = ConsoleColor.White, ConsoleColor bg_color = ConsoleColor.Black) { x -= Left; y -= Top; // check that the chixel is actually changed // if so, update values and set dirty if (x < 0 || x >= Width || y < 0 || y >= Height) { //throw new Exception(); return; } Chixel ch = this.chixels[x, y]; if (ch != null && ch.Glyph == c && ch.ForegroundColor == fg_color && ch.BackgroundColor == bg_color) { // No change. return; } this.chixels[x, y] = new Chixel(c, fg_color, bg_color); }
static MonsterList() { Monsters = new Dictionary <char, MonsterCharacter>(); char c; c = 'f'; Monsters[c] = new MonsterCharacter(); Monsters[c].Name = "Reptoid Footsoldier"; Monsters[c].Description = "The back-bone of the Reptoid army. Dangerous in large numbers."; Monsters[c].Chixel = new Chixel(c, ConsoleColor.Magenta); Monsters[c].Health = Monsters[c].MaxHealth = 5; Monsters[c].MeleeDamage = 4; c = 'm'; Monsters[c] = new MonsterCharacter(); Monsters[c].Name = "Tuboid Marauder"; Monsters[c].Description = "An extremely deadly and fearsome beast."; Monsters[c].Chixel = new Chixel(c, ConsoleColor.Magenta); Monsters[c].Health = Monsters[c].MaxHealth = 5; Monsters[c].MeleeDamage = 10; c = 'i'; Monsters[c] = new MonsterCharacter(); // TODO: NEEDS TO BE FAST Monsters[c].Name = "Reptoid Infiltrator"; Monsters[c].Description = "Reptoid special forces -- tougher than a footsoldier."; Monsters[c].Chixel = new Chixel(c, ConsoleColor.Magenta); Monsters[c].Health = Monsters[c].MaxHealth = 10; Monsters[c].MeleeDamage = 6; c = 't'; Monsters[c] = new MonsterCharacter(); Monsters[c].Name = "Behemoid Taskmaster"; Monsters[c].Description = "A massive, hulking, melee death machine. Very durable."; Monsters[c].Chixel = new Chixel(c, ConsoleColor.Magenta); Monsters[c].Health = Monsters[c].MaxHealth = 20; Monsters[c].MeleeDamage = 10; Monsters[c].DamageReduction = 2; // RANGED c = 'a'; Monsters[c] = new MonsterCharacter(); // Runs away, fires at long range Monsters[c].Name = "Reptoid Sniper"; Monsters[c].Description = "Likes to employ hit-and-run tactics."; Monsters[c].Chixel = new Chixel(c, ConsoleColor.Magenta); Monsters[c].Health = Monsters[c].MaxHealth = 3; Monsters[c].MeleeDamage = 2; Monsters[c].RangedDamage = 2; Monsters[c].RangedAmmo = 10; Monsters[c].MaximumRange = 10; Monsters[c].TriesToKeepMinimumDistance = 5; c = 's'; Monsters[c] = new MonsterCharacter(); // Toss 1 spear at short range, then charge into melee. Monsters[c].Name = "Behemoid Siegebreaker"; Monsters[c].Description = "Carries a single, massive javelin to toss."; Monsters[c].Chixel = new Chixel(c, ConsoleColor.Magenta); Monsters[c].Health = Monsters[c].MaxHealth = 20; Monsters[c].MeleeDamage = 10; Monsters[c].RangedDamage = 10; Monsters[c].RangedAmmo = 1; Monsters[c].MaximumRange = 5; c = 'r'; Monsters[c] = new MonsterCharacter(); // Medium Range, doesn't run away Monsters[c].Name = "Reptoid Marksman"; Monsters[c].Description = "The primary ranged fighter of the Reptoid military."; Monsters[c].Chixel = new Chixel(c, ConsoleColor.Magenta); Monsters[c].Health = Monsters[c].MaxHealth = 5; Monsters[c].MeleeDamage = 2; Monsters[c].RangedDamage = 2; Monsters[c].RangedAmmo = 5; Monsters[c].MaximumRange = 7; // Corrupted Warbot // Essentiod // Giant "Q" for final boss Dictionary <char, MonsterCharacter> BaseMonsters = new Dictionary <char, MonsterCharacter>(Monsters); foreach (MonsterCharacter baseMonster in BaseMonsters.Values) { // Make an elite version in uppercase? // Make sure no collision with items char newC = baseMonster.Chixel.Glyph.ToString().ToUpper()[0]; MonsterCharacter newM = new MonsterCharacter(baseMonster); newM.Name = "Elite " + newM.Name; newM.Health = newM.MaxHealth = newM.MaxHealth * 2; newM.MeleeDamage *= 2; newM.RangedDamage *= 2; Chixel ch = new Chixel(baseMonster.Chixel); ch.Glyph = newC; ch.ForegroundColor = ConsoleColor.Red; newM.Chixel = ch; Monsters.Add(newC, newM); } }
public void SetChixel(int x, int y, Chixel chixel) { SetChixel(x, y, chixel.Glyph, chixel.ForegroundColor, chixel.BackgroundColor); }
public void Clear() { Console.Clear(); chixels = new Chixel[this.Width, this.Height]; }
public MonsterCharacter(Tile tile, Floor floor, Chixel chixel) : base(tile, floor, chixel) { throw new Exception(); }