require(msg.sender == currentKing, "Game: You are already the king. No need to re-claim.");
require(msg.sender != currentKing, "Game: You are already the king. No need to re-claim.");
function test_VulnerabilityLogicError_BlocksAllOtherPlayers() public {
vm.prank(player1);
game.claimThrone{value: INITIAL_CLAIM_FEE}();
assertEq(game.currentKing(), player1);
console2.log("Player1 is now the king:", game.currentKing());
uint256 newClaimFee = game.claimFee();
console2.log("New claim fee:", newClaimFee);
vm.prank(player2);
vm.expectRevert("Game: You are already the king. No need to re-claim.");
game.claimThrone{value: newClaimFee}();
vm.prank(player3);
vm.expectRevert("Game: You are already the king. No need to re-claim.");
game.claimThrone{value: newClaimFee}();
vm.prank(deployer);
vm.expectRevert("Game: You are already the king. No need to re-claim.");
game.claimThrone{value: newClaimFee}();
}
function claimThrone() external payable gameNotEnded nonReentrant {
- require(msg.sender == currentKing, "Game: You are already the king. No need to re-claim.");
+ require(msg.sender == currentKing, "Game: You are already the king. No need to re-claim.");
}