mirror of
				https://github.com/pragma-/pbot.git
				synced 2025-11-04 00:27:23 +01:00 
			
		
		
		
	Plugin/Spinach: improve lie count log
This commit is contained in:
		
							parent
							
								
									5f4b2989a1
								
							
						
					
					
						commit
						bea5aa071b
					
				@ -681,6 +681,10 @@ sub cmd_spinach($self, $context) {
 | 
			
		||||
                    return "$context->{nick}: You are not playing in this game. Use `j` to start playing now!";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if ($player->{lie_count} >= 2) {
 | 
			
		||||
                    return "/msg $context->{nick} You cannot change your lie again this round.";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $arguments = $self->normalize_text($arguments);
 | 
			
		||||
 | 
			
		||||
                my @truth_count = split /\s/, $self->{state_data}->{current_question}->{answer};
 | 
			
		||||
@ -711,9 +715,7 @@ sub cmd_spinach($self, $context) {
 | 
			
		||||
                    return "$context->{nick}: Your lie is too similar to the truth! Submit a different lie.";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (++$player->{lie_count} > 2) {
 | 
			
		||||
                    return "/msg $context->{nick} You cannot change your lie again this round.";
 | 
			
		||||
                }
 | 
			
		||||
                $player->{lie_count}++;
 | 
			
		||||
 | 
			
		||||
                my $changed = exists $player->{lie};
 | 
			
		||||
                $player->{lie} = $arguments;
 | 
			
		||||
@ -1280,6 +1282,10 @@ sub run_one_state($self) {
 | 
			
		||||
sub create_states($self) {
 | 
			
		||||
    $self->{pbot}->{logger}->log("Spinach: Creating game state machine\n");
 | 
			
		||||
 | 
			
		||||
    $self->{state_data} = {
 | 
			
		||||
        players => []
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $self->{previous_state}  = '';
 | 
			
		||||
    $self->{previous_result} = '';
 | 
			
		||||
    $self->{current_state}   = 'nogame';
 | 
			
		||||
@ -1709,8 +1715,8 @@ sub showquestion($self, $state) {
 | 
			
		||||
        $state->{seen_questions}->{$state->{current_category}}->{$state->{current_question}->{id}} = 1;
 | 
			
		||||
 | 
			
		||||
        foreach my $player (@{$state->{players}}) {
 | 
			
		||||
            $player->{lie_count} = 0;
 | 
			
		||||
            delete $player->{lie};
 | 
			
		||||
            delete $player->{lie_count};
 | 
			
		||||
            delete $player->{truth};
 | 
			
		||||
            delete $player->{good_lie};
 | 
			
		||||
            delete $player->{deceived};
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@ use PBot::Imports;
 | 
			
		||||
# These are set by the /misc/update_version script
 | 
			
		||||
use constant {
 | 
			
		||||
    BUILD_NAME     => "PBot",
 | 
			
		||||
    BUILD_REVISION => 4855,
 | 
			
		||||
    BUILD_REVISION => 4856,
 | 
			
		||||
    BUILD_DATE     => "2024-11-21",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user