[Add] Chance to board/loot ships is now based on a crew comparison.

This commit is contained in:
Allanis 2013-02-27 19:49:35 +00:00
parent e206af22a6
commit ba89db90a4

View File

@ -86,14 +86,18 @@ static void board_exit(char* str) {
static void board_stealCreds(char* str) {
(void)str;
Pilot* p;
p = pilot_get(player_target);
if(board_credits == 0) {
// Can't steal from the poor. ;)
player_message("The ship has no SCreds left");
return;
}
// Calculate success - TODO: make this based on crew.
if(RNG(0, 100) < 50) {
// Calculate success.
if(RNG(0, 100) < (int)(50. * (double)p->ship->crew/(double)player->ship->crew)) {
board_fail();
return;
}
@ -109,10 +113,12 @@ static void board_fail(void) {
Pilot* p;
if(RNG(0, 2)==0) {
// 33% of instant death.
p = pilot_get(player_target);
p->armour = -1;
player_message("You have tripped the ship's self destruct mechanism!");
} else
// You just got locked out!!
player_message("The ship's security system locks you out!");
board_exit(NULL);