Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bullet brogue v1.1.1 to mainline CE #724

Draft
wants to merge 2 commits into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-seed-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ jobs:
run: |
python3 test/compare_seed_catalog.py test/seed_catalogs/seed_catalog_brogue.txt 40
python3 test/compare_seed_catalog.py --extra_args "--variant rapid_brogue" test/seed_catalogs/seed_catalog_rapid_brogue.txt 10
python3 test/compare_seed_catalog.py --extra_args "--variant bullet_brogue" test/seed_catalogs/seed_catalog_bullet_brogue.txt 5
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ jobs:
run: |
python3 test/run_regression_tests.py test/regression_test_ce_v1_14/
python3 test/run_regression_tests.py --extra_args "--variant rapid_brogue" test/regression_test_rb_v1_6/
python3 test/run_regression_tests.py --extra_args "--variant bullet_brogue" test/regression_test_bb_v1_1/
4 changes: 2 additions & 2 deletions make/o.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$(sources:.c=.o): %.o: %.c src/brogue/Rogue.h src/brogue/Globals.h src/brogue/GlobalsBase.h vars/cppflags vars/cflags make/o.mk
$(CC) $(cppflags) $(cflags) -c $< -o $@

src/variants/GlobalsBrogue.o src/variants/GlobalsRapidBrogue.o: vars/extra_version
src/variants/GlobalsBrogue.o src/variants/GlobalsRapidBrogue.o: cppflags += -DBROGUE_EXTRA_VERSION='"$(extra_version)"'
src/variants/GlobalsBrogue.o src/variants/GlobalsRapidBrogue.o src/variants/GlobalsBulletBrogue.o: vars/extra_version
src/variants/GlobalsBrogue.o src/variants/GlobalsRapidBrogue.o src/variants/GlobalsBulletBrogue.o: cppflags += -DBROGUE_EXTRA_VERSION='"$(extra_version)"'
12 changes: 11 additions & 1 deletion src/brogue/Architect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,7 @@ boolean buildAMachine(enum machineTypes bp,
while ((theItem->flags & ITEM_CURSED)
|| ((feature->flags & MF_REQUIRE_GOOD_RUNIC) && (!(theItem->flags & ITEM_RUNIC))) // runic if requested
|| ((feature->flags & MF_NO_THROWING_WEAPONS) && theItem->category == WEAPON && theItem->quantity > 1) // no throwing weapons if prohibited
|| ((feature->flags & MF_REQUIRE_HEAVY_WEAPON) && (!itemIsHeavyWeapon(theItem) || !itemIsPositivelyEnchanted(theItem))) // must be a positively enchanted heavy weapon
|| itemIsADuplicate(theItem, p->spawnedItems, itemCount)) { // don't want to duplicates of rings, staffs, etc.
deleteItem(theItem);
theItem = generateItem(feature->itemCategory, feature->itemKind);
Expand Down Expand Up @@ -1734,6 +1735,15 @@ static void addMachines() {

analyzeMap(true);

// For bullet brogue, add a guaranteed weapon vault on l1
if (gameVariant == VARIANT_BULLET_BROGUE && rogue.depthLevel == 1) {
for (failsafe = 50; failsafe; failsafe--) {
if (buildAMachine(MT_REWARD_HEAVY_OR_RUNIC_WEAPON, -1, -1, 0, NULL, NULL, NULL)) {
break;
}
}
}

// Add the amulet holder if it's depth 26:
if (rogue.depthLevel == gameConst->amuletLevel) {
for (failsafe = 50; failsafe; failsafe--) {
Expand All @@ -1745,7 +1755,7 @@ static void addMachines() {

// Add reward rooms, if any:
machineCount = 0;
while (rogue.depthLevel <= gameConst->amuletLevel
while (rogue.depthLevel <= gameConst->deepestLevelForMachines
&& (rogue.rewardRoomsGenerated + machineCount) * gameConst->machinesPerLevelSuppressionMultiplier + gameConst->machinesPerLevelSuppressionOffset < rogue.depthLevel * gameConst->machinesPerLevelIncreaseFactor) {
// try to build at least one every four levels on average
machineCount++;
Expand Down
12 changes: 12 additions & 0 deletions src/brogue/Items.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ static boolean itemIsThrowingWeapon(const item *theItem) {
return false;
}

boolean itemIsHeavyWeapon(const item *theItem) {
if (theItem && theItem->category == WEAPON && !itemIsThrowingWeapon(theItem)
&& weaponTable[theItem->kind].strengthRequired > 15) {
return true;
}
return false;
}

boolean itemIsPositivelyEnchanted(const item *theItem) {
return theItem->enchant1 > 0;
}

// Sets an item to the given type and category (or chooses randomly if -1) with all other stats
item *makeItemInto(item *theItem, unsigned long itemCategory, short itemKind) {
const itemTable *theEntry = NULL;
Expand Down
29 changes: 18 additions & 11 deletions src/brogue/MainMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,25 @@ static void chooseGameVariant() {
append(textBuf, tmpBuf, TEXT_MAX_LENGTH);
append(textBuf, "Die faster and more often in this quarter-length version of the classic game!\n\n", TEXT_MAX_LENGTH);

brogueButton buttons[2];
snprintf(tmpBuf, TEXT_MAX_LENGTH, "%sBullet Brogue%s\n", goldColorEscape, whiteColorEscape);
append(textBuf, tmpBuf, TEXT_MAX_LENGTH);
append(textBuf, "No time? Death wish? Bullet Brogue is for you. Not best for new players!\n\n", TEXT_MAX_LENGTH);

brogueButton buttons[3];
initializeMainMenuButton(&(buttons[0]), " %sR%sapid Brogue ", 'r', 'R', NG_NOTHING);
initializeMainMenuButton(&(buttons[1]), " %sB%srogue ", 'b', 'B', NG_NOTHING);

initializeMainMenuButton(&(buttons[2]), " Bu%sl%slet Brogue ", 'l', 'L', NG_NOTHING);

const SavedDisplayBuffer rbuf = saveDisplayBuffer();
gameVariantChoice = printTextBox(textBuf, 20, 7, 45, &white, &black, buttons, 2);
gameVariantChoice = printTextBox(textBuf, 20, 7, 45, &white, &black, buttons, 3);
restoreDisplayBuffer(&rbuf);

if (gameVariantChoice == 1) {
gameVariant = VARIANT_BROGUE;
} else if (gameVariantChoice == 0) {
if (gameVariantChoice == 0) {
gameVariant = VARIANT_RAPID_BROGUE;
} else if (gameVariantChoice == 1) {
gameVariant = VARIANT_BROGUE;
} else if (gameVariantChoice == 2) {
gameVariant = VARIANT_BULLET_BROGUE;
} else {
rogue.nextGame = NG_NOTHING;
}
Expand Down Expand Up @@ -689,7 +696,7 @@ boolean dialogChooseFile(char *path, const char *suffix, const char *prompt) {
fileEntry *files;
boolean retval = false, again;
screenDisplayBuffer dbuf;

const color *dialogColor = &interfaceBoxColor;
char *membuf;
char fileDate [11];
Expand Down Expand Up @@ -881,7 +888,7 @@ typedef struct gameStats {
int currentMasteryStreak;
} gameStats;

/// @brief Updates the given stats to include a run
/// @brief Updates the given stats to include a run
/// @param run The run to add
/// @param stats The stats to update
static void addRuntoGameStats(rogueRun *run, gameStats *stats) {
Expand Down Expand Up @@ -936,17 +943,17 @@ static void viewGameStats(void) {
gameStats allTimeStats = {0};
gameStats recentStats = {0};

rogueRun *runHistory = loadRunHistory();
rogueRun *runHistory = loadRunHistory();
rogueRun *run = runHistory;

// calculate stats
while (run != NULL) {
if (run->seed != 0) {
addRuntoGameStats(run, &allTimeStats);
addRuntoGameStats(run, &recentStats);
} else { // when seed == 0 the run entry means the player reset their recent stats at this point
} else { // when seed == 0 the run entry means the player reset their recent stats at this point
memset(&recentStats, 0, sizeof(gameStats));
}
}
run = run->nextRun;
}

Expand Down
2 changes: 1 addition & 1 deletion src/brogue/Monsters.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ creature *spawnHorde(short hordeID, pos loc, unsigned long forbiddenFlags, unsig
creature *leader, *preexistingMonst;
boolean tryAgain;

if (rogue.depthLevel > 1 && rand_percent(10)) {
if (rogue.depthLevel > 1 && rand_percent(gameConst->monsterOutOfDepthChance)) {
depth = rogue.depthLevel + rand_range(1, min(5, rogue.depthLevel / 2));
if (depth > gameConst->amuletLevel) {
depth = max(rogue.depthLevel, gameConst->amuletLevel);
Expand Down
16 changes: 12 additions & 4 deletions src/brogue/Rogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ typedef struct windowpos {
enum gameVariant {
VARIANT_BROGUE,
VARIANT_RAPID_BROGUE,
VARIANT_BULLET_BROGUE,
NUMBER_VARIANTS
};

Expand Down Expand Up @@ -2379,7 +2380,8 @@ typedef struct gameConstants {
const int minimumAltarLevel; // how deep before resurrection and commutation altars can be generated
const int minimumLavaLevel; // how deep before lava can be generated
const int minimumBrimstoneLevel; // how deep before brimstone can be generated
const int mutationsOccurAboveLevel; // how deep before monster mutations can be generated
const int mutationsOccurAboveLevel; // how deep before monster mutations can be generated
const int monsterOutOfDepthChance; // the percentage chance to use a deeper depth when generating monster hordes

const int extraItemsPerLevel; // how many extra items generated per level above vanilla
const int goldAdjustmentStartDepth; // depth from which gold is adjusted based on generation so far
Expand All @@ -2388,6 +2390,7 @@ typedef struct gameConstants {
const int machinesPerLevelSuppressionOffset; // offset for limiting number of machines generated so far against depth
const int machinesPerLevelIncreaseFactor; // scale factor for increasing number of machines generated so far against depth
const int maxLevelForBonusMachines; // deepest level that gets bonus machine generation chance
const int deepestLevelForMachines; // deepest level where can machines be generated

const int playerTransferenceRatio; // player transference heal is (enchant / gameConst->playerTransferenceRatio)
const int onHitHallucinateDuration; // duration of on-hit hallucination effect on player
Expand Down Expand Up @@ -2521,7 +2524,7 @@ typedef struct playerCharacter {
int gameExitStatusCode; // exit status code indicating if brogue exited successfully or with an error

// metered items
long long foodSpawned; // amount of nutrition units spawned so far this game
long long foodSpawned; // amount of nutrition units spawned so far this game
meteredItem *meteredItems;

// ring bonuses:
Expand Down Expand Up @@ -2593,7 +2596,7 @@ enum machineFeatureFlags {
MF_ALTERNATIVE_2 = Fl(17), // same as MF_ALTERNATIVE, but provides for a second set of alternatives of which only one will be chosen
MF_REQUIRE_GOOD_RUNIC = Fl(18), // generated item must be uncursed runic
MF_MONSTERS_DORMANT = Fl(19), // monsters are dormant, and appear when a dungeon feature with DFF_ACTIVATE_DORMANT_MONSTER spawns on their tile
// unused = Fl(20), //
MF_REQUIRE_HEAVY_WEAPON = Fl(20), // requires a positively-enchanted heavy weapon
MF_BUILD_IN_WALLS = Fl(21), // build in an impassable tile that is adjacent to the interior
MF_BUILD_ANYWHERE_ON_LEVEL = Fl(22), // build anywhere on the level that is not inside the machine
MF_REPEAT_UNTIL_NO_PROGRESS = Fl(23), // keep trying to build this feature set until no changes are made
Expand Down Expand Up @@ -2736,7 +2739,10 @@ enum machineTypes {
MT_PARALYSIS_TRAP_HIDDEN_AREA,
MT_TRICK_STATUE_AREA,
MT_WORM_AREA,
MT_SENTINEL_AREA
MT_SENTINEL_AREA,

// Variant-specific machines
MT_REWARD_HEAVY_OR_RUNIC_WEAPON
};

typedef struct autoGenerator {
Expand Down Expand Up @@ -3305,6 +3311,8 @@ extern "C" {
item *generateItem(unsigned short theCategory, short theKind);
short chooseKind(const itemTable *theTable, short numKinds);
item *makeItemInto(item *theItem, unsigned long itemCategory, short itemKind);
boolean itemIsHeavyWeapon(const item *theItem);
boolean itemIsPositivelyEnchanted(const item *theItem);
void updateEncumbrance(void);
short displayedArmorValue(void);
short armorValueIfUnenchanted(item *theItem);
Expand Down
5 changes: 5 additions & 0 deletions src/brogue/RogueMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "Globals.h"
#include "GlobalsBrogue.h"
#include "GlobalsRapidBrogue.h"
#include "GlobalsBulletBrogue.h"

#include <time.h>

Expand All @@ -38,6 +39,7 @@ int rogueMain() {
void printBrogueVersion() {
printf("Brogue version: %s\n", brogueVersion);
printf("Supports variant (rapid_brogue): %s\n", rapidBrogueVersion);
printf("Supports variant (bullet_brogue): %s\n", bulletBrogueVersion);
}

void executeEvent(rogueEvent *theEvent) {
Expand Down Expand Up @@ -174,6 +176,9 @@ void initializeGameVariant() {
case VARIANT_RAPID_BROGUE:
initializeGameVariantRapidBrogue();
break;
case VARIANT_BULLET_BROGUE:
initializeGameVariantBulletBrogue();
break;
default:
initializeGameVariantBrogue();
}
Expand Down
5 changes: 4 additions & 1 deletion src/platform/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void printCommandlineHelp() {
#ifdef BROGUE_CURSES
"--term -t run in ncurses-based terminal mode\n"
#endif
"--variant variant_name run a variant game (options: rapid_brogue)\n"
"--variant variant_name run a variant game (options: rapid_brogue, bullet_brogue)\n"
"--stealth -S display stealth range\n"
"--no-effects -E disable color effects\n"
"--wizard -W run in wizard mode, invincible with powerful items\n"
Expand Down Expand Up @@ -175,6 +175,9 @@ int main(int argc, char *argv[])
if (!strcmp("rapid_brogue", argv[i + 1])) {
gameVariant = VARIANT_RAPID_BROGUE;
}
if (!strcmp("bullet_brogue", argv[i + 1])) {
gameVariant = VARIANT_BULLET_BROGUE;
}
i++;
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions src/variants/GlobalsBrogue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,11 +1022,13 @@ const gameConstants brogueGameConst = {
.minimumLavaLevel = 4,
.minimumBrimstoneLevel = 17,
.mutationsOccurAboveLevel = 10,
.monsterOutOfDepthChance = 10,

.machinesPerLevelSuppressionMultiplier = 4,
.machinesPerLevelSuppressionOffset = 2,
.machinesPerLevelIncreaseFactor = 1,
.maxLevelForBonusMachines = 2,
.deepestLevelForMachines = AMULET_LEVEL,

.extraItemsPerLevel = 0,
.goldAdjustmentStartDepth = 6,
Expand Down
Loading
Loading