From 733a535d238709066d0edb362fac088f9c553d86 Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Fri, 6 Sep 2024 08:00:32 -0500 Subject: [PATCH 1/4] cleanup: Remove old combos --- .../Players/Combos/Services/GrenadesArmour.cs | 15 --------------- .../Players/Combos/Services/HealthArmour.cs | 16 ---------------- .../Players/Combos/Services/MolotovArmour.cs | 15 --------------- .../Combos/Services/SatchelChargesArmour.cs | 16 ---------------- .../Players/Combos/Services/TearGasHealth.cs | 15 --------------- 5 files changed, 77 deletions(-) delete mode 100644 src/Application/Players/Combos/Services/GrenadesArmour.cs delete mode 100644 src/Application/Players/Combos/Services/HealthArmour.cs delete mode 100644 src/Application/Players/Combos/Services/MolotovArmour.cs delete mode 100644 src/Application/Players/Combos/Services/SatchelChargesArmour.cs delete mode 100644 src/Application/Players/Combos/Services/TearGasHealth.cs diff --git a/src/Application/Players/Combos/Services/GrenadesArmour.cs b/src/Application/Players/Combos/Services/GrenadesArmour.cs deleted file mode 100644 index d6a45a32..00000000 --- a/src/Application/Players/Combos/Services/GrenadesArmour.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace CTF.Application.Players.Combos.Services; - -public class GrenadesArmour : ICombo -{ - public string Name => "2 Grenades and 20 Armour"; - public int RequiredPoints => 25; - - public void Give(Player player) - { - PlayerInfo playerInfo = player.GetInfo(); - player.GiveWeapon(Weapon.Grenade, ammo: 2); - player.AddArmour(20); - playerInfo.StatsPerRound.SubtractPoints(-25); - } -} diff --git a/src/Application/Players/Combos/Services/HealthArmour.cs b/src/Application/Players/Combos/Services/HealthArmour.cs deleted file mode 100644 index dd3b386e..00000000 --- a/src/Application/Players/Combos/Services/HealthArmour.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace CTF.Application.Players.Combos.Services; - -public class HealthArmour : ICombo -{ - public string Name => "100 Health, 100 Armour and FlameThrower"; - public int RequiredPoints => 100; - - public void Give(Player player) - { - PlayerInfo playerInfo = player.GetInfo(); - player.Health = 100; - player.Armour = 100; - player.GiveWeapon(Weapon.FlameThrower, ammo: 500); - playerInfo.StatsPerRound.ResetPoints(); - } -} diff --git a/src/Application/Players/Combos/Services/MolotovArmour.cs b/src/Application/Players/Combos/Services/MolotovArmour.cs deleted file mode 100644 index 87a9b00b..00000000 --- a/src/Application/Players/Combos/Services/MolotovArmour.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace CTF.Application.Players.Combos.Services; - -public class MolotovArmour : ICombo -{ - public string Name => "2 Molotov cocktail and 20 Armour"; - public int RequiredPoints => 25; - - public void Give(Player player) - { - PlayerInfo playerInfo = player.GetInfo(); - player.GiveWeapon(Weapon.Moltov, ammo: 2); - player.AddArmour(20); - playerInfo.StatsPerRound.SubtractPoints(-25); - } -} diff --git a/src/Application/Players/Combos/Services/SatchelChargesArmour.cs b/src/Application/Players/Combos/Services/SatchelChargesArmour.cs deleted file mode 100644 index 4b9897ff..00000000 --- a/src/Application/Players/Combos/Services/SatchelChargesArmour.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace CTF.Application.Players.Combos.Services; - -public class SatchelChargesArmour : ICombo -{ - public string Name => "4 Satchel charges and 30 Armour"; - public int RequiredPoints => 40; - - public void Give(Player player) - { - PlayerInfo playerInfo = player.GetInfo(); - player.GiveWeapon(Weapon.SatchelCharge, ammo: 4); - player.GiveWeapon(Weapon.Detonator, ammo: 1); - player.AddArmour(30); - playerInfo.StatsPerRound.SubtractPoints(-40); - } -} diff --git a/src/Application/Players/Combos/Services/TearGasHealth.cs b/src/Application/Players/Combos/Services/TearGasHealth.cs deleted file mode 100644 index 84aa7898..00000000 --- a/src/Application/Players/Combos/Services/TearGasHealth.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace CTF.Application.Players.Combos.Services; - -public class TearGasHealth : ICombo -{ - public string Name => "20 Tear gas and 30 Health"; - public int RequiredPoints => 20; - - public void Give(Player player) - { - PlayerInfo playerInfo = player.GetInfo(); - player.GiveWeapon(Weapon.Teargas, ammo: 20); - player.AddHealth(30); - playerInfo.StatsPerRound.SubtractPoints(-20); - } -} From ef19e02203a224317644d877c122f7da6a41a0f7 Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Fri, 6 Sep 2024 08:04:58 -0500 Subject: [PATCH 2/4] feat!: Add new combos that improve the player's health and armour --- .../Combos/ServiceCollectionExtensions.cs | 10 +++++----- .../Combos/Services/FlamethrowerVitality.cs | 16 ++++++++++++++++ .../Players/Combos/Services/GrenadesVitality.cs | 16 ++++++++++++++++ .../Players/Combos/Services/MolotovVitality.cs | 16 ++++++++++++++++ .../Combos/Services/SatchelChargesVitality.cs | 17 +++++++++++++++++ .../Players/Combos/Services/TearGasVitality.cs | 16 ++++++++++++++++ 6 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 src/Application/Players/Combos/Services/FlamethrowerVitality.cs create mode 100644 src/Application/Players/Combos/Services/GrenadesVitality.cs create mode 100644 src/Application/Players/Combos/Services/MolotovVitality.cs create mode 100644 src/Application/Players/Combos/Services/SatchelChargesVitality.cs create mode 100644 src/Application/Players/Combos/Services/TearGasVitality.cs diff --git a/src/Application/Players/Combos/ServiceCollectionExtensions.cs b/src/Application/Players/Combos/ServiceCollectionExtensions.cs index 49abfa6f..197b607e 100644 --- a/src/Application/Players/Combos/ServiceCollectionExtensions.cs +++ b/src/Application/Players/Combos/ServiceCollectionExtensions.cs @@ -5,11 +5,11 @@ public static class ComboServicesExtensions public static IServiceCollection AddComboServices(this IServiceCollection services) { services - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton(); + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton(); return services; } diff --git a/src/Application/Players/Combos/Services/FlamethrowerVitality.cs b/src/Application/Players/Combos/Services/FlamethrowerVitality.cs new file mode 100644 index 00000000..b38287ff --- /dev/null +++ b/src/Application/Players/Combos/Services/FlamethrowerVitality.cs @@ -0,0 +1,16 @@ +namespace CTF.Application.Players.Combos.Services; + +public class FlamethrowerVitality : ICombo +{ + public string Name => "100 Health, 100 Armour and FlameThrower"; + public int RequiredPoints => 100; + + public void Give(Player player) + { + PlayerInfo playerInfo = player.GetInfo(); + player.Health = 100; + player.Armour = 100; + player.GiveWeapon(Weapon.FlameThrower, ammo: 500); + playerInfo.StatsPerRound.ResetPoints(); + } +} diff --git a/src/Application/Players/Combos/Services/GrenadesVitality.cs b/src/Application/Players/Combos/Services/GrenadesVitality.cs new file mode 100644 index 00000000..d26cc8fc --- /dev/null +++ b/src/Application/Players/Combos/Services/GrenadesVitality.cs @@ -0,0 +1,16 @@ +namespace CTF.Application.Players.Combos.Services; + +public class GrenadesVitality : ICombo +{ + public string Name => "100 Health, 100 Armour and 25 Grenades"; + public int RequiredPoints => 100; + + public void Give(Player player) + { + PlayerInfo playerInfo = player.GetInfo(); + player.Health = 100; + player.Armour = 100; + player.GiveWeapon(Weapon.Grenade, ammo: 25); + playerInfo.StatsPerRound.ResetPoints(); + } +} diff --git a/src/Application/Players/Combos/Services/MolotovVitality.cs b/src/Application/Players/Combos/Services/MolotovVitality.cs new file mode 100644 index 00000000..0f547a43 --- /dev/null +++ b/src/Application/Players/Combos/Services/MolotovVitality.cs @@ -0,0 +1,16 @@ +namespace CTF.Application.Players.Combos.Services; + +public class MolotovVitality : ICombo +{ + public string Name => "100 Health, 100 Armour and 25 Molotov cocktail"; + public int RequiredPoints => 100; + + public void Give(Player player) + { + PlayerInfo playerInfo = player.GetInfo(); + player.Health = 100; + player.Armour = 100; + player.GiveWeapon(Weapon.Moltov, ammo: 25); + playerInfo.StatsPerRound.ResetPoints(); + } +} diff --git a/src/Application/Players/Combos/Services/SatchelChargesVitality.cs b/src/Application/Players/Combos/Services/SatchelChargesVitality.cs new file mode 100644 index 00000000..2f8c57e2 --- /dev/null +++ b/src/Application/Players/Combos/Services/SatchelChargesVitality.cs @@ -0,0 +1,17 @@ +namespace CTF.Application.Players.Combos.Services; + +public class SatchelChargesVitality : ICombo +{ + public string Name => "100 Health, 100 Armour and 25 Satchel charges"; + public int RequiredPoints => 100; + + public void Give(Player player) + { + PlayerInfo playerInfo = player.GetInfo(); + player.Health = 100; + player.Armour = 100; + player.GiveWeapon(Weapon.SatchelCharge, ammo: 25); + player.GiveWeapon(Weapon.Detonator, ammo: 1); + playerInfo.StatsPerRound.ResetPoints(); + } +} diff --git a/src/Application/Players/Combos/Services/TearGasVitality.cs b/src/Application/Players/Combos/Services/TearGasVitality.cs new file mode 100644 index 00000000..79fbc231 --- /dev/null +++ b/src/Application/Players/Combos/Services/TearGasVitality.cs @@ -0,0 +1,16 @@ +namespace CTF.Application.Players.Combos.Services; + +public class TearGasVitality : ICombo +{ + public string Name => "100 Health, 100 Armour and 50 Tear gas"; + public int RequiredPoints => 100; + + public void Give(Player player) + { + PlayerInfo playerInfo = player.GetInfo(); + player.Health = 100; + player.Armour = 100; + player.GiveWeapon(Weapon.Teargas, ammo: 50); + playerInfo.StatsPerRound.ResetPoints(); + } +} From 67306338922b85c84d3394ceb1fa281ea5654191 Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Fri, 6 Sep 2024 08:13:56 -0500 Subject: [PATCH 3/4] docs: Add comments to ICombo interface --- src/Application/Players/Combos/ICombo.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Application/Players/Combos/ICombo.cs b/src/Application/Players/Combos/ICombo.cs index 08d65cd2..e5060896 100644 --- a/src/Application/Players/Combos/ICombo.cs +++ b/src/Application/Players/Combos/ICombo.cs @@ -6,7 +6,18 @@ /// public interface ICombo { + /// + /// Gets the name of a combo, e.g., 100 Health and 100 Armour. + /// string Name { get; } + + /// + /// Gets the required points that a player must have to acquire the combo. + /// int RequiredPoints { get; } + + /// + /// Assigns a combo to a player, e.g., 100 Health and 100 Armour. + /// void Give(Player player); } From 022e66fcc8a56a978264ffbd34a5ee9a7224d466 Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Fri, 6 Sep 2024 08:20:41 -0500 Subject: [PATCH 4/4] refactor: Hide combo dialog when combo is acquired --- src/Application/Players/Combos/ComboSystem.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Application/Players/Combos/ComboSystem.cs b/src/Application/Players/Combos/ComboSystem.cs index e7ab1496..de365442 100644 --- a/src/Application/Players/Combos/ComboSystem.cs +++ b/src/Application/Players/Combos/ComboSystem.cs @@ -54,6 +54,5 @@ public async void ShowCombos(Player player) }); _worldService.SendClientMessage(Color.Yellow, message); selectedCombo.Give(player); - ShowCombos(player); } }