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:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user