Skip to content

Commit

Permalink
Adding a guaranteed weapon vault on L1 and changing spawn rates to re…
Browse files Browse the repository at this point in the history
…duce pit traps
  • Loading branch information
flend committed Aug 26, 2024
1 parent 2f0f3a8 commit fe832a8
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 59 deletions.
10 changes: 10 additions & 0 deletions 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)) // must be a 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 Down
12 changes: 8 additions & 4 deletions src/brogue/Items.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ 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;
}

// 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 Expand Up @@ -683,10 +691,6 @@ void populateItems(pos upstairs) {
}
} else if (rogue.depthLevel > gameConst->amuletLevel) {
theCategory = GEM;
} else if (gameVariant == VARIANT_BULLET_BROGUE && rogue.depthLevel < 3 && rogue.bonusWeaponsSpawned < rogue.depthLevel) {
theCategory = WEAPON;
rogue.bonusWeaponsSpawned++;
if (D_MESSAGE_ITEM_GENERATION) printf("\n(!l) Depth %i: spawning bonus weapon", rogue.depthLevel);
} else {
for (int j = 0; j < gameConst->numberMeteredItems; j++) {
// Create any metered items that reach generation thresholds
Expand Down
5 changes: 3 additions & 2 deletions src/brogue/Rogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -2525,7 +2525,6 @@ typedef struct playerCharacter {
// metered items
long long foodSpawned; // amount of nutrition units spawned so far this game
meteredItem *meteredItems;
int bonusWeaponsSpawned; // BULLET_BROGUE only

// ring bonuses:
short clairvoyance;
Expand Down Expand Up @@ -2596,7 +2595,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 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 @@ -2666,6 +2665,7 @@ enum machineTypes {
MT_REWARD_CONSUMABLES,
MT_REWARD_PEDESTALS_PERMANENT,
MT_REWARD_PEDESTALS_CONSUMABLE,
MT_REWARD_HEAVY_OR_RUNIC_WEAPON,
MT_REWARD_COMMUTATION_ALTARS,
MT_REWARD_RESURRECTION_ALTAR,
MT_REWARD_ADOPTED_ITEM,
Expand Down Expand Up @@ -3308,6 +3308,7 @@ 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);
void updateEncumbrance(void);
short displayedArmorValue(void);
short armorValueIfUnenchanted(item *theItem);
Expand Down
Loading

0 comments on commit fe832a8

Please sign in to comment.