Add BackupKit and mid-game kit selection

Introduce a BackupKit and allow players holding it to change kits mid-game while preventing normal kits from being picked once the game started. Changes:
- Add BackupKit implementation (kit with no abilities/items used for mid-round kit selection).
- Update KitCommand: import BackupKit and GameState, add isIngame helper, disallow normal kit picks during INGAME/INVINCIBILITY, permit BackupKit to swap kits mid-game (but prevent picking the same kit) and apply playstyles accordingly.
- Fix GoblinKit to also copy/restore the target's playstyle when stealing a kit and restore the player's original playstyle after timeout.
- Tweak IceMageKit slow effect chance (now ~1/3 chance using random.nextInt(3) < 1).
- Update en_US.yml: add messages and kit strings for backup and icemage, adjust ability_charged color, and add game/cannot-pick messages.

Also includes small import and formatting adjustments.
This commit is contained in:
TDSTOS
2026-03-25 17:47:42 +01:00
parent ea86272c01
commit e199ae24d4
5 changed files with 157 additions and 6 deletions

View File

@@ -1,7 +1,9 @@
package club.mcscrims.speedhg.command
import club.mcscrims.speedhg.SpeedHG
import club.mcscrims.speedhg.game.GameState
import club.mcscrims.speedhg.kit.Playstyle
import club.mcscrims.speedhg.kit.impl.BackupKit
import club.mcscrims.speedhg.util.legacySerializer
import club.mcscrims.speedhg.util.sendMsg
import org.bukkit.command.Command
@@ -52,6 +54,30 @@ class KitCommand : CommandExecutor, TabCompleter {
return true
}
val playerKit = plugin.kitManager.getSelectedKit( player )
val isBackup = playerKit != null && playerKit is BackupKit
if ( !isBackup && isIngame() )
{
player.sendMsg("commands.kit.gameHasStarted")
return true
}
else if ( isBackup && isIngame() )
{
if ( kit is BackupKit )
{
player.sendMsg( "commands.kit.cannotPickSameKit" )
return true
}
plugin.kitManager.selectKit( player, kit )
plugin.kitManager.selectPlaystyle( player, playstyle )
plugin.kitManager.applyKit( player )
player.sendMsg( "commands.kit.selected", "playstyle" to playstyle.displayName, "kit" to legacySerializer.serialize( kit.displayName ))
return true
}
plugin.kitManager.selectKit( player, kit )
plugin.kitManager.selectPlaystyle( player, playstyle )
@@ -78,4 +104,10 @@ class KitCommand : CommandExecutor, TabCompleter {
return listOf()
}
private fun isIngame(): Boolean = when ( plugin.gameManager.currentState )
{
GameState.INGAME, GameState.INVINCIBILITY -> true
else -> false
}
}