Skip to content

Commit

Permalink
Put the number of heads and tails in the event value of EVENT_TOSS_COIN
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Jul 21, 2023
1 parent 7ca72eb commit 247a25a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#define LOCATION_DECKBOT 0x10001 //Return to deck bottom
#define LOCATION_DECKSHF 0x20001 //Return to deck and shuffle

//
#define COIN_HEADS 1
#define COIN_TAILS 0

//Positions
#define POS_FACEUP_ATTACK 0x1
#define POS_FACEDOWN_ATTACK 0x2
Expand Down
7 changes: 6 additions & 1 deletion operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5984,7 +5984,12 @@ int32_t field::toss_coin(uint16_t step, effect* reason_effect, uint8_t reason_pl
return FALSE;
}
case 1: {
raise_event((card*)0, EVENT_TOSS_COIN, reason_effect, 0, reason_player, playerid, count);
uint8_t heads = 0, tails = 0;
for(auto result : core.coin_results) {
heads += (result == COIN_HEADS);
tails += (result == COIN_TAILS);
}
raise_event((card*)0, EVENT_TOSS_COIN, reason_effect, 0, reason_player, playerid, (tails << 16) | (heads << 8) | count);
process_instant_event();
return TRUE;
}
Expand Down

0 comments on commit 247a25a

Please sign in to comment.