public void printZed(Zed character) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Zed:\n\t" + "HP: " + character.HP + "\n\t" + "SCD: " + character.SCD + "\n\t" + "PS: " + character.PS + "\n\t" + "PE: " + character.PE + "\n\t" + "IQ: " + character.IQ + "\n\t" + "ME: " + character.ME + "\n\t" + "MA: " + character.MA + "\n\t" + "PB: " + character.PB + "\n\t" + "SPD: " + character.SPD + "\n\t" + "Strike: " + character.Strike + "\n\t" + "Dodge: " + character.Dodge + "\n\t" + "Parry: " + character.Parry + "\n\t" + "Squares to move: " + character.SquaresToMove + "\n\t" + "Name " + character.Name + "\n\t" + "Is living: " + character.IsLiving + "\n\t" + "Can Dodge: " + character.CanDodge + "\n\t" + "Can Parry: " + character.CanParry + "\n\n\t" + "Zed Class: " + character.ZedClass + "\n\t" + "Base Damage: " + character.BaseDamage + "%\n\t" + "Drop item: " + character.DropItem + "\n\t" + "Money value: " + character.MoneyValue + "\n\t" + "Armor rating: " + character.AR); Console.ResetColor(); }
public void calcMove(Zed zed, int x, int y) { #region move bool moved = false; //Directly Down if (!moved) { try { if (grid[y + 1, x].Token == null) { int[] toMove = { (y + 1), x }; moved = MoveCharacter(zed, toMove); } } catch { } } //Down Left if (!moved) { try { if (grid[y + 1, x - 1].Token == null) { int[] toMove = { (y + 1), (x - 1) }; moved = MoveCharacter(zed, toMove); } } catch { } } //Directly Left if (!moved) { try { if (grid[y, x - 1].Token == null) { int[] toMove = { y, (x - 1) }; moved = MoveCharacter(zed, toMove); } } catch { } } //Above Left if (!moved) { try { if (grid[y - 1, x - 1].Token == null) { int[] toMove = { (y - 1), (x - 1) }; moved = MoveCharacter(zed, toMove); } } catch { } } //Directly Above if (!moved) { try { if (grid[y - 1, x].Token == null) { int[] toMove = { (y - 1), x }; moved = MoveCharacter(zed, toMove); } } catch { } } //Above Right if (!moved) { try { if (grid[y - 1, x + 1].Token == null) { int[] toMove = { (y - 1), (x + 1) }; moved = MoveCharacter(zed, toMove); } } catch { } } //Directly Right if (!moved) { try { if (grid[y, x + 1].Token == null) { int[] toMove = { y, (x + 1) }; moved = MoveCharacter(zed, toMove); } } catch { } } //Down Right if (!moved) { try { if (grid[y + 1, x + 1].Token == null) { int[] toMove = { (y + 1), (x + 1) }; moved = MoveCharacter(zed, toMove); } } catch { } } #endregion if (moved) { Console.WriteLine(zed.ZedClass + " moved"); if (zed is Sloucher) { if (totalSquaresMoved > 1) { } else { Console.WriteLine("Sloucher is attacking"); //if currently allowd squares are > half //{ //initiate attack here //} if (zed.SquaresLeft < (zed.SquaresToMove - 1)) { //Attack } zed.SquaresLeft = zed.SquaresToMove; } } else if (zed is FastAttack) { Console.WriteLine("Fast attack may be able to attack"); //if currently allowd squares are > half //{ //initiate attack here //} if (zed.SquaresLeft < (zed.SquaresToMove / 2)) { //Attack } zed.SquaresLeft = zed.SquaresToMove; } else if (zed is Shank) { Console.WriteLine("Shank may be able to attack"); //if currently allowd squares are > half //{ //initiate attack here //} if (zed.SquaresLeft < (zed.SquaresToMove / 2)) { //Attack } zed.SquaresLeft = zed.SquaresToMove; } else if (zed is Spitter) { Console.WriteLine("Spitter may be able to attack"); //if currently allowd squares are > half //{ //initiate attack here //} if (zed.SquaresLeft < (zed.SquaresToMove / 2)) { //Attack } zed.SquaresLeft = zed.SquaresToMove; } else if (zed is Tank) { Console.WriteLine("Tank may be able to attack"); //if currently allowd squares are > half //{ //initiate attack here //} if (zed.SquaresLeft < (zed.SquaresToMove / 2)) { //Attack } zed.SquaresLeft = zed.SquaresToMove; } totalSquaresMoved = 0; } }
//BRYAN CODE //ZOMBIFY PLACER public void placeZombie(Zed newzed) { if (newzed.ZedClass == ClassZed.Sloucher) { Label l = new Label(); Token = new Sloucher("Sloucher"); l.Width = 40; l.Height = 40; ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri("Images/Sloucher.png", UriKind.Relative)); l.Background = brush; IsOpen = false; this.Children.Add(l); } else if (newzed.ZedClass == ClassZed.Fast_Attack) { Label l = new Label(); Token = new FastAttack("FastAttack"); l.Width = 40; l.Height = 40; ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri("Images/FastAttack.png", UriKind.Relative)); l.Background = brush; IsOpen = false; this.Children.Add(l); } else if (newzed.ZedClass == ClassZed.Tank) { Label l = new Label(); Token = new Tank("Tank"); l.Width = 40; l.Height = 40; ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri("Images/Tank.png", UriKind.Relative)); l.Background = brush; IsOpen = false; this.Children.Add(l); } else if (newzed.ZedClass == ClassZed.Shank) { Label l = new Label(); Token = new Shank("Shank"); l.Width = 40; l.Height = 40; ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri("Images/Shank.png", UriKind.Relative)); l.Background = brush; IsOpen = false; this.Children.Add(l); } else if (newzed.ZedClass == ClassZed.Spitter) { Label l = new Label(); Token = new Spitter("Spitter"); l.Width = 40; l.Height = 40; ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri("Images/Spitter.png", UriKind.Relative)); l.Background = brush; IsOpen = false; this.Children.Add(l); } }
//Call this for Zed move public void calcZedAttack(Zed zed) { for (int i = 0; i < 15; i++) { for (int j = 0; j < 15; j++) { if (grid[i, j].Token == zed) { bool didCombat = false; #region didCombat //Directly Down if (!didCombat) { try { if (grid[i + 1, j].Token is Character) { if (!(grid[i + 1, j].Token is Zed)) { //zombieApocalypse.Combat.CombatManager.startCombat(zed, grid[i + 1, j].c); didCombat = true; } else if (grid[i + 1, j].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } //Down Left if (!didCombat) { try { if (grid[i + 1, j - 1].Token is Character) { if (!(grid[i + 1, j - 1].Token is Zed)) { didCombat = true; } else if (grid[i + 1, j - 1].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } //Directly Left if (!didCombat) { try { if (grid[i, j - 1].Token is Character) { if (!(grid[i, j - 1].Token is Zed)) { didCombat = true; } else if (grid[i, j - 1].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } //Above Left if (!didCombat) { try { if (grid[i - 1, j - 1].Token is Character) { if (!(grid[i - 1, j - 1].Token is Zed)) { didCombat = true; } else if (grid[i - 1, j - 1].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } //Directly Above if (!didCombat) { try { if (grid[i - 1, j].Token is Character) { if (!(grid[i - 1, j].Token is Zed)) { didCombat = true; } else if (grid[i - 1, j].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } //Above Right if (!didCombat) { try { if (grid[i - 1, j + 1].Token is Character) { if (!(grid[i - 1, j + 1].Token is Zed)) { didCombat = true; } else if (grid[i - 1, j + 1].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } //Directly Right if (!didCombat) { try { if (grid[i, j + 1].Token is Character) { if (!(grid[i, j + 1].Token is Zed)) { didCombat = true; } else if (grid[i, j + 1].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } //Down Right if (!didCombat) { try { if (grid[i + 1, j + 1].Token is Character) { if (!(grid[i + 1, j + 1].Token is Zed)) { didCombat = true; } else if (grid[i + 1, j + 1].Token is Zed) { Console.WriteLine("Zed"); } } } catch { } } #endregion #region !didCombat if (!didCombat) { for (int w = 0; w < zed.SquaresToMove; w++) // i { for (int a = 0; a < zed.SquaresToMove; a++) // j { bool foundOne = false; bool foundTwo = false; bool foundThree = false; bool foundFour = false; int found = 0; try { if (grid[i - w, j - a].Token != null && (!(grid[i - w, j - a].Token is Zed))) { foundOne = true; ++found; Console.WriteLine(); Console.WriteLine("Found Someone at [" + (i - w) + ", " + (j - a) + "]"); } } catch { } try { if (grid[i + w, j - a].Token != null && (!(grid[i + w, j - a].Token is Zed))) { foundThree = true; ++found; Console.WriteLine(); Console.WriteLine("Found Someone at [" + (i + w) + ", " + (j - a) + "]"); } } catch { } try { if (grid[i + w, j + a].Token != null && (!(grid[i + w, j + a].Token is Zed))) { foundTwo = true; ++found; Console.WriteLine(); Console.WriteLine("Found Someone at [" + (i + w) + ", " + (j + a) + "]"); } } catch { } try { if (grid[i - w, j + a].Token != null && (!(grid[i - w, j + a].Token is Zed))) { foundFour = true; ++found; Console.WriteLine(); Console.WriteLine("Found Someone at [" + (i - w) + ", " + (j + a) + "]"); } } catch { } if (found > 0) { int x = 0; int y = 0; int spaces = 0; if (foundOne) { //grid[i - w, j - a] y = (i - w); x = (j - a); calcMove(zed, x, y); } else if (foundTwo) { //grid[i + w, j + a] y = (i + w); x = (j + a); calcMove(zed, x, y); } else if (foundThree) { //grid[i + w, j - a] y = (i + w); x = (j - a); calcMove(zed, x, y); } else if (foundFour) { //grid[i - w, j + a] y = (i - w); x = (j + a); calcMove(zed, x, y); } } } } } #endregion } } } }