This commit is contained in:
2026-09-19 10:26:56 +02:00
parent c19fca22d2
commit a071b93d46
2 changed files with 147 additions and 62 deletions
+132 -56
View File
@@ -63,9 +63,9 @@ namespace Casino
AlleBilder = new List<Byte[]>
{
db.GetCardImage(2),db.GetCardImage(3),
db.GetCardImage(4),db.GetCardImage(5),
db.GetCardImage(4),/*db.GetCardImage(5),
db.GetCardImage(6),db.GetCardImage(7),
db.GetCardImage(8),db.GetCardImage(9), db.GetCardImage(10)
db.GetCardImage(8),db.GetCardImage(9), db.GetCardImage(10)*/
};
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
@@ -173,7 +173,14 @@ namespace Casino
{
decimal multiplikator = 0m;
// Waagerecht
// Wichtig:
// Bei jeder neuen Drehung wieder bei 0 anfangen.
highestWin = 0;
// -----------------------------------------------------
// WAAGERECHT
// -----------------------------------------------------
for (int row = 0; row < 3; row++)
{
multiplikator += CheckLine(
@@ -182,19 +189,27 @@ namespace Casino
board[row, 2],
board[row, 3],
board[row, 4],
board[row, 5]);
board[row, 5]
);
}
// Senkrecht
// -----------------------------------------------------
// SENKRECHT
// -----------------------------------------------------
for (int col = 0; col < 6; col++)
{
multiplikator += CheckLine(
board[0, col],
board[1, col],
board[2, col]);
board[2, col]
);
}
// X Muster
// -----------------------------------------------------
// X-MUSTER
// -----------------------------------------------------
bool x1 =
board[0, 0] == board[1, 1] &&
board[1, 1] == board[2, 2];
@@ -203,14 +218,20 @@ namespace Casino
board[0, 5] == board[1, 4] &&
board[1, 4] == board[2, 3];
if (x1 && x2 &&
if (x1 &&
x2 &&
board[0, 0] == board[0, 5])
{
multiplikator += X_MUSTER;
highestWin++;
// Sound-ID für X-Muster
highestWin = Math.Max(highestWin, 7);
}
// Rand
// -----------------------------------------------------
// RAND
// -----------------------------------------------------
int randId = board[0, 0];
bool randGleich =
@@ -220,33 +241,44 @@ namespace Casino
board[0, 3] == randId &&
board[0, 4] == randId &&
board[0, 5] == randId &&
board[2, 0] == randId &&
board[2, 1] == randId &&
board[2, 2] == randId &&
board[2, 3] == randId &&
board[2, 4] == randId &&
board[2, 5] == randId &&
board[1, 0] == randId &&
board[1, 5] == randId;
if (randGleich)
{
multiplikator += RAND;
highestWin++;
// Sound-ID für Rand
highestWin = Math.Max(highestWin, 8);
}
// X + Rand Bonus
if (
randGleich &&
x1 && x2 &&
board[0, 0] == board[0, 5]
)
// -----------------------------------------------------
// X + RAND
// -----------------------------------------------------
if (randGleich &&
x1 &&
x2 &&
board[0, 0] == board[0, 5])
{
multiplikator += X_UND_RAND;
highestWin++;
// Sound-ID für X + Rand
highestWin = Math.Max(highestWin, 9);
}
// Fullboard
// -----------------------------------------------------
// FULLBOARD
// -----------------------------------------------------
int first = board[0, 0];
bool fullBoard = true;
@@ -260,71 +292,115 @@ namespace Casino
break;
}
}
if (!fullBoard)
break;
}
if (fullBoard)
{
multiplikator += FULLBOARD;
// Fullboard = Sound-ID 12
highestWin = 12;
}
if (multiplikator != 0) PlayWinSound();
// -----------------------------------------------------
// SOUND ABSPIELEN
// -----------------------------------------------------
if (multiplikator != 0)
{
PlayWinSound();
}
return einsatz * multiplikator;
}
// Lenard Gerdes
// =========================================================
// CHECK LINE
// =========================================================
private decimal CheckLine(params int[] werte)
{
decimal gewinn = 0;
decimal gewinn = 0m;
int laenge = werte.Length;
// Größte zusammenhängende Reihe
int maxGleiche = 1;
for (int start = 0; start < laenge; start++)
// Aktuelle Reihe
int aktuelleGleiche = 1;
// Wir laufen von links nach rechts
for (int i = 1; i < werte.Length; i++)
{
int gleiche = 1;
for (int next = start + 1; next < laenge; next++)
if (werte[i] == werte[i - 1])
{
if (werte[next] == werte[start])
gleiche++;
else
break;
aktuelleGleiche++;
}
else
{
aktuelleGleiche = 1;
}
if (gleiche >= 3)
if (aktuelleGleiche > maxGleiche)
{
gewinn += DREI;
if (5 > bestSoundId) bestSoundId = 5;
}
if (gleiche >= 4)
{
gewinn += VIER;
highestWin++;
if (6 > bestSoundId) bestSoundId = 6;
}
if (gleiche >= 5)
{
gewinn += FUENF;
highestWin++;
if (7 > bestSoundId) bestSoundId = 7;
}
if (gleiche >= 6)
{
gewinn += SECHS;
highestWin++;
if (8 > bestSoundId) bestSoundId = 8;
maxGleiche = aktuelleGleiche;
}
}
// -----------------------------------------------------
// GEWINN BESTIMMEN
// -----------------------------------------------------
if (maxGleiche >= 3)
{
gewinn += DREI;
// Sound für mindestens 3
highestWin = Math.Max(highestWin, 3);
}
if (maxGleiche >= 4)
{
gewinn += VIER;
// Sound für mindestens 4
highestWin = Math.Max(highestWin, 4);
}
if (maxGleiche >= 5)
{
gewinn += FUENF;
// Sound für mindestens 5
highestWin = Math.Max(highestWin, 5);
}
if (maxGleiche >= 6)
{
gewinn += SECHS;
// Sound für 6
highestWin = Math.Max(highestWin, 6);
}
return gewinn;
}
// =========================================================
// WIN SOUND AUS DATENBANK
// =========================================================
void PlayWinSound()
{
audio.PlaySound(db.GetSound(bestSoundId));
bestSoundId = highestWin+1;
if (bestSoundId > 0)
audio.PlaySound(db.GetSound(bestSoundId), bestSoundId);
bestSoundId = 0; // fehlte komplett
highestWin = 5;
}