Skip to content

Commit

Permalink
feat: nerf wall disint conj augment
Browse files Browse the repository at this point in the history
  • Loading branch information
kiedtl committed Jun 27, 2024
1 parent 837293a commit 984fbba
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/items.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ pub const ExcisionRing = Ring{ // {{{

pub const ConjurationRing = Ring{ // {{{
.name = "conjuration",
.required_MP = 2,
.required_MP = 3,
.stats = .{ .Conjuration = 2 },
.effect = struct {
pub fn f() bool {
Expand Down
4 changes: 2 additions & 2 deletions src/player.zig
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ pub const ConjAugment = enum(usize) {
pub fn description(self: ConjAugment) []const u8 {
return switch (self) {
// .Survival => "Opposing spectral sabres will not always destroy your own. (TODO: update)",
.WallDisintegrate1 => "A single nearby wall disintegrates into a new sabre when there are other sabres in your vision.",
.WallDisintegrate2 => "Two nearby walls disintegrate into new sabres when there are other sabres in your vision.",
.WallDisintegrate1 => "50% chance for an adjacent wall to disintegrate into a new sabre when there are other sabres in your vision.",
.WallDisintegrate2 => "10% chance for two adjacent walls to disintegrate into new sabres when there are other sabres in your vision.",
.rFire_25 => "Your sabres possess +25% rFire.",
.rFire_50 => "Your sabres possess +50% rFire.",
.rElec_25 => "Your sabres possess +25% rElec.",
Expand Down
4 changes: 2 additions & 2 deletions src/state.zig
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,10 @@ pub fn messageAboutMob(
}

pub fn message(mtype: MessageType, comptime fmt: []const u8, args: anytype) void {
var buf: [128]u8 = undefined;
var buf: [256]u8 = undefined;
for (buf) |*i| i.* = 0;
var fbs = std.io.fixedBufferStream(&buf);
@call(.{ .modifier = .always_inline }, std.fmt.format, .{ fbs.writer(), fmt, args }) catch err.bug("format error", .{});
@call(.{ .modifier = .always_inline }, std.fmt.format, .{ fbs.writer(), fmt, args }) catch err.bug("format error (buffer overflow?)", .{});

var msg: Message = .{
.msg = undefined,
Expand Down
35 changes: 22 additions & 13 deletions src/types.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ pub const SuspiciousTileRecord = struct {
};

pub const Message = struct {
msg: [128:0]u8,
msg: [256:0]u8,
type: MessageType,
turn: usize,
dups: usize = 0,
Expand Down Expand Up @@ -2530,20 +2530,29 @@ pub const Mob = struct { // {{{

// Player conjuration augments
if (self == state.player and player.hasSabresInSight()) {
var spawn_ctr = 0 +
(if (player.hasAugment(.WallDisintegrate1)) @as(usize, 1) else 0) +
(if (player.hasAugment(.WallDisintegrate2)) @as(usize, 2) else 0);
for (&DIRECTIONS) |d| {
if (spawn_ctr == 0)
break;
if (state.player.coord.move(d, state.mapgeometry)) |neighbor| {
if (state.dungeon.at(neighbor).type == .Wall) {
state.dungeon.at(neighbor).type = .Floor;
spells.spawnSabreSingle(state.player, neighbor);
state.message(.Info, "A nearby wall disintegrates into a spectral sabre.", .{});
spawn_ctr -= 1;
const _spawnSabreFromWall = struct {
pub fn f() void {
for (&DIRECTIONS) |d| {
if (state.player.coord.move(d, state.mapgeometry)) |neighbor| {
if (state.dungeon.at(neighbor).type == .Wall) {
state.dungeon.at(neighbor).type = .Floor;
spells.spawnSabreSingle(state.player, neighbor);
state.message(.Info, "A nearby wall disintegrates into a spectral sabre.", .{});
break;
}
}
}
}
}.f;
if (player.hasAugment(.WallDisintegrate1)) {
if (rng.percent(@as(usize, 50)))
_spawnSabreFromWall();
}
if (player.hasAugment(.WallDisintegrate2)) {
if (rng.percent(@as(usize, 10))) {
_spawnSabreFromWall();
_spawnSabreFromWall();
}
}
}
}
Expand Down

0 comments on commit 984fbba

Please sign in to comment.