diff --git a/BSR_Client/App.xaml.cs b/BSR_Client/App.xaml.cs index 8e0efed..5349695 100644 --- a/BSR_Client/App.xaml.cs +++ b/BSR_Client/App.xaml.cs @@ -1,16 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; +using System.Windows; namespace BSR_Client { - /// - /// Interaction logic for App.xaml - /// public partial class App : Application { } diff --git a/BSR_Client/Constants.cs b/BSR_Client/Constants.cs index 9e3baf5..82d594d 100644 --- a/BSR_Client/Constants.cs +++ b/BSR_Client/Constants.cs @@ -54,7 +54,7 @@ public enum EItem Adrenaline, Magazine, Gunpowder, - //Bullet, + Bullet, Trashbin, Heroine, Katana, @@ -126,13 +126,34 @@ public partial class MainWindow { EItem.Adrenaline, "Select a player to look at their items and steal one of them to use it immediately\nStealing adrenaline isn't possible" }, { EItem.Magazine, "Generates a new set of bullets" }, { EItem.Gunpowder, "Has a 50/50 chance of dealing 3 damage or exploding in the barrel and dealing 2 to yourself\nCan be combined with a saw to deal 4 damage or 3 to yourself" }, - //{ EItem.Bullet, "Loads a new random bullet type into the gun\nAlways appears at the end of the round" }, + { EItem.Bullet, "Loads a new random bullet type into the gun\nAlways appears at the end of the round" }, { EItem.Trashbin, "Allows you to throw away an item and receive a different one" }, { EItem.Heroine, "Select a player to give them heroine\nThey can't use an item in their next round" }, { EItem.Katana, "Select a player to cut their fingers off\nThey can only use 1 item in their next round" }, { EItem.Count, null }, }; + private Dictionary ItemLimits = new Dictionary() + { + { EItem.Nothing, 0 }, + { EItem.Handcuffs, 2 }, + { EItem.Cigarettes, 3 }, + { EItem.Saw, 2 }, + { EItem.Magnifying, 3 }, + { EItem.Beer, 3 }, + { EItem.Inverter, 2 }, + { EItem.Medicine, 3 }, + { EItem.Phone, 2 }, + { EItem.Adrenaline, 2 }, + { EItem.Magazine, 3 }, + { EItem.Gunpowder, 2 }, + { EItem.Bullet, 0 }, + { EItem.Trashbin, 1 }, + { EItem.Heroine, 1 }, + { EItem.Katana, 1 }, + { EItem.Count, 0 }, + }; + private List ItemStorage = new List(); private class ElementLib diff --git a/BSR_Client/Logic.cs b/BSR_Client/Logic.cs index 814b1c3..e25e5aa 100644 --- a/BSR_Client/Logic.cs +++ b/BSR_Client/Logic.cs @@ -7,7 +7,6 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Collections.Generic; -using System.Xml.Linq; namespace BSR_Client { @@ -64,7 +63,7 @@ public void ShowEndscreen() public void GenerateLives() { - int maxhealth = RNG.Next(5, 16); + int maxhealth = RNG.Next(7, 16); foreach (string player in Players) UpdateLives(player, maxhealth, true, false, true); } @@ -99,7 +98,14 @@ public void GenerateItems(bool remoteGenerate, int remoteCount) int start = (int)EItem.Nothing + 1; if (DebugMode == EDebugMode.GetOwnItems) start = (int)EItem.Magazine; - EItem item = (EItem)RNG.Next(start, (int)EItem.Count); + EItem item; + do + { + item = (EItem)RNG.Next(start, (int)EItem.Count); + if ((item == EItem.Heroine || item == EItem.Katana) && RNG.Next(0, 3) != 0) + item = (EItem)RNG.Next(start, (int)EItem.Count); + } + while (ItemLimits.TryGetValue(item, out int limit) && GetItemCount(item) >= limit); if (!SetItem(item)) continue; msg += "#" + item.ToString(); @@ -122,6 +128,15 @@ public int GetItemCount() return count; } + public int GetItemCount(EItem item) + { + int count = 0; + for (int i = 0; i < Elements.Items.Length; i++) + if (IsItemSlot(Elements.Items[i], item.ToString())) + count++; + return count; + } + public void UpdateLives(string player, int lives, bool set, bool lose, bool sync) { if (set && lose) @@ -158,7 +173,7 @@ public void UpdateLives(string player, int lives, bool set, bool lose, bool sync public void GenerateBullets(bool sync = true) { int randomDecision = RNG.Next(0, 100); - int count = randomDecision > 60 ? RNG.Next(2, 9) : RNG.Next(1, 3) * 2; + int count = randomDecision > 40 ? RNG.Next(2, 9) : RNG.Next(1, 3) * 2; int numblank = 0; switch (count) { @@ -663,10 +678,10 @@ public void PlaySfx(EItem item) Sound.Gunpowder.Position = TimeSpan.Zero; Sound.Gunpowder.Play(); break; - //case EItem.Bullet: - // Sound.Bullet.Position = TimeSpan.Zero; - // Sound.Bullet.Play(); - // break; + case EItem.Bullet: + Sound.Bullet.Position = TimeSpan.Zero; + Sound.Bullet.Play(); + break; case EItem.Trashbin: Sound.Trashbin.Position = TimeSpan.Zero; Sound.Trashbin.Play(); diff --git a/BSR_Client/MainWindow.xaml.cs b/BSR_Client/MainWindow.xaml.cs index 49791c0..c67f4b3 100644 --- a/BSR_Client/MainWindow.xaml.cs +++ b/BSR_Client/MainWindow.xaml.cs @@ -109,6 +109,12 @@ private void Button_Click(object sender, RoutedEventArgs e) Packet.Create(EPacket.StealItem).Add(MyName).Add(ItemCloneTarget).Add(slot).Add(item.ToString()).Send(Sync); Shoot.IsEnabled = true; } + if (BlockItems && CanUseOneItem && item != EItem.Trashbin) + { + LockItems(); + BlockItems = false; + CanUseOneItem = false; + } if (UsedTrashBin) { UsedTrashBin = false; @@ -118,14 +124,9 @@ private void Button_Click(object sender, RoutedEventArgs e) SetItem(newitem, true); Announce("You trashed " + item.ToString() + " and got: " + newitem.ToString()); Packet.Create(EPacket.ItemTrashed).Add(MyName).Add(item.ToString()).Add(newitem.ToString()).Send(Sync); + Shoot.IsEnabled = true; return; } - if (BlockItems && CanUseOneItem) - { - LockItems(); - BlockItems = false; - CanUseOneItem = false; - } PlaySfx(item); switch (item) { @@ -185,12 +186,6 @@ private void Button_Click(object sender, RoutedEventArgs e) Announce(numbers[num] + " Bullet: " + InitialBullets[num].ToString()); break; case EItem.Adrenaline: - //EItem newitem; - //do newitem = (EItem)RNG.Next((int)EItem.Nothing + 1, (int)EItem.Count); - //while (newitem == EItem.Adrenaline); - //SetItem(newitem, true); - //Announce("You got: " + newitem.ToString()); - //Packet.Create(EPacket.ReceiveItems).Add(MyName).Add(1).Add(false).Add(newitem.ToString()).Send(Sync); UsedAdrenaline = true; PreparePlayerItem(); Announce("Select a player to see their items"); @@ -203,14 +198,17 @@ private void Button_Click(object sender, RoutedEventArgs e) case EItem.Gunpowder: NextShotGunpowdered = true; break; - //case EItem.Bullet: - // bool live = RNG.Next(0, 2) == 0; - // Bullets.Add(live ? EBullet.Live : EBullet.Blank); - // Packet.Create(EPacket.ExtraBullet).Add(live).Send(Sync); - // break; + case EItem.Bullet: + bool live = RNG.Next(0, 2) == 0; + Bullets.Add(live ? EBullet.Live : EBullet.Blank); + Packet.Create(EPacket.ExtraBullet).Add(live).Send(Sync); + break; case EItem.Trashbin: if (GetItemCount() > 0) + { + Shoot.IsEnabled = false; UsedTrashBin = true; + } break; case EItem.Heroine: UsedHeroine = true; diff --git a/BSR_Client/Properties/AssemblyInfo.cs b/BSR_Client/Properties/AssemblyInfo.cs index b36e252..aa16e79 100644 --- a/BSR_Client/Properties/AssemblyInfo.cs +++ b/BSR_Client/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.2")] -[assembly: AssemblyFileVersion("1.5.2")] +[assembly: AssemblyVersion("1.5.3")] +[assembly: AssemblyFileVersion("1.5.3")]