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)
{
case PowerUpType.MagazineTypeUpgrade:
case PowerUpType.MagazineType:
if (obj.MagazineType == null)
throw new UnreachableException();
@ -40,7 +40,7 @@ internal sealed class CollectPowerUp(
tank.ReloadingUntil = DateTime.Now;
break;
case PowerUpType.MagazineSizeUpgrade:
case PowerUpType.MagazineSize:
tank.Magazine = tank.Magazine with
{
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
? PowerUpType.MagazineSizeUpgrade
: PowerUpType.MagazineTypeUpgrade;
? PowerUpType.MagazineSize
: PowerUpType.MagazineType;
MagazineType? magazineType = type switch
{
PowerUpType.MagazineTypeUpgrade => Random.Shared.Next(0, 3) switch
PowerUpType.MagazineType => Random.Shared.Next(0, 3) switch
{
0 => MagazineType.Fast,
1 => MagazineType.Explosive,

View file

@ -9,7 +9,6 @@ internal enum MagazineType
Fast = 1 << 0,
Explosive = 1 << 1,
Smart = 1 << 2,
Mine = 1 << 3,
}
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("* ");
if (Type.HasFlag(MagazineType.Smart))
sb.Append("@ ");
if (Type.HasFlag(MagazineType.Mine))
sb.Append("\u263c ");
sb.Append("[ ");
for (var i = 0; i < UsedBullets; i++)

View file

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