[Add] Chance to board/loot ships is now based on a crew comparison.
This commit is contained in:
parent
e206af22a6
commit
ba89db90a4
10
src/board.c
10
src/board.c
@ -86,14 +86,18 @@ static void board_exit(char* str) {
|
|||||||
|
|
||||||
static void board_stealCreds(char* str) {
|
static void board_stealCreds(char* str) {
|
||||||
(void)str;
|
(void)str;
|
||||||
|
Pilot* p;
|
||||||
|
|
||||||
|
p = pilot_get(player_target);
|
||||||
|
|
||||||
if(board_credits == 0) {
|
if(board_credits == 0) {
|
||||||
|
// Can't steal from the poor. ;)
|
||||||
player_message("The ship has no SCreds left");
|
player_message("The ship has no SCreds left");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate success - TODO: make this based on crew.
|
// Calculate success.
|
||||||
if(RNG(0, 100) < 50) {
|
if(RNG(0, 100) < (int)(50. * (double)p->ship->crew/(double)player->ship->crew)) {
|
||||||
board_fail();
|
board_fail();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -109,10 +113,12 @@ static void board_fail(void) {
|
|||||||
Pilot* p;
|
Pilot* p;
|
||||||
|
|
||||||
if(RNG(0, 2)==0) {
|
if(RNG(0, 2)==0) {
|
||||||
|
// 33% of instant death.
|
||||||
p = pilot_get(player_target);
|
p = pilot_get(player_target);
|
||||||
p->armour = -1;
|
p->armour = -1;
|
||||||
player_message("You have tripped the ship's self destruct mechanism!");
|
player_message("You have tripped the ship's self destruct mechanism!");
|
||||||
} else
|
} else
|
||||||
|
// You just got locked out!!
|
||||||
player_message("The ship's security system locks you out!");
|
player_message("The ship's security system locks you out!");
|
||||||
|
|
||||||
board_exit(NULL);
|
board_exit(NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user