From 58ef4755ed9b063bbbb6ae579e603366acfbf744 Mon Sep 17 00:00:00 2001 From: realraum Date: Fri, 11 Nov 2011 21:55:29 +0000 Subject: [PATCH] bugfixes and sounds --- dart/Dart.pm | 2 +- dart/dart-red-x01.pl | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/dart/Dart.pm b/dart/Dart.pm index d9b3795..7adec4a 100644 --- a/dart/Dart.pm +++ b/dart/Dart.pm @@ -29,7 +29,7 @@ sub get_color { my $self=shift; my ($mul,$zahl)=@_; - my @zahlen = qw/20 1 18 4 13 6 10 15 2 17 3 19 7 16 8 11 14 9 12 5/; + my @zahlen = qw/20 1 18 4 13 6 10 15 2 17 3 19 7 16 8 11 14 9 12 5 25/; my $counter=0; $counter++ while($zahl != shift @zahlen and @zahlen); $mul=0 if $mul >1; diff --git a/dart/dart-red-x01.pl b/dart/dart-red-x01.pl index 56b4cb2..78c3a9e 100755 --- a/dart/dart-red-x01.pl +++ b/dart/dart-red-x01.pl @@ -39,19 +39,16 @@ sub shoot { my $self=shift; my ($mult,$zahl)=@_; - my $color = $self->get_color($mult,$zahl)?1:-1; - if ($self->get_current_player()->{score} >= $mult * $zahl) + my $color = $self->get_color($mult,$zahl)?1:-1; + if ($color <0) { - $self->get_current_player()->{score} -= $color *$mult * $zahl; - $self->shout_last_shoot(); - $self->win() if &win_condition($self); - } - else - { - $self->shout("miss"); - $self->get_current_player()->{score} = $self->get_current_player()->{last_score}; - $self->finish_player_round(); + $self->shout("plus"); + }else{ + $self->shout("minus"); } + $self->get_current_player()->{score} -= $color *$mult * $zahl; + $self->shout_last_shoot(); + $self->win() if &win_condition($self); } sub next_player -- 1.7.10.4