diff --git a/.lua-format b/.lua-format
new file mode 100644
index 0000000..2706d05
--- /dev/null
+++ b/.lua-format
@@ -0,0 +1,32 @@
+column_limit: 140
+indent_width: 4
+use_tab: false
+tab_width: 4
+continuation_indent_width: 4
+spaces_before_call: 1
+keep_simple_control_block_one_line: false
+keep_simple_function_one_line: false
+align_args: true
+break_after_functioncall_lp: false
+break_before_functioncall_rp: false
+spaces_inside_functioncall_parens: false
+spaces_inside_functiondef_parens: false
+align_parameter: true
+chop_down_parameter: false
+break_after_functiondef_lp: false
+break_before_functiondef_rp: false
+align_table_field: true
+break_after_table_lb: true
+break_before_table_rb: true
+chop_down_table: false
+chop_down_kv_table: true
+table_sep: ","
+column_table_limit: 0
+extra_sep_at_table_end: false
+spaces_inside_table_braces: true
+break_after_operator: true
+double_quote_to_single_quote: false
+single_quote_to_double_quote: false
+spaces_around_equals_in_field: true
+line_breaks_after_function_body: 1
+line_separator: input
\ No newline at end of file
diff --git a/assets/scripts/artifacts.lua b/assets/scripts/artifacts.lua
index eb168e7..b32d096 100644
--- a/assets/scripts/artifacts.lua
+++ b/assets/scripts/artifacts.lua
@@ -1,167 +1,147 @@
-register_artifact("GIGANTIC_STRENGTH",
- {
- name = "Stone Of Gigantic Strength",
- description = "Double all damage dealt.",
- price = 250,
- order = 0,
- callbacks = {
- on_damage_calc = function(ctx)
- if ctx.target == ctx.owner then
- return ctx.damage * 2
- end
- return nil
- end,
- }
+register_artifact("GIGANTIC_STRENGTH", {
+ name = "Stone Of Gigantic Strength",
+ description = "Double all damage dealt.",
+ price = 250,
+ order = 0,
+ callbacks = {
+ on_damage_calc = function(ctx)
+ if ctx.target == ctx.owner then
+ return ctx.damage * 2
+ end
+ return nil
+ end
}
-);
+});
-register_artifact("REPULSION_STONE",
- {
- name = "Repulsion Stone",
- description = "For each damage taken heal for 2",
- price = 100,
- order = 0,
- callbacks = {
- on_damage = function(ctx)
- if ctx.target == ctx.owner then
- heal(ctx.owner, 2)
- end
- return nil
- end,
- }
+register_artifact("REPULSION_STONE", {
+ name = "Repulsion Stone",
+ description = "For each damage taken heal for 2",
+ price = 100,
+ order = 0,
+ callbacks = {
+ on_damage = function(ctx)
+ if ctx.target == ctx.owner then
+ heal(ctx.owner, 2)
+ end
+ return nil
+ end
}
-);
+});
-register_artifact("RADIANT_SEED",
- {
- name = "Radiant Seed",
- description = "A small glowing seed.",
- price = 140,
- order = 0,
- callbacks = {
- on_pick_up = function(ctx)
- give_card("RADIANT_SEED", ctx.owner)
- return nil
- end,
- }
+register_artifact("RADIANT_SEED", {
+ name = "Radiant Seed",
+ description = "A small glowing seed.",
+ price = 140,
+ order = 0,
+ callbacks = {
+ on_pick_up = function(ctx)
+ give_card("RADIANT_SEED", ctx.owner)
+ return nil
+ end
}
-);
+});
-register_artifact("JUICY_FRUIT",
- {
- name = "Juicy Fruit",
- description = "Tastes good and boosts your HP.",
- price = 80,
- order = 0,
- callbacks = {
- on_pick_up = function(ctx)
- actor_add_max_hp(ctx.owner, 10)
- return nil
- end,
- }
+register_artifact("JUICY_FRUIT", {
+ name = "Juicy Fruit",
+ description = "Tastes good and boosts your HP.",
+ price = 80,
+ order = 0,
+ callbacks = {
+ on_pick_up = function(ctx)
+ actor_add_max_hp(ctx.owner, 10)
+ return nil
+ end
}
-);
+});
-register_artifact("DEFLECTOR_SHIELD",
- {
- name = "Deflector Shield",
- description = "Gain 8 block at the start of combat.",
- price = 50,
- order = 0,
- callbacks = {
- on_player_turn = function(ctx)
- if ctx.round == 0 then
- give_status_effect("BLOCK", ctx.owner, 8)
- end
- return nil
- end,
- }
+register_artifact("DEFLECTOR_SHIELD", {
+ name = "Deflector Shield",
+ description = "Gain 8 block at the start of combat.",
+ price = 50,
+ order = 0,
+ callbacks = {
+ on_player_turn = function(ctx)
+ if ctx.round == 0 then
+ give_status_effect("BLOCK", ctx.owner, 8)
+ end
+ return nil
+ end
}
-);
+});
-register_artifact("SHORT_RADIANCE",
- {
- name = "Short Radiance",
- description = "Apply 1 vulnerable at the start of combat.",
- price = 50,
- order = 0,
- callbacks = {
- on_player_turn = function(ctx)
- if ctx.round == 0 then
- each(function(val)
- give_status_effect("VULNERABLE", val)
- end, pairs(get_opponent_guids(ctx.owner)))
- end
- return nil
- end,
- }
+register_artifact("SHORT_RADIANCE", {
+ name = "Short Radiance",
+ description = "Apply 1 vulnerable at the start of combat.",
+ price = 50,
+ order = 0,
+ callbacks = {
+ on_player_turn = function(ctx)
+ if ctx.round == 0 then
+ each(function(val)
+ give_status_effect("VULNERABLE", val)
+ end, pairs(get_opponent_guids(ctx.owner)))
+ end
+ return nil
+ end
}
-);
+});
-register_artifact("BAG_OF_HOLDING",
- {
- name = "Bag of Holding",
- description = "Start with a additional card at the beginning of combat.",
- price = 50,
- order = 0,
- callbacks = {
- on_player_turn = function(ctx)
- if ctx.owner == PLAYER_ID and ctx.round == 0 then
- player_draw_card(1)
- end
- return nil
- end,
- }
+register_artifact("BAG_OF_HOLDING", {
+ name = "Bag of Holding",
+ description = "Start with a additional card at the beginning of combat.",
+ price = 50,
+ order = 0,
+ callbacks = {
+ on_player_turn = function(ctx)
+ if ctx.owner == PLAYER_ID and ctx.round == 0 then
+ player_draw_card(1)
+ end
+ return nil
+ end
}
-);
+});
-register_artifact("SPIKED_PLANT",
- {
- name = "Spiked Plant",
- description = "Deal 2 damage back to enemy attacks.",
- price = 50,
- order = 0,
- callbacks = {
- on_damage = function(ctx)
- if ctx.source ~= ctx.owner and ctx.owner == ctx.target then
- deal_damage(ctx.owner, ctx.source, 2)
- end
- return nil
- end,
- }
+register_artifact("SPIKED_PLANT", {
+ name = "Spiked Plant",
+ description = "Deal 2 damage back to enemy attacks.",
+ price = 50,
+ order = 0,
+ callbacks = {
+ on_damage = function(ctx)
+ if ctx.source ~= ctx.owner and ctx.owner == ctx.target then
+ deal_damage(ctx.owner, ctx.source, 2)
+ end
+ return nil
+ end
}
-);
+});
-register_artifact("GOLD_CONVERTER",
- {
- name = "Gold Converter",
- description = "Gain 10 extra gold for each killed enemy.",
- price = 50,
- order = 0,
- callbacks = {
- on_actor_die = function(ctx)
- if ctx.owner == PLAYER_ID and ctx.owner == ctx.source then
- give_player_gold(10)
- end
- return nil
- end,
- }
+register_artifact("GOLD_CONVERTER", {
+ name = "Gold Converter",
+ description = "Gain 10 extra gold for each killed enemy.",
+ price = 50,
+ order = 0,
+ callbacks = {
+ on_actor_die = function(ctx)
+ if ctx.owner == PLAYER_ID and ctx.owner == ctx.source then
+ give_player_gold(10)
+ end
+ return nil
+ end
}
-);
+});
-register_artifact("HOLY_GRAIL",
- {
- name = "Holy Grail",
- description = "At the start of each turn, heal for 2 HP for each card in your hand.",
- price = 150,
- order = 100, -- Evaluate late so that other draw artifacts have priority.
- callbacks = {
- on_player_turn = function(ctx)
- local num_cards = #get_cards(ctx.owner)
- local heal_amount = num_cards * 2
- heal(ctx.owner, ctx.owner, heal_amount)
- return nil
- end,
- }
+register_artifact("HOLY_GRAIL", {
+ name = "Holy Grail",
+ description = "At the start of each turn, heal for 2 HP for each card in your hand.",
+ price = 150,
+ order = 100, -- Evaluate late so that other draw artifacts have priority.
+ callbacks = {
+ on_player_turn = function(ctx)
+ local num_cards = #get_cards(ctx.owner)
+ local heal_amount = num_cards * 2
+ heal(ctx.owner, ctx.owner, heal_amount)
+ return nil
+ end
}
-);
\ No newline at end of file
+});
diff --git a/assets/scripts/cards.lua b/assets/scripts/cards.lua
index 14ec09e..fc1029b 100644
--- a/assets/scripts/cards.lua
+++ b/assets/scripts/cards.lua
@@ -2,225 +2,213 @@ function highlight(val)
return text_underline(text_bold("[" .. tostring(val) .. "]"))
end
-register_card("KILL",
- {
- name = "Kill",
- description = "Debug Card",
- state = function(ctx)
+register_card("KILL", {
+ name = "Kill",
+ description = "Debug Card",
+ state = function(ctx)
+ return nil
+ end,
+ max_level = 0,
+ color = "#2f3e46",
+ need_target = true,
+ point_cost = 0,
+ price = -1,
+ callbacks = {
+ on_cast = function(ctx)
+ deal_damage(ctx.caster, ctx.target, 1000, true)
return nil
- end,
- max_level = 0,
- color = "#2f3e46",
- need_target = true,
- point_cost = 0,
- price = -1,
- callbacks = {
- on_cast = function(ctx)
- deal_damage(ctx.caster, ctx.target, 1000, true)
- return nil
- end,
- }
+ end
}
-);
+});
-register_card("MELEE_HIT",
- {
- name = "Melee Hit",
- description = "Use your bare hands to deal 5 (+3 for each upgrade) damage.",
- state = function(ctx)
- return "Use your bare hands to deal " .. highlight(5 + ctx.level * 3) .. " damage."
- end,
- max_level = 1,
- color = "#2f3e46",
- need_target = true,
- point_cost = 1,
- price = 30,
- callbacks = {
- on_cast = function(ctx)
- deal_damage(ctx.caster, ctx.target, 5 + ctx.level * 3)
- return nil
- end,
- }
- }
-);
-
-register_card("RUPTURE",
- {
- name = "Rupture",
- description = "Inflict your enemy with " .. highlight("Vulnerable") .. ".",
- state = function(ctx)
+register_card("MELEE_HIT", {
+ name = "Melee Hit",
+ description = "Use your bare hands to deal 5 (+3 for each upgrade) damage.",
+ state = function(ctx)
+ return "Use your bare hands to deal " .. highlight(5 + ctx.level * 3) .. " damage."
+ end,
+ max_level = 1,
+ color = "#2f3e46",
+ need_target = true,
+ point_cost = 1,
+ price = 30,
+ callbacks = {
+ on_cast = function(ctx)
+ deal_damage(ctx.caster, ctx.target, 5 + ctx.level * 3)
return nil
- end,
- max_level = 0,
- color = "#cf532d",
- need_target = true,
- point_cost = 1,
- price = 30,
- callbacks = {
- on_cast = function(ctx)
- give_status_effect("VULNERABLE", ctx.target)
- return nil
- end,
- }
+ end
}
-);
+});
-register_card("BLOCK",
- {
- name = "Block",
- description = "Shield yourself and gain 5 " .. highlight("block") .. ".",
- state = function(ctx)
- return "Shield yourself and gain " .. highlight(5 + ctx.level * 3) .. " block."
- end,
- max_level = 1,
- color = "#219ebc",
- need_target = false,
- point_cost = 1,
- price = 40,
- callbacks = {
- on_cast = function(ctx)
- give_status_effect("BLOCK", ctx.caster, 5 + ctx.level * 3)
- return nil
- end,
- }
+register_card("RUPTURE", {
+ name = "Rupture",
+ description = "Inflict your enemy with " .. highlight("Vulnerable") .. ".",
+ state = function(ctx)
+ return "Inflict your enemy with " .. highlight(tostring(1 + ctx.level) .. " Vulnerable") .. "."
+ end,
+ max_level = 3,
+ color = "#cf532d",
+ need_target = true,
+ point_cost = 1,
+ price = 30,
+ callbacks = {
+ on_cast = function(ctx)
+ give_status_effect("VULNERABLE", ctx.target, 1 + ctx.level)
+ return nil
+ end
}
-);
+});
-register_card("BLOCK_SPIKES",
- {
- name = "Block Spikes",
- description = "Transforms " .. highlight("block") .. " to damage.",
- state = function(ctx)
- -- Fetch all BLOCK instances of owner
- local blocks = fun.iter(pairs(get_actor_status_effects(ctx.owner)))
- :map(get_status_effect_instance)
- :filter(function(val) return val.type_id == "BLOCK" end)
- :totable()
+register_card("BLOCK", {
+ name = "Block",
+ description = "Shield yourself and gain 5 " .. highlight("block") .. ".",
+ state = function(ctx)
+ return "Shield yourself and gain " .. highlight(5 + ctx.level * 3) .. " block."
+ end,
+ max_level = 1,
+ color = "#219ebc",
+ need_target = false,
+ point_cost = 1,
+ price = 40,
+ callbacks = {
+ on_cast = function(ctx)
+ give_status_effect("BLOCK", ctx.caster, 5 + ctx.level * 3)
+ return nil
+ end
+ }
+});
+
+register_card("BLOCK_SPIKES", {
+ name = "Block Spikes",
+ description = "Transforms " .. highlight("block") .. " to damage.",
+ state = function(ctx)
+ -- Fetch all BLOCK instances of owner
+ local blocks = fun.iter(pairs(get_actor_status_effects(ctx.owner))):map(get_status_effect_instance):filter(function(val)
+ return val.type_id == "BLOCK"
+ end):totable()
+
+ -- Sum stacks to get damage
+ local damage = fun.iter(pairs(blocks)):reduce(function(acc, val)
+ return acc + val.stacks
+ end, 0)
+
+ return "Transforms block to " .. highlight(damage) .. " damage."
+ end,
+ max_level = 0,
+ color = "#895cd6",
+ need_target = true,
+ point_cost = 1,
+ price = 100,
+ callbacks = {
+ on_cast = function(ctx)
+ -- Fetch all BLOCK instances of caster
+ local blocks = fun.iter(pairs(get_actor_status_effects(ctx.caster))):map(get_status_effect_instance):filter(function(val)
+ return val.type_id == "BLOCK"
+ end):totable()
-- Sum stacks to get damage
- local damage = fun.iter(pairs(blocks))
- :reduce(function(acc, val) return acc + val.stacks end, 0)
+ local damage = fun.iter(pairs(blocks)):reduce(function(acc, val)
+ return acc + val.stacks
+ end, 0)
- return "Transforms block to " .. highlight(damage) .. " damage."
- end,
- max_level = 0,
- color = "#895cd6",
- need_target = true,
- point_cost = 1,
- price = 100,
- callbacks = {
- on_cast = function(ctx)
- -- Fetch all BLOCK instances of caster
- local blocks = fun.iter(pairs(get_actor_status_effects(ctx.caster)))
- :map(get_status_effect_instance)
- :filter(function(val) return val.type_id == "BLOCK" end)
- :totable()
+ if damage == 0 then
+ return "No block status effect present!"
+ end
- -- Sum stacks to get damage
- local damage = fun.iter(pairs(blocks))
- :reduce(function(acc, val) return acc + val.stacks end, 0)
+ -- Remove BLOCKs
+ fun.iter(pairs(blocks)):for_each(function(val)
+ remove_status_effect(val.guid)
+ end)
- if damage == 0 then
- return "No block status effect present!"
- end
+ -- Deal Damage
+ deal_damage(ctx.caster, ctx.target, damage)
- -- Remove BLOCKs
- fun.iter(pairs(blocks)):for_each(function(val) remove_status_effect(val.guid) end)
-
- -- Deal Damage
- deal_damage(ctx.caster, ctx.target, damage)
-
- return nil
- end,
- }
- }
-);
-
-register_card("SHIELD_BASH",
- {
- name = "Shield Bash",
- description = "Deal 4 (+2 for each upgrade) damage to the enemy and gain " .. highlight("block") .. " status effect equal to the damage dealt.",
- state = function(ctx)
- return "Deal " .. highlight(4 + ctx.level * 2) .. " damage to the enemy and gain " .. highlight("block") .. " status effect equal to the damage dealt."
- end,
- max_level = 1,
- color = "#ff5722",
- need_target = true,
- point_cost = 1,
- price = 40,
- callbacks = {
- on_cast = function(ctx)
- local damage = deal_damage(ctx.caster, 4 + ctx.level * 2)
- give_status_effect("BLOCK", ctx.caster, damage)
- return nil
- end,
- }
- }
-);
-
-register_card("FEAR",
- {
- name = "Fear",
- description = "Inflict " .. highlight("fear") .. " on the target, causing them to miss their next turn.",
- state = function(ctx)
return nil
- end,
- max_level = 0,
- color = "#725e9c",
- need_target = true,
- point_cost = 2,
- price = 80,
- callbacks = {
- on_cast = function(ctx)
- give_status_effect("FEAR", ctx.target)
- return nil
- end,
- }
+ end
}
-);
+});
-register_card("RADIANT_SEED",
- {
- name = "Radiant Seed",
- description = "Inflict 10 (+2 for each upgrade) damage to all enemies, but also causes 5 (-2 for each upgrade) damage to the caster.",
- state = function(ctx)
- return "Inflict " .. highlight(10 + ctx.level * 2) .. " damage to all enemies, but also causes " .. highlight(5 - ctx.level * 2) .. " damage to the caster."
- end,
- max_level = 1,
- color = "#82c93e",
- need_target = false,
- point_cost = 2,
- price = 120,
- callbacks = {
- on_cast = function(ctx)
- -- Deal damage to caster without any modifiers applying
- deal_damage(ctx.caster, ctx.caster, 5 - ctx.level * 2, true)
- -- Deal damage to opponents
- deal_damage_multi(ctx.caster, get_opponent_guids(ctx.caster), 10 + ctx.level * 2)
- return nil
- end,
- }
+register_card("SHIELD_BASH", {
+ name = "Shield Bash",
+ description = "Deal 4 (+2 for each upgrade) damage to the enemy and gain " .. highlight("block") ..
+ " status effect equal to the damage dealt.",
+ state = function(ctx)
+ return "Deal " .. highlight(4 + ctx.level * 2) .. " damage to the enemy and gain " .. highlight("block") ..
+ " status effect equal to the damage dealt."
+ end,
+ max_level = 1,
+ color = "#ff5722",
+ need_target = true,
+ point_cost = 1,
+ price = 40,
+ callbacks = {
+ on_cast = function(ctx)
+ local damage = deal_damage(ctx.caster, 4 + ctx.level * 2)
+ give_status_effect("BLOCK", ctx.caster, damage)
+ return nil
+ end
}
-);
+});
-register_card("BERSERKER_RAGE",
- {
- name = "Berserker Rage",
- description = "Gain " .. highlight("3 energy") .. ", but take 30% (-10% per level) of your HP as damage.",
- state = function(ctx)
- return "Gain " .. highlight("3 energy") .. ", but take " .. highlight(tostring(30 - ctx.level * 10) .. "%") .. " (" .. tostring(get_player().hp * (0.3 - ctx.level * 0.1)) .. ") of your HP as damage."
- end,
- max_level = 0,
- color = "#d8a448",
- need_target = false,
- point_cost = 0,
- price = 100,
- callbacks = {
- on_cast = function(ctx)
- player_give_action_points(3)
- deal_damage(ctx.caster, ctx.caster, get_player().hp * (0.3 - ctx.level * 0.1), true)
- return nil
- end,
- }
+register_card("FEAR", {
+ name = "Fear",
+ description = "Inflict " .. highlight("fear") .. " on the target, causing them to miss their next turn.",
+ state = function(ctx)
+ return nil
+ end,
+ max_level = 0,
+ color = "#725e9c",
+ need_target = true,
+ point_cost = 2,
+ price = 80,
+ callbacks = {
+ on_cast = function(ctx)
+ give_status_effect("FEAR", ctx.target)
+ return nil
+ end
}
-);
\ No newline at end of file
+});
+
+register_card("RADIANT_SEED", {
+ name = "Radiant Seed",
+ description = "Inflict 10 (+2 for each upgrade) damage to all enemies, but also causes 5 (-2 for each upgrade) damage to the caster.",
+ state = function(ctx)
+ return "Inflict " .. highlight(10 + ctx.level * 2) .. " damage to all enemies, but also causes " .. highlight(5 - ctx.level * 2) ..
+ " damage to the caster."
+ end,
+ max_level = 1,
+ color = "#82c93e",
+ need_target = false,
+ point_cost = 2,
+ price = 120,
+ callbacks = {
+ on_cast = function(ctx)
+ -- Deal damage to caster without any modifiers applying
+ deal_damage(ctx.caster, ctx.caster, 5 - ctx.level * 2, true)
+ -- Deal damage to opponents
+ deal_damage_multi(ctx.caster, get_opponent_guids(ctx.caster), 10 + ctx.level * 2)
+ return nil
+ end
+ }
+});
+
+register_card("BERSERKER_RAGE", {
+ name = "Berserker Rage",
+ description = "Gain " .. highlight("3 energy") .. ", but take 30% (-10% per level) of your HP as damage.",
+ state = function(ctx)
+ return "Gain " .. highlight("3 energy") .. ", but take " .. highlight(tostring(30 - ctx.level * 10) .. "%") .. " (" ..
+ tostring(get_player().hp * (0.3 - ctx.level * 0.1)) .. ") of your HP as damage."
+ end,
+ max_level = 0,
+ color = "#d8a448",
+ need_target = false,
+ point_cost = 0,
+ price = 100,
+ callbacks = {
+ on_cast = function(ctx)
+ player_give_action_points(3)
+ deal_damage(ctx.caster, ctx.caster, get_player().hp * (0.3 - ctx.level * 0.1), true)
+ return nil
+ end
+ }
+});
diff --git a/assets/scripts/enemies.lua b/assets/scripts/enemies.lua
index 9e550c3..b5007c7 100644
--- a/assets/scripts/enemies.lua
+++ b/assets/scripts/enemies.lua
@@ -10,141 +10,130 @@ function cast_random(guid, target)
end
end
-register_enemy(
- "DUMMY",
- {
- name = "Dummy",
- description = "End me...",
- look = "DUM",
- color = "#deeb6a",
- initial_hp = 100,
- max_hp = 100,
- callbacks = {
- on_turn = function(ctx)
- return nil
- end
- }
+register_enemy("DUMMY", {
+ name = "Dummy",
+ description = "End me...",
+ look = "DUM",
+ color = "#deeb6a",
+ initial_hp = 100,
+ max_hp = 100,
+ callbacks = {
+ on_turn = function(ctx)
+ return nil
+ end
}
-)
+})
-register_enemy(
- "RUST_MITE",
- {
- name = "Rust Mite",
- description = "Loves to eat metal.",
- look = "/v\\",
- color = "#e6e65a",
- initial_hp = 22,
- max_hp = 22,
- gold = 10,
- intend = function(ctx)
+register_enemy("RUST_MITE", {
+ name = "Rust Mite",
+ description = "Loves to eat metal.",
+ look = "/v\\",
+ color = "#e6e65a",
+ initial_hp = 22,
+ max_hp = 22,
+ gold = 10,
+ intend = function(ctx)
+ if ctx.round % 4 == 0 then
+ return "Gather strength"
+ end
+
+ return "Deal " .. highlight(6) .. " damage"
+ end,
+ callbacks = {
+ on_turn = function(ctx)
if ctx.round % 4 == 0 then
- return "Gather strength"
- end
-
- return "Deal " .. highlight(6) .. " damage"
- end,
- callbacks = {
- on_turn = function(ctx)
- if ctx.round % 4 == 0 then
- give_status_effect("RITUAL", ctx.guid)
- else
- deal_damage(ctx.guid, PLAYER_ID, 6)
- end
-
- return nil
- end
- }
- }
-)
-
-register_enemy(
- "CLEAN_BOT",
- {
- name = "Cleaning Bot",
- description = "It never stopped cleaning...",
- look = [[ \_/
-(* *)
- )#(]],
- color = "#32a891",
- initial_hp = 25,
- max_hp = 25,
- gold = 15,
- intend = function(ctx)
- local self = get_actor(ctx.guid)
- if self.hp <= 8 then
- return "Block " .. highlight(4)
- end
-
- return "Deal " .. highlight(7) .. " damage"
- end,
- callbacks = {
- on_player_turn = function(ctx)
- local self = get_actor(ctx.guid)
-
- if self.hp <= 8 then
- give_status_effect("BLOCK", ctx.guid, 4)
- end
- end,
- on_turn = function(ctx)
- local self = get_actor(ctx.guid)
-
- if self.hp > 8 then
- deal_damage(ctx.guid, PLAYER_ID, 7)
- end
-
- return nil
- end
- }
- }
-)
-
-register_enemy(
- "SHADOW_ASSASSIN",
- {
- name = "Shadow Assassin",
- description = "A master of stealth and deception.",
- look = "???",
- color = "#6c5b7b",
- initial_hp = 20,
- max_hp = 20,
- gold = 30,
- intend = function(ctx)
- local bleeds = fun.iter(pairs(get_actor_status_effects(PLAYER_ID)))
- :map(get_status_effect_instance)
- :filter(function(val) return val.type_id == "BLEED" end)
- :totable()
-
- if #bleeds > 0 then
- return "Deal " .. highlight(10) .. " damage"
- elseif ctx.round % 3 == 0 then
- return "Inflict bleed"
+ give_status_effect("RITUAL", ctx.guid)
else
- return "Deal " .. highlight(5) .. " damage"
+ deal_damage(ctx.guid, PLAYER_ID, 6)
end
return nil
- end,
- callbacks = {
- on_turn = function(ctx)
- -- Count bleed stacks
- local bleeds = fun.iter(pairs(get_actor_status_effects(PLAYER_ID)))
- :map(get_status_effect_instance)
- :filter(function(val) return val.type_id == "BLEED" end)
- :totable()
-
- if #bleeds > 0 then -- If bleeding do more damage
- deal_damage(ctx.guid, PLAYER_ID, 10)
- elseif ctx.round % 3 == 0 then -- Try to bleed every 2 rounds with 3 dmg
- if deal_damage(ctx.guid, PLAYER_ID, 3) > 0 then
- give_status_effect("BLEED", PLAYER_ID, 2)
- end
- else -- Just hit with 5 damage
- deal_damage(ctx.guid, PLAYER_ID, 5)
- end
-
- return nil
- end
- }
+ end
}
-)
\ No newline at end of file
+})
+
+register_enemy("CLEAN_BOT", {
+ name = "Cleaning Bot",
+ description = "It never stopped cleaning...",
+ look = [[ \_/
+(* *)
+ )#(]],
+ color = "#32a891",
+ initial_hp = 25,
+ max_hp = 25,
+ gold = 15,
+ intend = function(ctx)
+ local self = get_actor(ctx.guid)
+ if self.hp <= 8 then
+ return "Block " .. highlight(4)
+ end
+
+ return "Deal " .. highlight(7) .. " damage"
+ end,
+ callbacks = {
+ on_player_turn = function(ctx)
+ local self = get_actor(ctx.guid)
+
+ if self.hp <= 8 then
+ give_status_effect("BLOCK", ctx.guid, 4)
+ end
+ end,
+ on_turn = function(ctx)
+ local self = get_actor(ctx.guid)
+
+ if self.hp > 8 then
+ deal_damage(ctx.guid, PLAYER_ID, 7)
+ end
+
+ return nil
+ end
+ }
+})
+
+register_enemy("SHADOW_ASSASSIN", {
+ name = "Shadow Assassin",
+ description = "A master of stealth and deception.",
+ look = "???",
+ color = "#6c5b7b",
+ initial_hp = 20,
+ max_hp = 20,
+ gold = 30,
+ intend = function(ctx)
+ local bleeds = fun.iter(pairs(get_actor_status_effects(PLAYER_ID))):map(get_status_effect_instance):filter(function(val)
+ return val.type_id == "BLEED"
+ end):totable()
+
+ if #bleeds > 0 then
+ return "Deal " .. highlight(10) .. " damage"
+ elseif ctx.round % 3 == 0 then
+ return "Inflict bleed"
+ else
+ return "Deal " .. highlight(5) .. " damage"
+ end
+
+ return nil
+ end,
+ callbacks = {
+ on_turn = function(ctx)
+ -- Count bleed stacks
+ local bleeds = fun.iter(pairs(get_actor_status_effects(PLAYER_ID))):map(get_status_effect_instance):filter(function(val)
+ return val.type_id == "BLEED"
+ end):totable()
+
+ if #bleeds > 0 then
+ -- If bleeding do more damage
+ deal_damage(ctx.guid, PLAYER_ID, 10)
+ elseif ctx.round % 3 == 0 then
+ -- Try to bleed every 2 rounds with 3 dmg
+ if deal_damage(ctx.guid, PLAYER_ID, 3) > 0 then
+ give_status_effect("BLEED", PLAYER_ID, 2)
+ end
+ else
+ -- Just hit with 5 damage
+ deal_damage(ctx.guid, PLAYER_ID, 5)
+ end
+
+ return nil
+ end
+ }
+})
diff --git a/assets/scripts/events.lua b/assets/scripts/events.lua
index a05878f..741e6c7 100644
--- a/assets/scripts/events.lua
+++ b/assets/scripts/events.lua
@@ -1,39 +1,34 @@
--
-- Base Events
--
-
-register_event(
- "MERCHANT",
- {
- name = "A strange figure",
- description = [[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.
+register_event("MERCHANT", {
+ name = "A strange figure",
+ description = [[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...]],
- choices = {
- {
- description = "Trade",
- callback = function()
- return GAME_STATE_MERCHANT
- end
- },
- {
- description = "Pass",
- callback = function()
- return GAME_STATE_RANDOM
- end
- }
- },
- on_end = function(choice) return nil end,
+ choices = {
+ {
+ description = "Trade",
+ callback = function()
+ return GAME_STATE_MERCHANT
+ end
+ }, {
+ description = "Pass",
+ callback = function()
+ return GAME_STATE_RANDOM
+ end
}
-)
+ },
+ on_end = function(choice)
+ return nil
+ end
+})
-register_event(
- "START",
- {
- name = "Waking up...",
- description = [[
+register_event("START", {
+ name = "Waking up...",
+ description = [[
```
█ █░ ▄▄▄ ██ ▄█▀▓█████ █ ██ ██▓███
@@ -57,74 +52,78 @@ You try to remember how you ended up here, but your memories are hazy and fragme
As you struggle to gather your bearings, you notice a blinking panel on the wall, with the words *"Cryo Sleep Malfunction"* displayed in bold letters. It seems that the system has finally detected the error that caused your prolonged slumber and triggered your awakening.
**Shortly after you realize that you are not alone...**]],
- choices = {
- {
- description = "Try to escape the facility before it finds you...",
- callback = function()
- -- Try to escape
- if math.random() < 0.5 then
- set_event("FIRST_OUTSIDE")
- return GAME_STATE_EVENT
- end
+ choices = {
+ {
+ description = "Try to escape the facility before it finds you...",
+ callback = function()
+ -- Try to escape
+ if math.random() < 0.5 then
+ set_event("FIRST_OUTSIDE")
+ return GAME_STATE_EVENT
+ end
- -- Let OnEnd handle the state change
- return nil
- end
- },
- {
- description = "Gather your strength and attack it!",
- callback = function() return nil end
- }
- },
- on_enter = function()
- play_music("energetic_orthogonal_expansions")
+ -- Let OnEnd handle the state change
+ return nil
+ end
+ }, {
+ description = "Gather your strength and attack it!",
+ callback = function()
+ return nil
+ end
+ }
+ },
+ on_enter = function()
+ play_music("energetic_orthogonal_expansions")
- -- Give the player it's start cards
- give_card("MELEE_HIT", PLAYER_ID)
- give_card("MELEE_HIT", PLAYER_ID)
- give_card("MELEE_HIT", PLAYER_ID)
- give_card("RUPTURE", PLAYER_ID)
- give_card("BLOCK", PLAYER_ID)
- give_artifact(get_random_artifact_type(150), PLAYER_ID)
- end,
- on_end = function()
- return GAME_STATE_RANDOM
- end,
- }
-)
+ -- Give the player it's start cards
+ give_card("MELEE_HIT", PLAYER_ID)
+ give_card("MELEE_HIT", PLAYER_ID)
+ give_card("MELEE_HIT", PLAYER_ID)
+ give_card("MELEE_HIT", PLAYER_ID)
+ give_card("MELEE_HIT", PLAYER_ID)
+
+ give_card("RUPTURE", PLAYER_ID)
+
+ give_card("BLOCK", PLAYER_ID)
+ give_card("BLOCK", PLAYER_ID)
+ give_card("BLOCK", PLAYER_ID)
+
+ give_artifact(get_random_artifact_type(150), PLAYER_ID)
+ end,
+ on_end = function()
+ return GAME_STATE_RANDOM
+ end
+})
--
-- Stage 1 Entrance
--
-register_event(
- "FIRST_OUTSIDE",
- {
- name = "Outside",
- description = [[You finally find a way leading to the outside, a narrow tunnel that winds its way through the thick layer of earth and rock above the facility. The tunnel is cramped and claustrophobic, and you have to crawl on your hands and knees for what feels like hours.
+register_event("FIRST_OUTSIDE", {
+ name = "Outside",
+ description = [[You finally find a way leading to the outside, a narrow tunnel that winds its way through the thick layer of earth and rock above the facility. The tunnel is cramped and claustrophobic, and you have to crawl on your hands and knees for what feels like hours.
As you near the end of the tunnel, you feel a surge of excitement mixed with fear. What will you find on the other side? Will there be other survivors, or only mutated creatures and plants?
Finally, you emerge into the open air, blinking in the bright sunlight. The landscape that stretches out before you is both familiar and alien, a mix of twisted and mutated plant life, towering rock formations, and ruined remnants of the old world.
You take a deep breath of the fresh air, feeling the warmth of the sun on your face. You know that the journey ahead will be long and perilous, but you're determined to explore this new world and uncover its secrets. **The adventure has only just begun.**]],
- choices = {
- {
- description = "Go...",
- callback = function() return nil end
- }
- },
- on_end = function()
- return GAME_STATE_RANDOM
- end,
- }
-)
-
-register_event(
- "THE_WASTELAND",
+ choices = {
{
- name = "The Wasteland",
- description = [[
+ description = "Go...",
+ callback = function()
+ return nil
+ end
+ }
+ },
+ on_end = function()
+ return GAME_STATE_RANDOM
+ end
+})
+
+register_event("THE_WASTELAND", {
+ name = "The Wasteland",
+ description = [[
```
|==| ~
_.,-*~'^'~*-,._ ( ~ _.,-*~'^'~*-,._ ~ (())
@@ -137,23 +136,22 @@ register_event(
You finally find a way leading to the outside, and with a deep breath, you step out into the unforgiving wasteland.
The scorching sun beats down on you as the sand whips against your skin, a reminder of the horrors that have befallen the world. In the distance, the remains of once-great cities jut up from the ground like jagged teeth, now nothing more than crumbling ruins. The air is thick with the acrid smell of decay and the oppressive silence is only broken by the occasional howl of some mutated creature. As you take your first steps into this new world, you realize that survival will not be easy, and that the journey ahead will be fraught with danger at every turn...]],
- choices = {
- {
- description = "Go...",
- callback = function() return nil end
- }
- },
- on_end = function()
- return GAME_STATE_RANDOM
- end,
- }
-)
-
-register_event(
- "THE_CORE",
+ choices = {
{
- name = "The Wasteland",
- description = [[
+ description = "Go...",
+ callback = function()
+ return nil
+ end
+ }
+ },
+ on_end = function()
+ return GAME_STATE_RANDOM
+ end
+})
+
+register_event("THE_CORE", {
+ name = "The Wasteland",
+ description = [[
```
________ ______
/_ __/ /_ ___ / ____/___ ________
@@ -165,33 +163,33 @@ register_event(
You finally find a way you thought would lead to the outside, only to discover that you're still inside the massive facility known as "The Core."
As you step out of the cryo facility, the eerie silence is broken by the sound of metal scraping against metal and distant whirring of malfunctioning machinery. The flickering lights and sparks from faulty wires cast a sickly glow on the cold metal walls. You realize that this place is not as deserted as you initially thought, and the unsettling feeling in your gut only grows stronger as you make your way through the dimly lit corridors, surrounded by the echoes of your own footsteps and the sound of flickering computer screens.]],
- choices = {
- {
- description = "Go...",
- callback = function() return nil end
- }
- },
- on_end = function()
- return GAME_STATE_RANDOM
- end,
- }
-)
-
-register_event(
- "BIO_KINGDOM",
+ choices = {
{
- name = "Bio Kingdom",
- description = [[You finally find a way leading to the outside, and step out of the cryo facility into a world you no longer recognize.
+ description = "Go...",
+ callback = function()
+ return nil
+ end
+ }
+ },
+ on_end = function()
+ return GAME_STATE_RANDOM
+ end
+})
+
+register_event("BIO_KINGDOM", {
+ name = "Bio Kingdom",
+ description = [[You finally find a way leading to the outside, and step out of the cryo facility into a world you no longer recognize.
The air is thick with humidity and the sounds of the jungle are overwhelming. Strange, mutated plants tower over you, their vines twisting and tangling around each other in a macabre dance. The colors of the leaves and flowers are sickly, a greenish hue that reminds you of illness rather than life. The ruins of buildings are visible in the distance, swallowed up by the overgrowth. You can hear the chirping and buzzing of insects, but it's mixed with something else - something that sounds almost like whispers or moans. The "jungle" seems to be alive, but not in any way that you would have imagined.]],
- choices = {
- {
- description = "Go...",
- callback = function() return nil end
- }
- },
- on_end = function()
- return GAME_STATE_RANDOM
- end,
+ choices = {
+ {
+ description = "Go...",
+ callback = function()
+ return nil
+ end
}
-)
\ No newline at end of file
+ },
+ on_end = function()
+ return GAME_STATE_RANDOM
+ end
+})
diff --git a/assets/scripts/events_util.lua b/assets/scripts/events_util.lua
index 17851d4..60f915e 100644
--- a/assets/scripts/events_util.lua
+++ b/assets/scripts/events_util.lua
@@ -11,9 +11,11 @@ function create_artifact_choice(artifacts, options)
end
}
end):totable()
- choices[#choices+1] = {
+ choices[#choices + 1] = {
description = "Skip...",
- callback = function() return nil end
+ callback = function()
+ return nil
+ end
}
local def = {
@@ -22,7 +24,7 @@ function create_artifact_choice(artifacts, options)
choices = choices,
on_end = function()
return GAME_STATE_RANDOM
- end,
+ end
}
if options ~= nil then
@@ -57,9 +59,11 @@ function create_card_choice(cards, options)
end
}
end):totable()
- choices[#choices+1] = {
+ choices[#choices + 1] = {
description = "Skip...",
- callback = function() return nil end
+ callback = function()
+ return nil
+ end
}
local def = {
@@ -68,7 +72,7 @@ function create_card_choice(cards, options)
choices = choices,
on_end = function()
return GAME_STATE_RANDOM
- end,
+ end
}
if options ~= nil then
@@ -88,4 +92,4 @@ function create_card_choice(cards, options)
register_event(id, def)
return id
-end
\ No newline at end of file
+end
diff --git a/assets/scripts/status_effects.lua b/assets/scripts/status_effects.lua
index 0b108ed..efa0bd3 100644
--- a/assets/scripts/status_effects.lua
+++ b/assets/scripts/status_effects.lua
@@ -1,7 +1,6 @@
--
-- Negative Status Effects
--
-
register_status_effect("WEAKEN", {
name = "Weaken",
description = "Weakens damage for each stack",
@@ -19,7 +18,7 @@ register_status_effect("WEAKEN", {
return ctx.damage - ctx.stacks * 2
end
return ctx.damage
- end,
+ end
}
})
@@ -40,7 +39,7 @@ register_status_effect("VULNERABLE", {
return ctx.damage * (1.0 + 0.25 * ctx.stacks)
end
return ctx.damage
- end,
+ end
}
})
@@ -59,7 +58,7 @@ register_status_effect("BURN", {
on_turn = function(ctx)
deal_damage(ctx.guid, ctx.owner, ctx.stacks * 2, true)
return nil
- end,
+ end
}
})
@@ -84,7 +83,7 @@ register_status_effect("STRENGTH", {
return ctx.damage + ctx.stacks
end
return ctx.damage
- end,
+ end
}
})
@@ -107,7 +106,7 @@ register_status_effect("BLOCK", {
return ctx.damage - ctx.stacks
end
return ctx.damage
- end,
+ end
}
})
@@ -126,7 +125,7 @@ register_status_effect("RITUAL", {
on_player_turn = function(ctx)
local guid = give_status_effect("STRENGTH", ctx.owner)
set_status_effect_stacks(guid, 3 + ctx.stacks)
- end,
+ end
}
})
@@ -144,7 +143,7 @@ register_status_effect("FEAR", {
callbacks = {
on_turn = function(ctx)
return true
- end,
+ end
}
})
@@ -162,6 +161,6 @@ register_status_effect("BLEED", {
callbacks = {
on_turn = function(ctx)
return true
- end,
+ end
}
})
diff --git a/assets/scripts/story_teller.lua b/assets/scripts/story_teller.lua
index 1fd239e..5688d5e 100644
--- a/assets/scripts/story_teller.lua
+++ b/assets/scripts/story_teller.lua
@@ -49,13 +49,7 @@ After some effort, you manage to open the door and find yourself in a small room
-- Stage 1
--
-stage_2 = {
- fights = {
- { "RUST_MITE", "RUST_MITE", "RUST_MITE" },
- { "SHADOW_ASSASSIN", "SHADOW_ASSASSIN" },
- { "SHADOW_ASSASSIN" }
- }
-}
+stage_2 = { fights = { { "RUST_MITE", "RUST_MITE", "RUST_MITE" }, { "SHADOW_ASSASSIN", "SHADOW_ASSASSIN" }, { "SHADOW_ASSASSIN" } } }
register_story_teller("STAGE_1", {
active = function(ctx)
@@ -127,4 +121,4 @@ register_story_teller("STAGE_3", {
return GAME_STATE_FIGHT
end
-})
\ No newline at end of file
+})
diff --git a/docs/LIFECYCLE.md b/docs/LIFECYCLE.md
new file mode 100644
index 0000000..d5d108c
--- /dev/null
+++ b/docs/LIFECYCLE.md
@@ -0,0 +1,5 @@
+# Lifecycle
+
+## Round
+
+
\ No newline at end of file
diff --git a/docs/LUA_API_DOCS.md b/docs/LUA_API_DOCS.md
index f042f02..e69de29 100644
--- a/docs/LUA_API_DOCS.md
+++ b/docs/LUA_API_DOCS.md
@@ -1,1207 +0,0 @@
-# End Of Eden Lua Docs
-## Index
-
-- [Game Constants](#game-constants)
-- [Utility](#utility)
-- [Styling](#styling)
-- [Logging](#logging)
-- [Audio](#audio)
-- [Game State](#game-state)
-- [Actor Operations](#actor-operations)
-- [Artifact Operations](#artifact-operations)
-- [Status Effect Operations](#status-effect-operations)
-- [Card Operations](#card-operations)
-- [Damage & Heal](#damage--heal)
-- [Player Operations](#player-operations)
-- [Merchant Operations](#merchant-operations)
-- [Random Utility](#random-utility)
-- [Content Registry](#content-registry)
-
-## Game Constants
-
-General game constants.
-
-### Globals
- DECAY_ALL
-
-Status effect decays by all stacks per turn.
-
-
-
- DECAY_NONE
-
-Status effect never decays.
-
-
-
- DECAY_ONE
-
-Status effect decays by 1 stack per turn.
-
-
-
- GAME_STATE_EVENT
-
-Represents the event game state.
-
-
-
- GAME_STATE_FIGHT
-
-Represents the fight game state.
-
-
-
- GAME_STATE_MERCHANT
-
-Represents the merchant game state.
-
-
-
- GAME_STATE_RANDOM
-
-Represents the random game state in which the active story teller will decide what happens next.
-
-
-
- PLAYER_ID
-
-Player actor id for use in functions where the guid is needed, for example: ``deal_damage(PLAYER_ID, enemy_id, 10)``.
-
-
-
-### Functions
-
-None
-
-## Utility
-
-General game constants.
-
-### Globals
-
-None
-
-### Functions
- fetch
-
-Fetches a value from the persistent store
-
-**Signature:**
-
-```
-fetch(key : String) -> Any
-```
-
-
-
- guid
-
-returns a new random guid.
-
-**Signature:**
-
-```
-guid() -> String
-```
-
-
-
- store
-
-Stores a persistent value for this run that will be restored after a save load. Can store any lua basic value or table.
-
-**Signature:**
-
-```
-store(key : String) -> None
-```
-
-
-
-## Styling
-
-Helper functions for text styling.
-
-### Globals
-
-None
-
-### Functions
- text_bg
-
-Makes the text background colored. Takes hex values like #ff0000.
-
-**Signature:**
-
-```
-text_bg(color : String, value) -> String
-```
-
-
-
- text_bold
-
-Makes the text bold.
-
-**Signature:**
-
-```
-text_bold(value) -> String
-```
-
-
-
- text_color
-
-Makes the text foreground colored. Takes hex values like #ff0000.
-
-**Signature:**
-
-```
-text_color(color : String, value) -> String
-```
-
-
-
- text_italic
-
-Makes the text italic.
-
-**Signature:**
-
-```
-text_italic(value) -> String
-```
-
-
-
- text_underline
-
-Makes the text underlined.
-
-**Signature:**
-
-```
-text_underline(value) -> String
-```
-
-
-
-## Logging
-
-Various logging functions.
-
-### Globals
-
-None
-
-### Functions
- log_d
-
-Log at **danger** level to player log.
-
-**Signature:**
-
-```
-log_d(value) -> None
-```
-
-
-
- log_i
-
-Log at **information** level to player log.
-
-**Signature:**
-
-```
-log_i(value) -> None
-```
-
-
-
- log_s
-
-Log at **success** level to player log.
-
-**Signature:**
-
-```
-log_s(value) -> None
-```
-
-
-
- log_w
-
-Log at **warning** level to player log.
-
-**Signature:**
-
-```
-log_w(value) -> None
-```
-
-
-
- print
-
-Log to session log.
-
-**Signature:**
-
-```
-print(value, value, value...) -> None
-```
-
-
-
-## Audio
-
-Audio helper functions.
-
-### Globals
-
-None
-
-### Functions
- play_audio
-
-Plays a sound effect. If you want to play ``button.mp3`` you call ``play_audio("button")``.
-
-**Signature:**
-
-```
-play_audio(sound : String) -> None
-```
-
-
-
- play_music
-
-Start a song for the background loop. If you want to play ``song.mp3`` you call ``play_music("song")``.
-
-**Signature:**
-
-```
-play_music(sound : String) -> None
-```
-
-
-
-## Game State
-
-Functions that modify the general game state.
-
-### Globals
-
-None
-
-### Functions
- get_event_history
-
-Gets the ids of all the encountered events in the order of occurrence.
-
-**Signature:**
-
-```
-get_event_history() -> Array
-```
-
-
-
- get_fight
-
-Gets the fight state. This contains the player hand, used, exhausted and round information.
-
-**Signature:**
-
-```
-get_fight() -> Table
-```
-
-
-
- get_fight_round
-
-Gets the number of stages cleared.
-
-**Signature:**
-
-```
-get_fight_round() -> Number
-```
-
-
-
- had_event
-
-Checks if the event happened at least once.
-
-**Signature:**
-
-```
-had_event(eventId : String) -> Bool
-```
-
-
-
- had_events
-
-Checks if all the events happened at least once.
-
-**Signature:**
-
-```
-had_events(eventIds : Array) -> Bool
-```
-
-
-
- had_events_any
-
-Checks if any of the events happened at least once.
-
-**Signature:**
-
-```
-had_events_any(eventIds : Array) -> Bool
-```
-
-
-
- set_event
-
-Set event by id.
-
-**Signature:**
-
-```
-set_event(eventId : String) -> None
-```
-
-
-
- set_fight_description
-
-Set the current fight description. This will be shown on the top right in the game.
-
-**Signature:**
-
-```
-set_fight_description(desc : String) -> None
-```
-
-
-
- set_game_state
-
-Set the current game state. See globals.
-
-**Signature:**
-
-```
-set_game_state(state : String) -> None
-```
-
-
-
-## Actor Operations
-
-Functions that modify or access the actors. Actors are either the player or enemies.
-
-### Globals
-
-None
-
-### Functions
- actor_add_max_hp
-
-Increases the max hp value of a actor by a number. Can be negative value to decrease it.
-
-**Signature:**
-
-```
-actor_add_max_hp(guid : String, amount : Number) -> None
-```
-
-
-
- add_actor_by_enemy
-
-Creates a new enemy fighting against the player. Example ``add_actor_by_enemy("RUST_MITE")``.
-
-**Signature:**
-
-```
-add_actor_by_enemy(enemyId : String) -> None
-```
-
-
-
- get_actor
-
-Get a actor by guid.
-
-**Signature:**
-
-```
-get_actor(guid : String) -> Table
-```
-
-
-
- get_opponent_by_index
-
-Get opponent (actor) by index of a certain actor. ``get_opponent_by_index(PLAYER_ID, 2)`` would return the second alive opponent of the player.
-
-**Signature:**
-
-```
-get_opponent_by_index(guid : String, index : Number) -> Table
-```
-
-
-
- get_opponent_count
-
-Get the number of opponents (actors) of a certain actor. ``get_opponent_count(PLAYER_ID)`` would return 2 if the player had 2 alive enemies.
-
-**Signature:**
-
-```
-get_opponent_count(guid : String) -> Table
-```
-
-
-
- get_opponent_guids
-
-Get the guids of opponents (actors) of a certain actor. If the player had 2 enemies, ``get_opponent_guids(PLAYER_ID)`` would return a table with 2 strings containing the guids of these actors.
-
-**Signature:**
-
-```
-get_opponent_guids(guid : String) -> Table
-```
-
-
-
- get_player
-
-Get the player actor. Equivalent to ``get_actor(PLAYER_ID)``
-
-**Signature:**
-
-```
-get_player() -> Table
-```
-
-
-
- remove_actor
-
-Deletes a actor by id.
-
-**Signature:**
-
-```
-remove_actor(guid : String) -> None
-```
-
-
-
-## Artifact Operations
-
-Functions that modify or access the artifacts.
-
-### Globals
-
-None
-
-### Functions
- get_artifact
-
-Returns the artifact definition. Can take either a guid or a typeId. If it's a guid it will fetch the type behind the instance.
-
-**Signature:**
-
-```
-get_artifact(id : String) -> Table
-```
-
-
-
- get_artifact_instance
-
-Returns the artifact instance by guid.
-
-**Signature:**
-
-```
-get_artifact_instance(guid : String) -> None
-```
-
-
-
- get_random_artifact_type
-
-Returns a random type id given a max gold price.
-
-**Signature:**
-
-```
-get_random_artifact_type(maxGold : Number) -> None
-```
-
-
-
- give_artifact
-
-Gives a actor a artifact. Returns the guid of the newly created artifact.
-
-**Signature:**
-
-```
-give_artifact(typeId : String, actor : String) -> String
-```
-
-
-
- remove_artifact
-
-Removes a artifact.
-
-**Signature:**
-
-```
-remove_artifact(guid : String) -> None
-```
-
-
-
-## Status Effect Operations
-
-Functions that modify or access the status effects.
-
-### Globals
-
-None
-
-### Functions
- add_status_effect_stacks
-
-Adds to the stack count of a status effect. Negative values are also allowed.
-
-**Signature:**
-
-```
-add_status_effect_stacks(guid : String, count : Number) -> None
-```
-
-
-
- get_actor_status_effects
-
-Returns the guids of all status effects that belong to a actor.
-
-**Signature:**
-
-```
-get_actor_status_effects(actorId : String) -> Array
-```
-
-
-
- get_status_effect
-
-Returns the status effect definition. Can take either a guid or a typeId. If it's a guid it will fetch the type behind the instance.
-
-**Signature:**
-
-```
-get_status_effect(id : String) -> Table
-```
-
-
-
- get_status_effect_instance
-
-Returns the status effect instance.
-
-**Signature:**
-
-```
-get_status_effect_instance(effectGuid : String) -> Table
-```
-
-
-
- give_status_effect
-
-Gives a status effect to a actor. If count is not specified a stack of 1 is applied.
-
-**Signature:**
-
-```
-give_status_effect(typeId : String, actorGuid : String, (optional) count : Number) -> None
-```
-
-
-
- remove_status_effect
-
-Removes a status effect.
-
-**Signature:**
-
-```
-remove_status_effect(guid : String) -> None
-```
-
-
-
- set_status_effect_stacks
-
-Sets the stack count of a status effect by guid.
-
-**Signature:**
-
-```
-set_status_effect_stacks(guid : String, count : Number) -> None
-```
-
-
-
-## Card Operations
-
-Functions that modify or access the cards.
-
-### Globals
-
-None
-
-### Functions
- cast_card
-
-Tries to cast a card with a guid and optional target. If the cast isn't successful returns false.
-
-**Signature:**
-
-```
-cast_card(cardGuid : String, (optional) targetActorGuid : String) -> Bool
-```
-
-
-
- get_card
-
-Returns the card type definition. Can take either a guid or a typeId. If it's a guid it will fetch the type behind the instance.
-
-**Signature:**
-
-```
-get_card(id : String) -> Table
-```
-
-
-
- get_card_instance
-
-Returns the instance object of a card.
-
-**Signature:**
-
-```
-get_card_instance(cardGuid : String) -> Table
-```
-
-
-
- get_cards
-
-Returns all the card guids from the given actor.
-
-**Signature:**
-
-```
-get_cards(actorGuid : String) -> Array
-```
-
-
-
- give_card
-
-Gives a card.
-
-**Signature:**
-
-```
-give_card(cardTypeId : String, ownerActorId : String) -> String
-```
-
-
-
- remove_card
-
-Removes a card.
-
-**Signature:**
-
-```
-remove_card(cardGuid : String) -> None
-```
-
-
-
- upgrade_card
-
-Upgrade a card without paying for it.
-
-**Signature:**
-
-```
-upgrade_card(cardGuid : String) -> Bool
-```
-
-
-
-## Damage & Heal
-
-Functions that deal damage or heal.
-
-### Globals
-
-None
-
-### Functions
- deal_damage
-
-Deal damage to a enemy from one source. If flat is true the damage can't be modified by status effects or artifacts.
-
-**Signature:**
-
-```
-deal_damage(source : String, target : String, damage : Number, flat : Bool) -> None
-```
-
-
-
- deal_damage_multi
-
-Deal damage to multiple enemies from one source. If flat is true the damage can't be modified by status effects or artifacts.
-
-**Signature:**
-
-```
-deal_damage_multi(source : String, targets : Array, damage : Number, flat : Bool) -> None
-```
-
-
-
- heal
-
-Heals the target triggered by the source.
-
-**Signature:**
-
-```
-heal(source : String, target : String, amount : Number) -> None
-```
-
-
-
-## Player Operations
-
-Functions that are related to the player.
-
-### Globals
-
-None
-
-### Functions
- give_player_gold
-
-Gives the player gold.
-
-**Signature:**
-
-```
-give_player_gold(amount : Number) -> None
-```
-
-
-
- player_buy_artifact
-
-Let the player buy the artifact with the given id. This will deduct the price form the players gold and return true if the buy was successful.
-
-**Signature:**
-
-```
-player_buy_artifact(artifactId : String) -> Bool
-```
-
-
-
- player_buy_card
-
-Let the player buy the card with the given id. This will deduct the price form the players gold and return true if the buy was successful.
-
-**Signature:**
-
-```
-player_buy_card(cardId : String) -> Bool
-```
-
-
-
- player_draw_card
-
-Let the player draw additional cards for this turn.
-
-**Signature:**
-
-```
-player_draw_card(amount : Number) -> None
-```
-
-
-
- player_give_action_points
-
-Gives the player more action points for this turn.
-
-**Signature:**
-
-```
-player_give_action_points(points : Number) -> None
-```
-
-
-
-## Merchant Operations
-
-Functions that are related to the merchant.
-
-### Globals
-
-None
-
-### Functions
- add_merchant_artifact
-
-Adds another random artifact to the merchant
-
-**Signature:**
-
-```
-add_merchant_artifact() -> None
-```
-
-
-
- add_merchant_card
-
-Adds another random card to the merchant
-
-**Signature:**
-
-```
-add_merchant_card() -> None
-```
-
-
-
- get_merchant
-
-Returns the merchant state.
-
-**Signature:**
-
-```
-get_merchant() -> Table
-```
-
-
-
- get_merchant_gold_max
-
-Returns the maximum value of artifacts and cards that the merchant will sell. Good to scale ``random_card`` and ``random_artifact``.
-
-**Signature:**
-
-```
-get_merchant_gold_max() -> Number
-```
-
-
-
-## Random Utility
-
-Functions that help with random generation.
-
-### Globals
-
-None
-
-### Functions
- gen_face
-
-Generates a random face.
-
-**Signature:**
-
-```
-gen_face((optional) category : Number) -> String
-```
-
-
-
- random_artifact
-
-Returns the type id of a random artifact.
-
-**Signature:**
-
-```
-random_artifact(maxPrice : Number) -> String
-```
-
-
-
- random_card
-
-Returns the type id of a random card.
-
-**Signature:**
-
-```
-random_card(maxPrice : Number) -> String
-```
-
-
-
-## Content Registry
-
-These functions are used to define new content in the base game and in mods.
-
-### Globals
-
-None
-
-### Functions
- register_artifact
-
-Registers a new artifact.
-
-```lua
-register_artifact("REPULSION_STONE",
- {
- name = "Repulsion Stone",
- description = "For each damage taken heal for 2",
- price = 100,
- order = 0,
- callbacks = {
- on_damage = function(ctx)
- if ctx.target == ctx.owner then
- heal(ctx.owner, 2)
- end
- return nil
- end,
- }
- }
-)
-```
-
-**Signature:**
-
-```
-register_artifact(id : String, definition : Table) -> None
-```
-
-
-
- register_card
-
-Registers a new artifact.
-
-```lua
-register_card("MELEE_HIT",
- {
- name = "Melee Hit",
- description = "Use your bare hands to deal 5 (+3 for each upgrade) damage.",
- state = function(ctx)
- return "Use your bare hands to deal " .. highlight(5 + ctx.level * 3) .. " damage."
- end,
- max_level = 1,
- color = "#2f3e46",
- need_target = true,
- point_cost = 1,
- price = 30,
- callbacks = {
- on_cast = function(ctx)
- deal_damage(ctx.caster, ctx.target, 5 + ctx.level * 3)
- return nil
- end,
- }
- }
-)
-```
-
-**Signature:**
-
-```
-register_card(id : String, definition : Table) -> None
-```
-
-
-
- register_enemy
-
-Registers a new artifact.
-
-```lua
-register_enemy("RUST_MITE",
- {
- name = "Rust Mite",
- description = "Loves to eat metal.",
- look = "/v\\",
- color = "#e6e65a",
- initial_hp = 22,
- max_hp = 22,
- gold = 10,
- callbacks = {
- on_turn = function(ctx)
- if ctx.round % 4 == 0 then
- give_status_effect("RITUAL", ctx.guid)
- else
- deal_damage(ctx.guid, PLAYER_ID, 6)
- end
-
- return nil
- end
- }
- }
-)
-```
-
-**Signature:**
-
-```
-register_enemy(id : String, definition : Table) -> None
-```
-
-
-
- register_event
-
-Registers a new artifact.
-
-```lua
-register_event("SOME_EVENT",
- {
- name = "Event Name",
- description = [[Flavor Text... Can include **Markdown** Syntax!]],
- choices = {
- {
- description = "Go...",
- callback = function()
- -- If you return nil on_end will decide the next game state
- return nil
- end
- },
- {
- description = "Other Option",
- callback = function() return GAME_STATE_FIGHT end
- }
- },
- on_enter = function()
- play_music("energetic_orthogonal_expansions")
-
- give_card("MELEE_HIT", PLAYER_ID)
- give_card("MELEE_HIT", PLAYER_ID)
- give_card("MELEE_HIT", PLAYER_ID)
- give_card("RUPTURE", PLAYER_ID)
- give_card("BLOCK", PLAYER_ID)
- give_artifact(get_random_artifact_type(150), PLAYER_ID)
- end,
- on_end = function(choice)
- -- Choice will be nil or the index of the choice taken
- return GAME_STATE_RANDOM
- end,
- }
-)
-```
-
-**Signature:**
-
-```
-register_event(id : String, definition : Table) -> None
-```
-
-
-
- register_status_effect
-
-Registers a new artifact.
-
-```lua
-register_artifact("REPULSION_STONE",
- {
- name = "Repulsion Stone",
- description = "For each damage taken heal for 2",
- price = 100,
- order = 0,
- callbacks = {
- on_damage = function(ctx)
- if ctx.target == ctx.owner then
- heal(ctx.owner, 2)
- end
- return nil
- end,
- }
- }
-)
-```
-
-**Signature:**
-
-```
-register_status_effect(id : String, definition : Table) -> None
-```
-
-
-
- register_story_teller
-
-Registers a new artifact.
-
-```lua
-register_artifact("REPULSION_STONE",
- {
- name = "Repulsion Stone",
- description = "For each damage taken heal for 2",
- price = 100,
- order = 0,
- callbacks = {
- on_damage = function(ctx)
- if ctx.target == ctx.owner then
- heal(ctx.owner, 2)
- end
- return nil
- end,
- }
- }
-)
-```
-
-**Signature:**
-
-```
-register_story_teller(id : String, definition : Table) -> None
-```
-
-
-
diff --git a/docs/diagrams/fight.d2 b/docs/diagrams/fight.d2
new file mode 100644
index 0000000..fab42e0
--- /dev/null
+++ b/docs/diagrams/fight.d2
@@ -0,0 +1,24 @@
+shape: sequence_diagram
+
+User
+Session
+Lua
+
+User."Init"
+
+User.t1 -> Session.t1: "SetupFight()"
+Session.t1 -> Session.t1: "Create clean fight state"
+Session.t1 -> Lua: "Trigger OnPlayerTurn"
+User.t1 <- Session.t1
+
+User."Repeat"
+
+User.mid -> Session.mid: "PlayerCastHand() etc."
+Session.mid -> Lua: "Trigger OnDamage etc."
+User.mid <- Session.mid
+
+User.t2 -> Session.t2: "FinishPlayerTurn()"
+Session.t2 -> Lua: "Trigger OnTurn"
+Session.t2 -> Session.t2: "Update and remove status effects"
+Session.t2 -> Lua: "Trigger OnPlayerTurn"
+User.t2 <- Session.t2
diff --git a/docs/diagrams/fight.svg b/docs/diagrams/fight.svg
new file mode 100644
index 0000000..3a47a37
--- /dev/null
+++ b/docs/diagrams/fight.svg
@@ -0,0 +1,110 @@
+
\ No newline at end of file
diff --git a/format-lua.sh b/format-lua.sh
new file mode 100755
index 0000000..e3e5230
--- /dev/null
+++ b/format-lua.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+for file in ./assets/scripts/*.lua; do
+ echo "Formatting: $file"
+ lua-format "$file" -i
+done
\ No newline at end of file
diff --git a/update_docs.sh b/update-docs.sh
similarity index 100%
rename from update_docs.sh
rename to update-docs.sh