Skip to content

Commit

Permalink
version 1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrizziDerKek committed Aug 29, 2024
1 parent 29c187f commit 7c7a978
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 39 deletions.
11 changes: 1 addition & 10 deletions BSR_Client/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
Expand Down
25 changes: 23 additions & 2 deletions BSR_Client/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum EItem
Adrenaline,
Magazine,
Gunpowder,
//Bullet,
Bullet,
Trashbin,
Heroine,
Katana,
Expand Down Expand Up @@ -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<EItem, int> ItemLimits = new Dictionary<EItem, int>()
{
{ 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<EItem> ItemStorage = new List<EItem>();

private class ElementLib
Expand Down
31 changes: 23 additions & 8 deletions BSR_Client/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Collections.Generic;
using System.Xml.Linq;

namespace BSR_Client
{
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand All @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();
Expand Down
32 changes: 15 additions & 17 deletions BSR_Client/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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");
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions BSR_Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit 7c7a978

Please sign in to comment.