diff --git a/apps/champions/lib/champions/config.ex b/apps/champions/lib/champions/config.ex
index 10505d95d..e22acf581 100644
--- a/apps/champions/lib/champions/config.ex
+++ b/apps/champions/lib/champions/config.ex
@@ -22,12 +22,13 @@ defmodule Champions.Config do
@doc """
Imports the skills configuration from 'skills.json' in the app's priv folder.
"""
- def import_skill_config() do
+ def import_skill_config(game_id) do
{:ok, skills_json} =
Application.app_dir(:champions, "priv/skills.json")
|> File.read()
Jason.decode!(skills_json, [{:keys, :atoms}])
+ |> Enum.map(fn skill -> Map.put(skill, :game_id, game_id) end)
|> Skills.upsert_skills()
end
diff --git a/apps/configurator/lib/configurator_web/components/custom_components.ex b/apps/configurator/lib/configurator_web/components/custom_components.ex
index d2c2062a5..6fdb4ef19 100644
--- a/apps/configurator/lib/configurator_web/components/custom_components.ex
+++ b/apps/configurator/lib/configurator_web/components/custom_components.ex
@@ -50,6 +50,12 @@ defmodule ConfiguratorWeb.CustomComponents do
attr :form, :map, required: true
attr :field, :atom, required: true
+ def effect_form(%{form: %{params: %{"effect" => nil}}} = assigns) do
+ ~H"""
+
No Effect
+ """
+ end
+
def effect_form(assigns) do
~H"""
<.button type="button" phx-click={show_modal("effect-form")}>Edit effect
@@ -74,7 +80,7 @@ defmodule ConfiguratorWeb.CustomComponents do
/>
<.input field={mechanics_form[:modifier]} type="number" label="Modifier" step="any" />
<.input field={mechanics_form[:force]} type="number" label="Force" step="any" />
- <.input field={effect_f[:execute_multiple_times]} type="checkbox" label="Execute mechanic multiple times" />
+ <.input field={mechanics_form[:execute_multiple_times]} type="checkbox" label="Execute mechanic multiple times" />
<.input field={mechanics_form[:damage]} type="number" label="Damage amount" />
<.input field={mechanics_form[:effect_delay_ms]} type="number" label="Mechanic delay" />
<.input field={mechanics_form[:additive_duration_add_ms]} type="number" label="Additive duration to add ms" />
diff --git a/apps/configurator/lib/configurator_web/controllers/version_html/version_form.html.heex b/apps/configurator/lib/configurator_web/controllers/version_html/version_form.html.heex
index a054bd6e6..b60ee0156 100644
--- a/apps/configurator/lib/configurator_web/controllers/version_html/version_form.html.heex
+++ b/apps/configurator/lib/configurator_web/controllers/version_html/version_form.html.heex
@@ -52,6 +52,7 @@
<.input field={fci[:name]} type="text" label="Name" />
<.input field={fci[:radius]} type="number" label="Radius" step="any" />
<.input field={fci[:active]} type="checkbox" label="Active" />
+ <.effect_form form={fci} field={:effect} />
diff --git a/apps/game_backend/lib/game_backend/configuration.ex b/apps/game_backend/lib/game_backend/configuration.ex
index 0a0b8e64f..22b4d1ae4 100644
--- a/apps/game_backend/lib/game_backend/configuration.ex
+++ b/apps/game_backend/lib/game_backend/configuration.ex
@@ -417,7 +417,6 @@ defmodule GameBackend.Configuration do
def get_current_version do
consumable_items_preload =
from(ci in GameBackend.Items.ConsumableItem,
- where: ci.active,
preload: [
mechanics: [:on_arrival_mechanic, :on_explode_mechanics, :parent_mechanic]
]
diff --git a/apps/game_backend/lib/game_backend/configuration/version.ex b/apps/game_backend/lib/game_backend/configuration/version.ex
index 095b55277..4d95c96ec 100644
--- a/apps/game_backend/lib/game_backend/configuration/version.ex
+++ b/apps/game_backend/lib/game_backend/configuration/version.ex
@@ -33,14 +33,6 @@ defmodule GameBackend.Configuration.Version do
|> cast_assoc(:skills, with: &Skill.assoc_changeset/2)
|> cast_assoc(:map_configurations, with: &MapConfiguration.assoc_changeset/2)
|> cast_assoc(:game_configuration, with: &GameConfiguration.assoc_changeset/2)
- |> validate_required([
- :name,
- :current,
- :characters,
- :consumable_items,
- :skills,
- :map_configurations,
- :game_configuration
- ])
+ |> validate_required([:name, :current])
end
end
diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs
index f9f0dca42..581cb5ef8 100644
--- a/priv/repo/seeds.exs
+++ b/priv/repo/seeds.exs
@@ -10,7 +10,7 @@ champions_of_mirra_id = Utils.get_game_id(:champions_of_mirra)
### Champions Currencies
-{:ok, _skills} = Champions.Config.import_skill_config()
+{:ok, _skills} = Champions.Config.import_skill_config(champions_of_mirra_id)
{:ok, _characters} = Champions.Config.import_character_config()
@@ -1536,8 +1536,7 @@ fake_item_params = %{
active: false,
name: "fake_item",
radius: 200.0,
- mechanics: [spawn_bomb_mechanic],
- effects: [],
+ effect_mechanics: [spawn_bomb_mechanic],
version_id: version.id
}