mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Lambchop fix (#90)
* Enabling/disabling gamba games with dynamic settting lookup. * shadow wizard lambchop gang, we love fixing upper bound errors * dsfgrgfds
This commit is contained in:
committed by
GitHub
parent
66f2af5f52
commit
6b6bfe2699
@@ -332,9 +332,19 @@ public class LambchopCommand : ICommand
|
|||||||
double riggingFactor = Money.GetRandomDouble(gambler);
|
double riggingFactor = Money.GetRandomDouble(gambler);
|
||||||
if (_houseEdge > 0 && riggingFactor < _houseEdge * 2) // shitty hack because I made the decision to clamp houseEdge to max 50%
|
if (_houseEdge > 0 && riggingFactor < _houseEdge * 2) // shitty hack because I made the decision to clamp houseEdge to max 50%
|
||||||
{
|
{
|
||||||
// More rigging means death tile is more likely near the end
|
// Player fails - calculate where the death tile appears
|
||||||
int minDeathTile = Math.Max(0, FIELD_LENGTH - 3);
|
double riggingFactor = Money.GetRandomDouble(gambler);
|
||||||
return Money.GetRandomNumber(gambler, minDeathTile, FIELD_LENGTH); // return 15 means dying on the last tile xd
|
if (_houseEdge > 0 && riggingFactor < _houseEdge * 2) // shitty hack because I made the decision to clamp houseEdge to max 50%
|
||||||
|
{
|
||||||
|
// More rigging means death tile is more likely near the end
|
||||||
|
int minDeathTile = Math.Max(0, FIELD_LENGTH - 3);
|
||||||
|
return Money.GetRandomNumber(gambler, minDeathTile, FIELD_LENGTH, incrementMaxParam:false); // return 15 means dying on the last tile xd
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Player fail, random tile in the path becomes death tile
|
||||||
|
return Money.GetRandomNumber(gambler,0, FIELD_LENGTH, incrementMaxParam:false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player fail, random tile in the path becomes death tile
|
// Player fail, random tile in the path becomes death tile
|
||||||
@@ -344,12 +354,12 @@ public class LambchopCommand : ICommand
|
|||||||
// Tiles 1 - 15
|
// Tiles 1 - 15
|
||||||
if (_houseEdge < 0.015)
|
if (_houseEdge < 0.015)
|
||||||
{
|
{
|
||||||
int deathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH); // can be any tile, including no tile! (result -1 to FIELD_LENGTH (-1 - 15))
|
int deathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH, incrementMaxParam:false); // can be any tile, including no tile! (result -1 to FIELD_LENGTH (-1 - 15))
|
||||||
return deathTile;
|
return deathTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// game is rigged, manipulate tile placement
|
// game is rigged, manipulate tile placement
|
||||||
int fairDeathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH);
|
int fairDeathTile = Money.GetRandomNumber(gambler,-1, FIELD_LENGTH, incrementMaxParam:false);
|
||||||
fairDeathTile = fairDeathTile == -1 ? FIELD_LENGTH + 1 : fairDeathTile; // shit hack, -1 means no death tile, change it to FIELD_LENGTH + 1 to compensate for next check.
|
fairDeathTile = fairDeathTile == -1 ? FIELD_LENGTH + 1 : fairDeathTile; // shit hack, -1 means no death tile, change it to FIELD_LENGTH + 1 to compensate for next check.
|
||||||
bool wouldSucceedFairly = fairDeathTile > targetTile;
|
bool wouldSucceedFairly = fairDeathTile > targetTile;
|
||||||
fairDeathTile = fairDeathTile == FIELD_LENGTH + 1 ? -1 : fairDeathTile;
|
fairDeathTile = fairDeathTile == FIELD_LENGTH + 1 ? -1 : fairDeathTile;
|
||||||
@@ -365,9 +375,11 @@ public class LambchopCommand : ICommand
|
|||||||
// extra rigged fail, choose tile just before target tile
|
// extra rigged fail, choose tile just before target tile
|
||||||
return targetTile > 1 ? targetTile - 1 : 1;
|
return targetTile > 1 ? targetTile - 1 : 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// rigging failed, normal tile return
|
{
|
||||||
return Money.GetRandomNumber(gambler,-1, targetTile);
|
// rigging failed, normal tile return
|
||||||
|
return Money.GetRandomNumber(gambler,-1, targetTile, incrementMaxParam:false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return fairDeathTile;
|
return fairDeathTile;
|
||||||
@@ -381,7 +393,7 @@ public class LambchopCommand : ICommand
|
|||||||
// Place death tile closer to target
|
// Place death tile closer to target
|
||||||
// higher house edge = more likely to place closer
|
// higher house edge = more likely to place closer
|
||||||
int minTile = Math.Max(0, targetTile - 3);
|
int minTile = Math.Max(0, targetTile - 3);
|
||||||
return Money.GetRandomNumber(gambler,minTile, targetTile);
|
return Money.GetRandomNumber(gambler,minTile, targetTile, incrementMaxParam:false);
|
||||||
}
|
}
|
||||||
return fairDeathTile;
|
return fairDeathTile;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user