public bool Reload(Magazine mag) { if (mag.Caliber == caliber && mag.Capacity <= MagazineCapacity) { this.mag = mag; return true; } return false; }
public void InitNew(string profile_name, uint map_seed) { string path = Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(Game)).CodeBase); path = path.Remove(0, 6); string newPath = System.IO.Path.Combine(path, "profiles", profile_name); Directory.CreateDirectory(newPath); ProfilePath = newPath; InitDB(newPath); rand = new Random(); facman = new FactionManager(); Faction player_faction = new Faction("Player", "The player"); player_faction.Init(facman); //Faction human_faction = new Faction("Humans", "The surviors of their self-made cathastrophe."); Faction test_faction = new Faction("TESTFAC", "TEST FACTION PLEASE IGNORE"); //human_faction.Init(facman); test_faction.Init(facman); //human_faction.AddRelation(test_faction, FactionRelation.Hostile); test_faction.AddRelation(player_faction, FactionRelation.Hostile); root.setBackgroundFlag(TCODBackgroundFlag.Default); player = new Player(1300, 1300, 35, "Player", "A ragged and scruffy-looking individual.", '@', new Body(BODY_DEF_HUMAN), new CharStats(10, 10, 10)); player.Init(TCODColor.yellow, Out, player_faction, new Objects.Action(ActionType.Idle, null, player, 0.0d)); Out.SendMessage("Welcome to [insert game name here]!", Message.MESSAGE_WELCOME); Out.SendMessage("You wake up in a damp and shoddy shack. Or maybe a patch of dirt. Depends on the games' version."); //Default map parameters int[] parameters = new int[7]; parameters[0] = 200; //CellWidth parameters[1] = 200; //CellHeight parameters[2] = 20; //CellDepth parameters[3] = 10; //CellsX parameters[4] = 10; //CellsY parameters[5] = 6; //CellsZ parameters[6] = 45; //GroundLevel wm = new WorldMap(map_seed, dbconn, parameters); map = new Map(player, wm, Out, facman, dbconn, MAIN_HEIGHT - 2, WINDOW_WIDTH - 2); RenderLoadingScreen(); player.SetPosition(player.X, player.Y, map.DropObject(player.X, player.Y, player.Z + 1)); map.AddCreature(player); //testai = new AICreature(1301, 1301, 31, "TEST", "TEST CREATURE PLEASE IGNORE", 'A', new Body(BODY_DEF_HUMAN), new CharStats(10,10,10)); //testai.Init(TCODColor.orange, Out, test_faction, new Objects.Action(ActionType.Idle, null, testai, 0.0d), new WalkerAI(rand.Next(0, 100000000)), map); //testai_guid = testai.GUID; //map.AddCreature(testai); dummy = new Creature(1299, 1299, 31, "TEST", "A Training Dummy.", 'D', new Body(BODY_DEF_HUMAN), new CharStats(10, 10, 10)); dummy.Init(TCODColor.turquoise, Out); map.AddCreature(dummy); List<FireMode> gl_fm = new List<FireMode>(); gl_fm.Add(FireMode.Semi); gl_fm.Add(FireMode.Burst2); testgun = new Firearm(1299, 1301, 31, "Glock 17C", "A semi-automatic pistol manufactured by Austrian Glock Ges. m.b.H. Large parts of it are manufactured from extremely resilient high-strengh polymer and it chambers NATO standard 9x19mm Parabellum rounds. It has a magazine capacity of 17 rounds. The C Variant features slots cut into the barrel and slide compensating for muzzle rise and recoil. It is one of the most commonly used firearms in US law enforcement and enjoys great popularity in the gun community.", 'F', 5.0d, new Caliber(9d, 19d), GunType.Pistol, gl_fm, 17); testgun.Init(TCODColor.grey, Out); testmag = new Magazine(1301, 1299, 31, "9mm Clip", "TEST MAG PLEASE IGNORE.", 'M', 0.75d, 30, 30, new Caliber(5.56d, 45.0d), AmmoModifier.Regular); testmag.Init(TCODColor.brass, Out); Item temp = new Item(1302, 1300, 31, "Apple", "A tasty red apple. Possibly Braeburn.", 'F', 0.3d); temp.Init(TCODColor.red, Out); LightSource p_torch = new LightSource(1300, 1300, 31, 50, 10, "Torch", "A torch.", '!', 1.0d); p_torch.Init(TCODColor.orange, Out); map.AddItem(testgun); map.AddItem(testmag); map.AddItem(temp); map.AddItem(p_torch); //AICreature testai2 = new AICreature(290, 290, 15, "TEST2", "TEST CREATURE PLEASE IGNORE", 'B'); //testai2.Init(TCODColor.orange, Out, test_faction, new Objects.Action(ActionType.Idle, null, testai, 0.0d), new WalkerAI(rand.Next(0, 10000000)), map); //map.AddCreature(testai2); //Item test_item = new Item(1299, 1299, map.DropObject(1299, 1299, 35), "Shimmering rock", "A shining polished rock which seems to change color when you look at it.", (char)'*'); //LightSource test_item = new LightSource(1299, 1299, map.DropObject(1299, 1299, 35), 12, "Shimmering Rock", "A shining polished rock which seems to change color when you look at it.", (char)'*'); //test_item_guid = test_item.GUID; //test_item.Init(TCODColor.red, Out); //test_item.Activate(); //map.AddItem(test_item); LightSource test_item2 = new LightSource(1295, 1310, map.DropObject(1299, 1299, 35), 50, 10, "Shimmering Rock", "A shining polished rock which seems to change color when you look at it.", (char)'*', 1.0d); test_item2.Init(TCODColor.blue, Out); test_item2.Activate(); map.AddItem(test_item2); LightSource test_item3 = new LightSource(1315, 1283, map.DropObject(1299, 1299, 35), 50, 10, "Shimmering Rock", "A shining polished rock which seems to change color when you look at it.", (char)'*', 1.0d); test_item3.Init(TCODColor.green, Out); test_item3.Activate(); map.AddItem(test_item3); LightSource test_item4 = new LightSource(1315, 1319, map.DropObject(1299, 1299, 35), 50, 10, "Shimmering Rock", "A shining polished rock which seems to change color when you look at it.", (char)'*', 1.0d); test_item4.Init(TCODColor.orange, Out); test_item4.Activate(); map.AddItem(test_item4); LightSource test_item5 = new LightSource(1291, 1283, map.DropObject(1299, 1299, 35), 50, 10, "Shimmering Rock", "A shining polished rock which seems to change color when you look at it.", (char)'*', 1.0d); test_item5.Init(TCODColor.red, Out); test_item5.Activate(); map.AddItem(test_item5); LightSource test_item6 = new LightSource(1305, 1300, map.DropObject(1299, 1299, 35), 50, 10, "Shimmering Rock", "A shining polished rock which seems to change color when you look at it.", (char)'*', 1.0d); test_item6.Init(TCODColor.pink, Out); test_item6.Activate(); map.AddItem(test_item6); LightSource test_item7 = new LightSource(1291, 1293, map.DropObject(1299, 1299, 35), 50, 10, "Shimmering Rock", "A shining polished rock which seems to change color when you look at it.", (char)'*', 1.0d); test_item7.Init(TCODColor.violet, Out); test_item7.Activate(); map.AddItem(test_item7); }
public void EquipMagazine(Magazine m) { //if (EquippedWeapon != null) //{ // EquippedWeapon.Reload(m); // _messageHandler.SendMessage(Name + " reloads his " + EquippedWeapon.Name + " with a " + m.Name + "."); //} }