Skip to content

Commit

Permalink
version 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrizziDerKek authored Aug 21, 2024
1 parent d4e973b commit 7a15473
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 4 deletions.
11 changes: 11 additions & 0 deletions BSR_Client/BSR_Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@
<Content Include="sounds\bsr_saw.wav" />
<Content Include="sounds\bsr_shot.wav" />
<Content Include="sounds\bsr_title.wav" />
<Resource Include="textures\bullet.png" />
<Resource Include="textures\gunpowder.png" />
<Resource Include="textures\healingbullet.png" />
<Resource Include="textures\heroine.png" />
<Resource Include="textures\joint.png" />
<Resource Include="textures\magazine.png" />
<Resource Include="textures\rotator.png" />
<Resource Include="textures\shield.png" />
<Resource Include="textures\swapper.png" />
<Resource Include="textures\trashbin.png" />
<Resource Include="textures\vacuum.png" />
</ItemGroup>
<ItemGroup>
<Content Include="sounds\bsr_adrenaline.wav" />
Expand Down
10 changes: 9 additions & 1 deletion BSR_Client/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public enum EPacket
BecomeAngry,
ChangeMusic,
Dead,
ExtraBullet,
ItemTrashed,
}

public enum EBullet
Expand All @@ -43,6 +45,10 @@ public enum EItem
Medicine,
Phone,
Adrenaline,
Magazine,
Gunpowder,
Bullet,
Trashbin,
Count,
}

Expand All @@ -62,9 +68,11 @@ public partial class MainWindow
private int InitialBulletCount = 0;
private bool WasPlayingSounds = false;
private bool NextShotSawed = false;
private bool NextShotGunpowdered = false;
private bool CanShootAgain = false;
private bool PacketHandled = false;

private bool UsedTrashBin = false;

private class SoundLib
{
public MediaPlayer Title = new MediaPlayer() { Volume = 0.1 };
Expand Down
10 changes: 10 additions & 0 deletions BSR_Client/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ public void GenerateItems(bool remoteGenerate, int remoteCount)
temp.Send(Sync);
}

public int GetItemCount()
{
Button[] displays = new Button[] { Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8 };
int count = 0;
for (int i = 0; i < displays.Length; i++)
if (!IsItemSlot(displays[i], "Nothing"))
count++;
return count;
}

public void UpdateLives(string player, int lives, bool set, bool lose, bool sync)
{
if (set && lose)
Expand Down
54 changes: 53 additions & 1 deletion BSR_Client/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Windows;
using System.Windows.Controls;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Windows.Shapes;

namespace BSR_Client
{
Expand Down Expand Up @@ -79,6 +81,16 @@ private void Button_Click(object sender, RoutedEventArgs e)
Packet.Create(EPacket.HideBullets).Send(Sync);
ResetBullets();
EItem item = UseItem(action);
if (UsedTrashBin)
{
EItem newitem;
do newitem = (EItem)RNG.Next((int)EItem.Nothing + 1, (int)EItem.Count);
while (newitem == EItem.Trashbin || newitem == item);
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);
return;
}
PlaySfx(item);
switch (item)
{
Expand Down Expand Up @@ -145,6 +157,23 @@ private void Button_Click(object sender, RoutedEventArgs e)
Announce("You got: " + newitem.ToString());
Packet.Create(EPacket.ReceiveItems).Add(MyName).Add(1).Add(false).Add(newitem.ToString()).Send(Sync);
break;
case EItem.Magazine:
Bullets.Clear();
GenerateBullets();
UnlockItems();
break;
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.Trashbin:
if (GetItemCount() > 0)
UsedTrashBin = true;
break;
}
break;
case "Player1":
Expand All @@ -168,7 +197,20 @@ private void Button_Click(object sender, RoutedEventArgs e)
PlaySfx(bullet == EBullet.Live);
if (bullet == EBullet.Live)
{
UpdateLives(target, NextShotSawed ? 2 : 1, false, true, true);
int damage = 1;
if (NextShotSawed)
damage++;
if (NextShotGunpowdered)
{
damage += 2;
if (RNG.Next(0, 2) == 0)
{
damage--;
target = MyName;
you = true;
}
}
UpdateLives(target, damage, false, true, true);
Announce("*Boom* the bullet was a live");
if (you)
{
Expand Down Expand Up @@ -205,6 +247,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
UnlockItems();
}
NextShotSawed = false;
NextShotGunpowdered = false;
break;
}
}
Expand Down Expand Up @@ -322,6 +365,9 @@ public void Receive(string message)
case EItem.Inverter:
Bullets[0] = Bullets[0] == EBullet.Live ? EBullet.Blank : EBullet.Live;
break;
case EItem.Magazine:
Bullets.Clear();
break;
}
}
break;
Expand All @@ -338,6 +384,12 @@ public void Receive(string message)
if (PlayersAlive <= 1)
ShowEndscreen();
break;
case EPacket.ExtraBullet:
Bullets.Add(data.ReadBool(0) ? EBullet.Live : EBullet.Blank);
break;
case EPacket.ItemTrashed:
Announce(data.ReadStr(0) + " trashed " + data.ReadStr(1) + " and got: " + data.ReadStr(2));
break;
}
PacketHandled = 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.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
Binary file added BSR_Client/textures/bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/gunpowder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/healingbullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/heroine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/joint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/magazine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/rotator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/swapper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/trashbin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/vacuum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7a15473

Please sign in to comment.