public void Go(string direction) { string from = _game.CurrentRoom.Name; IRoom room = _game.CurrentRoom; if (room is ThroneRoom) { if (_game.CurrentRoom.Move(direction) == _game.CurrentRoom) { ThroneRoom thisRoom = (ThroneRoom)room; Messages.Add(thisRoom.TakeThrone(_game.CurrentPlayer.Name)); } else { Messages.Add($@" The guards storm in and immediately see you are an imposter! They knock you out... You come to your senses back in the unknown room... once again in a pile of your own vomit"); Reset(); } return; } _game.CurrentRoom = _game.CurrentRoom.Move(direction); string to = _game.CurrentRoom.Name; if (from == to) { Messages.Add("Area not available currently"); return; } Messages.Add($"Traveled to {to} from {from}"); Look(); }
private ThroneRoom FindTargetTreasury() { ThroneRoom best = null; if (Player.inst.DoesAnyBuildingHaveUniqueNameOnLandMass("throneroom", Host.landMass)) { ArrayExt <Building> throneRooms = Player.inst.GetBuildingListForLandMass(Host.landMass, "throneroom".GetHashCode()); best = throneRooms.RandomElement().GetComponent <ThroneRoom>(); } return(best); }
protected override void DoCrime() { base.DoCrime(); if (FindTargetTreasury() != null) { target = FindTargetTreasury(); } if (target) { Host.MoveTo(target.transform.position); } }
///<summary> ///No need to Pass a room since Items can only be used in the CurrentRoom ///Make sure you validate the item is in the room or player inventory before ///being able to use the item ///</summary> public void UseItem(string itemName) { //Found IItem //if item from inventory //else if not try from room list //if still not cant use //return //RoomItemUse //GlobalItemUse IRoom room = _game.CurrentRoom; if (room is TrapRoom) { // IItem found = _game.CurrentPlayer.Inventory.Find(itemName); // var itemm = _game.CurrentPlayer.Inventory.IndexOf(itemName as Item); for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++) { var item = _game.CurrentPlayer.Inventory[i]; if (item.Name.ToLower() == itemName) { TrapRoom trap = (TrapRoom)room; trap.UseItem(item); Messages.Add(trap.UseItem(item)); // _game.CurrentPlayer.Inventory.Remove(item); Messages.Add($"Used your {item.Name}"); return; } } { Messages.Add("Invalid Item"); } } else if (room is SafeTrapRoom) { for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++) { var item = _game.CurrentPlayer.Inventory[i]; if (item.Name.ToLower() == itemName) { SafeTrapRoom trap = (SafeTrapRoom)room; Messages.Add(trap.UseItem(item)); // _game.CurrentPlayer.Inventory.Remove(item); Messages.Add($"Used your {item.Name}"); return; } } { Messages.Add("Invalid Item"); } } else if (room is ThroneRoom) { for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++) { var item = _game.CurrentPlayer.Inventory[i]; if (item.Name.ToLower() == itemName) { ThroneRoom winningRoom = (ThroneRoom)room; Messages.Add(winningRoom.UseItem(item)); return; } } { Messages.Add("Invalid Item"); } } else { for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++) { var item = _game.CurrentPlayer.Inventory[i]; if (item.Name.ToLower() == itemName) { Messages.Add($"Used your {item.Name} but it has little effect here."); return; } } { Messages.Add("Invalid Item"); } } }
// BASE static PresetGames() { games.Add(Games.AllCards1stEdition, new List <Card> { Adventurer.Get(), Bureaucrat.Get(), Cellar.Get(), CouncilRoom.Get(), Feast.Get(), Festival.Get(), Gardens.Get(), Chancellor.Get(), Chapel.Get(), Laboratory.Get(), Library.Get(), Market.Get(), Militia.Get(), Mine.Get(), Moat.Get(), Moneylender.Get(), Remodel.Get(), Smithy.Get(), Spy.Get(), Thief.Get(), ThroneRoom.Get(), Village.Get(), Witch.Get(), Woodcutter.Get(), Workshop.Get(), }); games.Add(Games.FirstGame, new List <Card> { Cellar.Get(), Moat.Get(), Village.Get(), Woodcutter.Get(), Workshop.Get(), Militia.Get(), Remodel.Get(), Smithy.Get(), Market.Get(), Mine.Get(), }); games.Add(Games.BigMoney, new List <Card> { Adventurer.Get(), Bureaucrat.Get(), Chancellor.Get(), Chapel.Get(), Feast.Get(), Laboratory.Get(), Market.Get(), Mine.Get(), Moneylender.Get(), ThroneRoom.Get(), }); games.Add(Games.Interaction, new List <Card> { Bureaucrat.Get(), Chancellor.Get(), CouncilRoom.Get(), Festival.Get(), Library.Get(), Militia.Get(), Moat.Get(), Spy.Get(), Thief.Get(), Village.Get() }); games.Add(Games.SizeDistortion, new List <Card> { Cellar.Get(), Chapel.Get(), Feast.Get(), Gardens.Get(), Laboratory.Get(), Thief.Get(), Village.Get(), Witch.Get(), Woodcutter.Get(), Workshop.Get(), }); games.Add(Games.VillageSquare, new List <Card> { Bureaucrat.Get(), Cellar.Get(), Festival.Get(), Library.Get(), Market.Get(), Remodel.Get(), Smithy.Get(), ThroneRoom.Get(), Village.Get(), Woodcutter.Get(), }); games.Add(Games.ThrashHeap, new List <Card> { Chapel.Get(), Village.Get(), Workshop.Get(), Woodcutter.Get(), Feast.Get(), Moneylender.Get(), Remodel.Get(), Mine.Get(), Festival.Get(), Market.Get(), }); }
/// <summary> /// Creates a new card based on how many cards have already been made. /// </summary> /// <param name="card"> /// The name of the card to be created. /// </param> /// <returns> /// The new created card. /// </returns> public static Card CreateCard(CardName card) { Contract.Requires(card != CardName.Backside & card != CardName.Empty); Contract.Ensures(Contract.Result<Card>().Name == card); Card c; switch (card) { case CardName.Copper: c = new Copper(); break; case CardName.Silver: c = new Silver(); break; case CardName.Gold: c = new Gold(); break; case CardName.Curse: c = new Curse(); break; case CardName.Estate: c = new Estate(); break; case CardName.Duchy: c = new Duchy(); break; case CardName.Province: c = new Province(); break; case CardName.Gardens: c = new Gardens(); break; case CardName.Cellar: c = new Cellar(); break; case CardName.Chapel: c = new Chapel(); break; case CardName.Chancellor: c = new Chancellor(); break; case CardName.Village: c = new Village(); break; case CardName.Woodcutter: c = new Woodcutter(); break; case CardName.Workshop: c = new Workshop(); break; case CardName.Feast: c = new Feast(); break; case CardName.Moneylender: c = new Moneylender(); break; case CardName.Remodel: c = new Remodel(); break; case CardName.Smithy: c = new Smithy(); break; case CardName.ThroneRoom: c = new ThroneRoom(); break; case CardName.CouncilRoom: c = new CouncilRoom(); break; case CardName.Festival: c = new Festival(); break; case CardName.Laboratory: c = new Laboratory(); break; case CardName.Library: c = new Library(); break; case CardName.Market: c = new Market(); break; case CardName.Mine: c = new Mine(); break; case CardName.Adventurer: c = new Adventurer(); break; case CardName.Bureaucrat: c = new Bureaucrat(); break; case CardName.Militia: c = new Militia(); break; case CardName.Spy: c = new Spy(); break; case CardName.Thief: c = new Thief(); break; case CardName.Witch: c = new Witch(); break; case CardName.Moat: c = new Moat(); break; default: throw new NotImplementedException("Tried to create a card that was not implemented when CardFactory was last updated."); } c.Initialize(card, CardsMade[card]); CardsMade[card] += 1; createdCards.Add(c, true); return c; }
// Create a list of every Area object public void InitializeAreas() { //Overworld Areas Area dismalSwamp = new DismalSwamp(this); areaList.Add(dismalSwamp); Area edgeOfBigHole = new EdgeOfBigHole(this); areaList.Add(edgeOfBigHole); Area forest = new Forest(this); areaList.Add(forest); Area hiddenGrove = new HiddenGrove(this); areaList.Add(hiddenGrove); Area lakeShore = new LakeShore(this); areaList.Add(lakeShore); Area ledge = new Ledge(this); areaList.Add(ledge); Area quicksand = new Quicksand(this); areaList.Add(quicksand); Area stump = new Stump(this); areaList.Add(stump); Area sunnyMeadow = new SunnyMeadow(this); areaList.Add(sunnyMeadow); Area topOfCypress = new TopOfCypress(this); areaList.Add(topOfCypress); Area topOfOak = new TopOfOak(this); areaList.Add(topOfOak); //Underworld Areas Area bottomOfChasm = new BottomOfChasm(this); areaList.Add(bottomOfChasm); Area largeCavern = new LargeCavern(this); areaList.Add(largeCavern); Area largeEightSidedRoom = new LargeEightSidedRoom(this); areaList.Add(largeEightSidedRoom); Area darkness = new Darkness(this); areaList.Add(darkness); Area longDownslopingHallway = new LongDownslopingHallway(this); areaList.Add(longDownslopingHallway); Area longTunnel = new LongTunnel(this); areaList.Add(longTunnel); Area memoryChip = new MemoryChip(this); areaList.Add(memoryChip); Area narrowLedgeByChasm = new NarrowLedgeByChasm(this); areaList.Add(narrowLedgeByChasm); Area narrowLedgeByThroneRoom = new NarrowLedgeByThroneRoom(this); areaList.Add(narrowLedgeByThroneRoom); Area rootChamber = new RootChamber(this); areaList.Add(rootChamber); Area royalAnteroom = new RoyalAnteroom(this); areaList.Add(royalAnteroom); Area royalChamber = new RoyalChamber(this); areaList.Add(royalChamber); Area semiDarkHole = new SemiDarkHole(this); areaList.Add(semiDarkHole); Area throneRoom = new ThroneRoom(this); areaList.Add(throneRoom); //Purgatory areas Area endlessCorridor = new EndlessCorridor(this); areaList.Add(endlessCorridor); Area hell = new Hell(this); areaList.Add(hell); Area largeMistyRoom = new LargeMistyRoom(this); areaList.Add(largeMistyRoom); //Maze areas Area eastOne = new EastOne(this); areaList.Add(eastOne); Area eastTwo = new EastTwo(this); areaList.Add(eastTwo); Area entrance = new Entrance(this); areaList.Add(entrance); Area northEastOne = new NorthEastOne(this); areaList.Add(northEastOne); Area northEastTwo = new NorthEastTwo(this); areaList.Add(northEastTwo); Area northOne = new NorthOne(this); areaList.Add(northOne); Area northTwo = new NorthTwo(this); areaList.Add(northTwo); Area northWestOne = new NorthWestOne(this); areaList.Add(northWestOne); Area northWestTwo = new NorthWestTwo(this); areaList.Add(northWestTwo); Area southEastOne = new SouthEastOne(this); areaList.Add(southEastOne); Area southEastTwo = new SouthEastTwo(this); areaList.Add(southEastTwo); Area southOne = new SouthOne(this); areaList.Add(southOne); Area southTwo = new SouthTwo(this); areaList.Add(southTwo); Area southWestOne = new SouthWestOne(this); areaList.Add(southWestOne); Area southWestTwo = new SouthWestTwo(this); areaList.Add(southWestTwo); Area westOne = new WestOne(this); areaList.Add(westOne); Area westTwo = new WestTwo(this); areaList.Add(westTwo); }
//NOTE Make yo rooms here... public void Setup() { IRoom start = new Room("An Unknown Room", "You come to your senses in a pile of your own vomit."); IRoom two = new Room("Outside", "To your north you hear a loud ruckus but to your west you see somebody disappear down a sewage lid."); IRoom three = new TrapRoom("Pub", "The bar is very crowded but there is an open spot off to the side"); IRoom four = new TrapRoom("Hidden Tunnel", "There is ancient markings on the walls of this poorly lit corridor the only way to advance is north."); IRoom five = new Room("Courtyard", "You see large arch doors to your north but a smaller normal door to your west."); IRoom six = new TrapRoom("Jailor", "You walk into the room to see a group of guards sitting around a table looking up at you."); IRoom seven = new SafeTrapRoom("Dark Hallway", $@" You enter the arch doors to a long dark hallway. Do you dare go north?"); IRoom eight = new ThroneRoom("Throne Room", "There is the Iron Throne with nobody to claim it... Do you dare sit in the throne"); IRoom nine = new TrapRoom("Kings Room", "The King is sleeping with his Crown tucked under his arms.... "); start.AddRoomConnection(two, "west"); two.AddRoomConnection(start, "east"); two.AddRoomConnection(three, "north"); three.AddRoomConnection(two, "south"); two.AddRoomConnection(four, "west"); four.AddRoomConnection(two, "east"); four.AddRoomConnection(five, "north"); five.AddRoomConnection(four, "south"); five.AddRoomConnection(six, "west"); six.AddRoomConnection(five, "east"); five.AddRoomConnection(seven, "north"); seven.AddRoomConnection(five, "south"); seven.AddRoomConnection(eight, "north"); eight.AddRoomConnection(seven, "south"); nine.AddRoomConnection(seven, "east"); seven.AddRoomConnection(nine, "west"); eight.AddRoomConnection(start, "secret"); Item sword = new Item("Sword", "Big long sword"); Item drink = new Item("Ale", "Biggest container of beer you've ever seen."); Item torch = new Item("Torch", "Used to light even the darkest of places."); Item crown = new Item("Crown", "Fit for a king"); Item test = new Item("Key", "This must open something important"); start.Items.Add(sword); three.Items.Add(drink); four.Items.Add(torch); nine.Items.Add(crown); seven.Items.Add(test); (seven as SafeTrapRoom).addUnlockable(test); (four as TrapRoom).addUnlockable(torch); (six as TrapRoom).addUnlockable(sword); (three as TrapRoom).addUnlockable(drink); (eight as ThroneRoom).addUnlockable(crown); CurrentRoom = start; }