Skip to content

Commit

Permalink
feat: 2 new enemies and a few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BigJk committed Aug 24, 2024
1 parent a5734b4 commit 15305d9
Show file tree
Hide file tree
Showing 18 changed files with 326 additions and 71 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ COPY . .
RUN apt-get update
RUN apt-get install -y libasound2-dev

RUN go build -tags no_audio -o /app/end_of_eden ./cmd/game
RUN go build -tags no_audio -o /app/fuzzy_tester ./cmd/internal/fuzzy_tester

# Disable SSH for now
# RUN go build -tags no_audio -o /app/end_of_eden_ssh ./cmd/game_ssh
RUN CGO_ENABLED=0 go build -tags no_audio -o /app/end_of_eden ./cmd/game
RUN CGO_ENABLED=0 go build -tags no_audio -o /app/end_of_eden_ssh ./cmd/game_ssh
RUN CGO_ENABLED=0 go build -tags no_audio -o /app/tester ./cmd/internal/tester
RUN CGO_ENABLED=0 go build -tags no_audio -o /app/fuzzy_tester ./cmd/internal/fuzzy_tester

# Release image
FROM debian:bullseye
Expand Down
8 changes: 8 additions & 0 deletions assets/scripts/definitions/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function play_music(sound) end
-- Game State
-- #####################################

--- get the number of action points per round.
---@return number
function get_action_points_per_round() end

--- Gets the ids of all the encountered events in the order of occurrence.
---@return string[]
function get_event_history() end
Expand Down Expand Up @@ -142,6 +146,10 @@ function had_events(event_ids) end
---@return boolean
function had_events_any(eventIds) end

--- set the number of action points per round.
---@param points number
function set_action_points_per_round(points) end

--- Set event by id.
---@param event_id type_id
function set_event(event_id) end
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/enemies/clean_bot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ register_enemy("CLEAN_BOT", {
color = "#32a891",
initial_hp = 13,
max_hp = 13,
gold = 15,
gold = 30,
intend = function(ctx)
local self = get_actor(ctx.guid)
if self.hp <= 4 then
Expand Down
6 changes: 3 additions & 3 deletions assets/scripts/enemies/cyber_spider.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
register_enemy("CYBER_SPIDER", {
name = "CYBER Spider",
description = "It waits for its prey to come closer",
look = [[/\o^o/\]],
look = [[/\o^o/\]],
color = "#ff4d6d",
initial_hp = 8,
max_hp = 8,
gold = 15,
gold = 40,
intend = function(ctx)
if ctx.round > 0 and ctx.round % 3 == 0 then
return "Deal " .. highlight(5) .. " damage"
return "Deal " .. highlight(5) .. " damage"
end

return "Wait..."
Expand Down
51 changes: 51 additions & 0 deletions assets/scripts/enemies/laser_drone.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
register_enemy("LASER_DRONE", {
name = "Laser Drone",
description = "A drone equipped with a powerful laser cannon.",
look = [[|o|]],
color = "#ff0000",
initial_hp = 7,
max_hp = 7,
gold = 40,
intend = function(ctx)
if ctx.round % 3 == 0 then
return "Charge up for a powerful laser attack"
elseif ctx.round % 3 == 1 then
return "Deal " .. highlight(2) .. " damage"
else
return "Deal " .. highlight(5) .. " damage"
end
end,
callbacks = {
on_turn = function(ctx)
if ctx.round % 3 == 0 then
give_status_effect("CHARGING", ctx.guid)
elseif ctx.round % 3 == 1 then
deal_damage(ctx.guid, PLAYER_ID, 2)
else
deal_damage(ctx.guid, PLAYER_ID, 5)
end
return nil
end
}
})

register_status_effect("CHARGING", {
name = "Charging",
description = "The drone is charging up for a powerful attack.",
look = "CHRG",
foreground = "#ff0000",
state = function(ctx)
return "Charging up for a powerful attack."
end,
can_stack = false,
decay = DECAY_NONE,
rounds = 1,
callbacks = {
on_damage_calc = function(ctx)
if ctx.source == ctx.owner then
return ctx.damage
end
return nil
end
}
})
28 changes: 28 additions & 0 deletions assets/scripts/enemies/plasma_golem.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
register_enemy("PLASMA_GOLEM", {
name = "Plasma Golem",
description = "A golem made of pure plasma energy.",
look = [[
/\
/ \
/_xx_\]],
color = "#ff69b4",
initial_hp = 12,
max_hp = 12,
gold = 80,
intend = function(ctx)
if ctx.round % 2 == 0 then
return "Charge up for a powerful plasma attack"
else
return "Deal " .. highlight(8) .. " damage"
end
end,
callbacks = {
on_turn = function(ctx)
if ctx.round % 2 == 0 then
else
deal_damage(ctx.guid, PLAYER_ID, 8)
end
return nil
end
}
})
2 changes: 1 addition & 1 deletion assets/scripts/enemies/rust_mite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ register_enemy("RUST_MITE", {
color = "#e6e65a",
initial_hp = 12,
max_hp = 12,
gold = 10,
gold = 35,
intend = function(ctx)
if ctx.round % 4 == 0 then
return "Load battery"
Expand Down
22 changes: 22 additions & 0 deletions assets/scripts/equipment/_debug.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
register_card("DEBUG_INSTA_KILL", {
name = l("cards.DEBUG_INSTA_KILL.name", "DEBUG Insta Kill"),
description = l("cards.DEBUG_INSTA_KILL.description", "..."),
state = function(ctx)
return "Kill"
end,
tags = {},
max_level = 1,
color = COLOR_GRAY,
need_target = true,
point_cost = 0,
price = -1,
callbacks = {
on_cast = function(ctx)
deal_damage_card(ctx.caster, ctx.guid, ctx.target, 10000)
return nil
end
},
test = function()
return assert_cast_damage("DEBUG_INSTA_KILL", 10000)
end
})
47 changes: 44 additions & 3 deletions assets/scripts/events/act_0/enemies.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It seems to be eating the metal from the walls. It looks at you and after a few
**It seems to be hostile!**
]],
tags = {"_ACT_0_FIGHT"},
tags = { "_ACT_0_FIGHT" },
choices = {
{
description = "Fight!",
Expand All @@ -32,7 +32,7 @@ It looks at you and says "Corpse. Clean. Engage.".
**You're not sure what it means, but it doesn't seem to be friendly!**
]],
tags = {"_ACT_0_FIGHT"},
tags = { "_ACT_0_FIGHT" },
choices = {
{
description = "Fight!",
Expand All @@ -54,7 +54,7 @@ register_event("CYBER_SPIDER", {
You come around a corner and see a strange creature hanging from the ceiling. It looks like a spider, but it's made out of metal.
It seems to be waiting for its prey to come closer and there is no way around it.
]],
tags = {"_ACT_0_FIGHT"},
tags = { "_ACT_0_FIGHT" },
choices = {
{
description = "Fight!",
Expand All @@ -68,3 +68,44 @@ It seems to be waiting for its prey to come closer and there is no way around it
}
}
})

register_event("LASER_DRONE", {
name = "A menacing drone appears...",
description =
[[As you explore the facility, you hear a high-pitched whirring sound. A drone equipped with a powerful laser cannon appears in front of you.
**It looks ready to attack!**
]],
tags = { "_ACT_0_FIGHT" },
choices = {
{
description = "Fight!",
callback = function()
add_actor_by_enemy("LASER_DRONE")
if math.random() < 0.10 then
add_actor_by_enemy("LASER_DRONE")
end
return GAME_STATE_FIGHT
end
}
}
})

register_event("PLASMA_GOLEM", {
name = "A glowing figure emerges...",
description =
[[As you delve deeper into the facility, you notice a bright glow emanating from a nearby chamber. A massive golem made of pure plasma energy steps into view.
**It looks ready to unleash its power!**
]],
tags = { "_ACT_0_FIGHT" },
choices = {
{
description = "Fight!",
callback = function()
add_actor_by_enemy("PLASMA_GOLEM")
return GAME_STATE_FIGHT
end
}
}
})
44 changes: 39 additions & 5 deletions assets/scripts/events/act_0/other.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
register_event("MERCHANT", {
name = "A strange figure",
description =
[[!!merchant.jpg
The merchant is a tall, lanky figure draped in a long, tattered coat made of plant fibers and animal hides. Their face is hidden behind a mask made of twisted roots and vines, giving them an unsettling, almost alien appearance.
Despite their strange appearance, the merchant is a shrewd negotiator and a skilled trader. They carry with them a collection of bizarre and exotic items, including plant-based weapons, animal pelts, and strange, glowing artifacts that seem to pulse with an otherworldly energy.
The merchant is always looking for a good deal, and they're not above haggling with potential customers...]],
tags = { "_ACT_0" },
choices = {
{
description = "Trade",
callback = function()
return GAME_STATE_MERCHANT
end
}, {
description = "Pass",
callback = function()
return GAME_STATE_RANDOM
end
}
},
on_end = function(ctx)
return nil
end
})


register_event("RANDOM_ARTIFACT_ACT_0", {
name = "Random Artifact",
description = [[!!artifact_chest.jpg
Expand All @@ -6,7 +36,8 @@ You found a chest with a strange symbol on it. The chest is protected by a stran
tags = { "_ACT_0" },
choices = {
{
description = "Random Artifact " .. highlight_success("Gain 1 Artifact") .. " " .. highlight_warn("Take 5 damage"),
description = "Random Artifact " ..
highlight_success("Gain 1 Artifact") .. " " .. highlight_warn("Take 5 damage"),
callback = function()
local possible = find_artifacts_by_tags({ "_ACT_0" })
local choosen = choose_weighted_by_price(possible)
Expand Down Expand Up @@ -34,7 +65,8 @@ You found a chest with a strange symbol on it. The chest is protected by a stran
tags = { "_ACT_0" },
choices = {
{
description = "Random Artifact " .. highlight_success("Gain 1 Consumeable") .. " " .. highlight_warn("Take 2 damage"),
description = "Random Artifact " ..
highlight_success("Gain 1 Consumeable") .. " " .. highlight_warn("Take 2 damage"),
callback = function()
local possible = fun.iter(find_cards_by_tags({ "_ACT_0" }))
:filter(function(card)
Expand Down Expand Up @@ -161,7 +193,8 @@ You find a room with a strange device in the middle. It seems to be some kind of
tags = { "_ACT_0" },
choices = {
{
description = "50% " .. highlight_success("Gain Artifact & Consumeable") .. " 50% " .. highlight_warn("Take 5 damage"),
description = "50% " ..
highlight_success("Gain Artifact & Consumeable") .. " 50% " .. highlight_warn("Take 5 damage"),
callback = function()
local possible_artifacts = find_artifacts_by_tags({ "_ACT_0" })
local possible_consumeables = fun.iter(find_cards_by_tags({ "_ACT_0" }))
Expand Down Expand Up @@ -200,7 +233,8 @@ You find a old automatic workstation. You are able to get it working again. You
tags = { "_ACT_0" },
choices = {
{
description = "Upgrade a card " .. highlight_success("Upgrade a card") .. " " .. highlight_warn("Take 5 damage"),
description = "Upgrade a card " ..
highlight_success("Upgrade a card") .. " " .. highlight_warn("Take 5 damage"),
callback = function()
local cards = fun.iter(get_cards(PLAYER_ID))
:filter(function(guid)
Expand Down Expand Up @@ -229,4 +263,4 @@ You find a old automatic workstation. You are able to get it working again. You
end
}
}
})
})
14 changes: 10 additions & 4 deletions assets/scripts/events/act_0/start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ As you struggle to gather your bearings, you notice a blinking panel on the wall
description = "Try to find a weapon. " ..
highlight('Find melee weapon') .. " " .. highlight_warn("Take 4 damage"),
callback = function()
deal_damage(PLAYER_ID, PLAYER_ID, 4, true)
give_artifact(
choose_weighted_by_price(find_artifacts_by_tags({ "HND", "M" })), PLAYER_ID
)
Expand All @@ -38,9 +37,16 @@ As you struggle to gather your bearings, you notice a blinking panel on the wall
on_enter = function()
play_music("energetic_orthogonal_expansions")
end,
on_end = function()
actor_set_max_hp(PLAYER_ID, 10)
actor_set_hp(PLAYER_ID, 10)
on_end = function(ctx)
local player_hp = 12

actor_set_max_hp(PLAYER_ID, player_hp)

if ctx.choice == 1 then
actor_set_hp(PLAYER_ID, player_hp - 4)
else
actor_set_hp(PLAYER_ID, player_hp)
end

give_card("BLOCK", PLAYER_ID)
give_card("BLOCK", PLAYER_ID)
Expand Down
19 changes: 11 additions & 8 deletions assets/scripts/story_teller/act_0.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
register_story_teller("_ACT_0", {
active = function()
if #get_event_history() <= 6 then
return 1
end
return 0
-- if #get_event_history() <= 6 then
-- return 1
-- end
--
-- Keep active for now
return 1
end,
decide = function()
local history = get_event_history()
local possible = { }
local possible = {}

-- every 3 events, play a non-combat event
if #get_event_history() % 2 == 0 then
local events = #history - 1;
if events ~= 0 and events % 2 == 0 then
possible = find_events_by_tags({ "_ACT_0" })
else
possible = find_events_by_tags({ "_ACT_0_FIGHT" })
Expand All @@ -20,12 +23,12 @@ register_story_teller("_ACT_0", {

-- filter out events by id that have already been played
possible = fun.iter(possible):filter(function(event)
return not table.contains(history, event.id)
return event == "MERCHANT" or not table.contains(history, event.id)
end):totable()

-- fallback for now
if #possible == 0 then
possible = find_events_by_tags({ "_ACT_0" })
possible = find_events_by_tags({ "_ACT_0_FIGHT" })
end
set_event(possible[math.random(#possible)].id)

Expand Down
Loading

0 comments on commit 15305d9

Please sign in to comment.