public Model(System.Windows.Forms.Panel canvas, int width, int height) { this.canvas = canvas; board = new Field[width, height]; this.Width = width; this.Height = height; Field.adaptSize(Width, Height, canvas); mapgen(); timer.Tick += Timer_Tick; player = new MapObjects.Player(ref board[1, height / 2], 100, this); player.inventory.equipment.Add(new Inventory.Item(100, 20, Inventory.objecttype.SWORD, "magic Sword")); player.inventory.equipment.Add(new Inventory.Item(10, 20, Inventory.objecttype.POTION, "healing potion")); player.inventory.stuff.Add(new Inventory.Item(10, 20, Inventory.objecttype.BOW, "broken bow")); player.inventory.equipment.Add(new Inventory.Item(20, 50, Inventory.objecttype.BOMB, "bomb")); player.inventory.equipment.Add(new Inventory.Item(10, 20, Inventory.objecttype.ARMOR, "rags")); corps = new MapObjects.Stash(ref player.position, player.inventory, "corps"); Field f = determineSpawnPosition(); Field p = determineSpawnPosition(); merchant = new MapObjects.Merchant(ref f, 100, this); //@todo merchant wird nicht gezeichnet monster.Add(new MapObjects.Monster(ref p, 100, this)); interactables.Add(merchant); interactables.Add(player); interactables.AddRange(monster); timer.Interval = 10; timer.Enabled = true; }
public CombatWindow(MapObjects.Player p) { InitializeComponent(); this.m = new Dungeon.Model(this.panel1, 20, 10, p); DrawEnvironment.Field.adaptSize(m.Width, m.Height, this.panel1); lastWindowState = WindowState; }
public static int follow(MapObjects.Player player, MapObjects.Monster monster, DrawEnvironment.Field [,] board) { int direction = -1; //sth dsnt work->invalid direction bool found = false; Ant.setBoard(board); List <Ant> ants = new List <Ant>(); ; if (board[monster.position.posx, monster.position.posy - 1].type == DrawEnvironment.fieldtype.EMPTY) { ants.Add(new Ant(board[monster.position.posx, monster.position.posy], 0, 0, 0)); // Ant nach oben } if (board[monster.position.posx + 1, monster.position.posy].type == DrawEnvironment.fieldtype.EMPTY) { ants.Add(new Ant(board[monster.position.posx, monster.position.posy], 1, 1, 0)); //Ant nach rechts } if (board[monster.position.posx, monster.position.posy + 1].type == DrawEnvironment.fieldtype.EMPTY) { ants.Add(new Ant(board[monster.position.posx, monster.position.posy], 2, 2, 0)); //Ant nach unten } if (board[monster.position.posx - 1, monster.position.posy].type == DrawEnvironment.fieldtype.EMPTY) { ants.Add(new Ant(board[monster.position.posx, monster.position.posy], 3, 3, 0)); //Ant nach links } while (ants.Count != 0) { List <Ant> newAnts = new List <Ant>(); List <Ant> deadAnts = new List <Ant>(); foreach (Ant ant in ants) { if (!ant.alive) { deadAnts.Add(ant); continue; } newAnts.AddRange(ant.crawl()); if (ant.position == player.position) { direction = ant.firstDirection; return(direction); } } foreach (Ant a in deadAnts) { ants.Remove(a); } ants.AddRange(newAnts); } return(direction); }
public TradeWindow(MapObjects.Player player, MapObjects.Interactable interactable) { this.player = player; this.exchangePartner = interactable; InitializeComponent(); ExchangePartnerInventory.setInventory(exchangePartner.inventory); PlayerInventory.setInventory(player.inventory); ExchangePartnerInventory.reload(); PlayerInventory.reload(); }
public ExchangeWindow(MapObjects.Player player, MapObjects.Interactable interactable) { InitializeComponent(); this.player = player; this.exchangePartner = interactable; inventoryManager.Inventory = player.inventory; exchangePartnerList.DataSource = exchangePartner.inventory.stuff; exchangePartnerList.DisplayMember = "Name"; compareTable.Rows.Add(2); compareTable.Rows[0].Cells[0].Value = "Name"; compareTable.Rows[1].Cells[0].Value = "Value"; compareTable.Rows[2].Cells[0].Value = "Actionvalue"; compareTable.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); }
public Model(System.Windows.Forms.Panel canvas, int width, int height, MapObjects.Player p) // @todo really ref?? { Random rnd = new Random(Guid.NewGuid().GetHashCode()); int m = 1; int hp = 80; this.canvas = canvas; this.Width = width; this.Height = height; board = new Field[width, height]; Field.adaptSize(Width, Height, canvas); combatMap(); this.player = new MapObjects.Player(ref board[Width / 2 - 1, Height / 2 - 1], p.hp, this); player.inventory = p.inventory; for (int i = 0; i < m; i++) { monster.Add(new MapObjects.Monster(ref board[rnd.Next(2, width - 3), rnd.Next(2, height - 3)], hp, this)); } interactables.Add(player); interactables.AddRange(monster); }
public static void combat(MapObjects.Monster monster, MapObjects.Player player) { }