remove mine

This commit is contained in:
Vinzenz Schroeter 2024-04-30 11:17:02 +02:00 committed by RobbersDaughter
parent a908979940
commit 061c893456
4 changed files with 7 additions and 10 deletions

View file

@ -26,7 +26,7 @@ internal sealed class CollectPowerUp(
switch (obj.Type) switch (obj.Type)
{ {
case PowerUpType.MagazineTypeUpgrade: case PowerUpType.MagazineType:
if (obj.MagazineType == null) if (obj.MagazineType == null)
throw new UnreachableException(); throw new UnreachableException();
@ -40,7 +40,7 @@ internal sealed class CollectPowerUp(
tank.ReloadingUntil = DateTime.Now; tank.ReloadingUntil = DateTime.Now;
break; break;
case PowerUpType.MagazineSizeUpgrade: case PowerUpType.MagazineSize:
tank.Magazine = tank.Magazine with tank.Magazine = tank.Magazine with
{ {
MaxBullets = (byte)int.Clamp(tank.Magazine.MaxBullets + 1, 1, 32) MaxBullets = (byte)int.Clamp(tank.Magazine.MaxBullets + 1, 1, 32)

View file

@ -19,12 +19,12 @@ internal sealed class SpawnPowerUp(
var type = Random.Shared.Next(4) == 0 var type = Random.Shared.Next(4) == 0
? PowerUpType.MagazineSizeUpgrade ? PowerUpType.MagazineSize
: PowerUpType.MagazineTypeUpgrade; : PowerUpType.MagazineType;
MagazineType? magazineType = type switch MagazineType? magazineType = type switch
{ {
PowerUpType.MagazineTypeUpgrade => Random.Shared.Next(0, 3) switch PowerUpType.MagazineType => Random.Shared.Next(0, 3) switch
{ {
0 => MagazineType.Fast, 0 => MagazineType.Fast,
1 => MagazineType.Explosive, 1 => MagazineType.Explosive,

View file

@ -9,7 +9,6 @@ internal enum MagazineType
Fast = 1 << 0, Fast = 1 << 0,
Explosive = 1 << 1, Explosive = 1 << 1,
Smart = 1 << 2, Smart = 1 << 2,
Mine = 1 << 3,
} }
internal readonly record struct Magazine(MagazineType Type, byte UsedBullets, byte MaxBullets) internal readonly record struct Magazine(MagazineType Type, byte UsedBullets, byte MaxBullets)
@ -26,8 +25,6 @@ internal readonly record struct Magazine(MagazineType Type, byte UsedBullets, by
sb.Append("* "); sb.Append("* ");
if (Type.HasFlag(MagazineType.Smart)) if (Type.HasFlag(MagazineType.Smart))
sb.Append("@ "); sb.Append("@ ");
if (Type.HasFlag(MagazineType.Mine))
sb.Append("\u263c ");
sb.Append("[ "); sb.Append("[ ");
for (var i = 0; i < UsedBullets; i++) for (var i = 0; i < UsedBullets; i++)

View file

@ -4,8 +4,8 @@ namespace TanksServer.Models;
internal enum PowerUpType internal enum PowerUpType
{ {
MagazineTypeUpgrade, MagazineType,
MagazineSizeUpgrade MagazineSize
} }
internal sealed class PowerUp: IMapEntity internal sealed class PowerUp: IMapEntity