- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
my ($_bonus1_l, $_bonus1_y, $_bonus2_l, $_bonus2_y) = ($l1*10 > rand(100) ? 1 : 0, $y1*10 > rand(100) ? 1 : 0, $l2*10 > rand(100) ? 1 : 0, $y2*10 > rand(100) ? 1 : 0);
($_bonus1_l, $_bonus2_l) = (0, 0) if $_bonus1_l == 1 and $_bonus2_l == 1;
($_bonus1_y, $_bonus2_y) = (0, 0) if $_bonus1_y == 1 and $_bonus2_y == 1;
if($turn > 12){
my ($_a1_def, $_b1_def, $_c1_def) = mass($pl1_mov, $User1, "def");
my ($_a1_att, $_b1_att, $_c1_att) = mass($pl1_att, $User1, "att");
my ($_a2_def, $_b2_def, $_c2_def) = mass($pl2_mov, $User2, "def");
my ($_a2_att, $_b2_att, $_c2_att) = mass($pl2_att, $User2, "att");
$N1 += $_a1_att if $_a2_def < 1000000;
$N1 += $_b1_att if $_b2_def < 1000000;
$N1 += $_c1_att if $_c2_def < 1000000;
$N2 += $_a2_att if $_a1_def < 1000000;
$N2 += $_b2_att if $_b1_def < 1000000;
$N2 += $_c2_att if $_c1_def < 1000000;
if($_bonus1_l){
my $l = int(rand(3));
## сБНПНР
if($l == 0){
my $r = 0;
($_a2_att, $r) = (0, 1) if $_a2_att > 0 and $_a1_def < 1000000;
($_b2_att, $r) = (0, 1) if $_b2_att > 0 and $_a1_def < 1000000 and $r == 0;
($_c2_att, $r) = (0, 1) if $_c2_att > 0 and $_a1_def < 1000000 and $r == 0;
$U1 = $r;
} elsif($l == 1){
my $r = 0;
($_a1_att, $r, $K2) = (int($_a1_att * 1.5), 1, int($_a1_att/2)) if $_a1_att > 0 and $_a2_def < 1000000;
($_b1_att, $r, $K2) = (int($_b1_att * 1.5), 1, int($_b1_att/2)) if $_b1_att > 0 and $_b2_def < 1000000 and $r == 0;
($_c1_att, $r, $K2) = (int($_c1_att * 1.5), 1, int($_c1_att/2)) if $_c1_att > 0 and $_c2_def < 1000000 and $r == 0;
} elsif($l == 2){
my ($r, $ov, $v) = (0, 0, int(rand(3)));
($_a1_att, $r, $ov) = (0, 1, (int($_a2_att/2))) if $_a2_att > 0 and $_a1_def > 1000000;
($_b1_att, $r, $ov) = (0, 1, (int($_b2_att/2))) if $_b2_att > 0 and $_b1_def > 1000000 and $r == 0;
($_c1_att, $r, $ov) = (0, 1, (int($_c2_att/2))) if $_c2_att > 0 and $_c1_def > 1000000 and $r == 0;
$_a1_att += $ov if $v == 0;
$_b1_att += $ov if $v == 1;
$_c1_att += $ov if $v == 2;
$O1 = $ov;
}
}
if($_bonus2_l){
my $l = int(rand(100));
if($l == 0){
my $r = 0;
($_a1_att, $r) = (0, 1) if $_a1_att > 0 and $_a2_def < 1000000;
($_b1_att, $r) = (0, 1) if $_b1_att > 0 and $_a2_def < 1000000 and $r == 0;
($_c1_att, $r) = (0, 1) if $_c1_att > 0 and $_a2_def < 1000000 and $r == 0;
$U2 = $r;
} elsif($l == 1){
my $r = 0;
($_a2_att, $r, $K1) = (int($_a2_att * 1.5), 1, int($_a2_att/2)) if $_a2_att > 0 and $_a1_def < 1000000;
($_b2_att, $r, $K1) = (int($_b2_att * 1.5), 1, int($_b2_att/2)) if $_b2_att > 0 and $_b1_def < 1000000 and $r == 0;
($_c2_att, $r, $K1) = (int($_c2_att * 1.5), 1, int($_c2_att/2)) if $_c2_att > 0 and $_c1_def < 1000000 and $r == 0;
} elsif($l == 2){
my ($r, $ov, $v) = (0, 0, int(rand(3)));
($_a2_att, $r, $ov) = (0, 1, (int($_a1_att/2))) if $_a1_att > 0 and $_a2_def > 1000000;
($_b2_att, $r, $ov) = (0, 1, (int($_b1_att/2))) if $_b1_att > 0 and $_b2_def > 1000000 and $r == 0;
($_c2_att, $r, $ov) = (0, 1, (int($_c1_att/2))) if $_c1_att > 0 and $_c2_def > 1000000 and $r == 0;
$_a2_att += $ov if $v == 0;
$_b2_att += $ov if $v == 1;
$_c2_att += $ov if $v == 2;
$O2 = $ov;
}
}
if($_bonus1_y){
my $l = int(rand(2));
if($l == 0){
my ($r, $rik, $V1) = (0, 0, int(rand(3)) + 1);
($r, $rik) = (1, (int($_a1_att/2))) if $_a1_att > 0 and $_a2_def < 1000000 and $V1 == 1;
($r, $rik) = (1, (int($_b1_att/2))) if $_b1_att > 0 and $_b2_def < 1000000 and $r == 0 and $V1 == 2;
($r, $rik) = (1, (int($_c1_att/2))) if $_c1_att > 0 and $_c2_def < 1000000 and $r == 0 and $V1 == 3;
$R2 = $rik;
$db->query("UPDATE duel set pl1_rik = CONCAT(pl1_rik, $V1) where sid = \"$dsid\"") if $R2 > 0;
} elsif($l == 1){
my $r = 0;
($_a2_def, $r) = ($_a2_def - 1000000, 1) if $_a1_att > 0 and $_a2_def > 1000000;
($_b2_def, $r) = ($_b2_def - 1000000, 2) if $_b1_att > 0 and $_b2_def > 1000000 and $r == 0;
($_c2_def, $r) = ($_c2_def - 1000000, 3) if $_c1_att > 0 and $_c2_def > 1000000 and $r == 0;
$T2 = $r;
}
}
if($_bonus2_y){
my $l = int(rand(2));
if($l == 0){
my ($r, $rik, $V2) = (0, 0, int(rand(3)) + 1);
($r, $rik) = (1, (int($_a2_att/2))) if $_a2_att > 0 and $_a1_def < 1000000 and $V2 == 1;
($r, $rik) = (1, (int($_b2_att/2))) if $_b2_att > 0 and $_b1_def < 1000000 and $r == 0 and $V2 == 2;
($r, $rik) = (1, (int($_c2_att/2))) if $_c2_att > 0 and $_c1_def < 1000000 and $r == 0 and $V2 == 3;
#$_a2_att += $rik if $V2 == 1;
#$_b2_att += $rik if $V2 == 2;
#$_c2_att += $rik if $V2 == 3;
$R1 = $rik;
$db->query("UPDATE duel set pl2_rik = CONCAT(pl2_rik, $V2) where sid = \"$dsid\"") if $R1 > 0;
} elsif($l == 1){
my $r = 0;
($_a1_def, $r) = ($_a1_def - 1000000, 1) if $_a2_att > 0 and $_a1_def > 1000000;
($_b1_def, $r) = ($_b1_def - 1000000, 2) if $_b2_att > 0 and $_b1_def > 1000000 and $r == 0;
Из браузерной игрушки на mod_perl/mysql. Код наглядно демонстрирует, что говнокод зависит не от языка, а от программиста.