Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new character uren #984

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions apps/arena/lib/arena/game/skill.ex
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,37 @@ defmodule Arena.Game.Skill do
put_in(game_state, [:players, entity.id], entity)
end

def do_mechanic(game_state, %{category: :projectile} = entity, %{type: "spawn_pool"} = pool_params, skill_params) do
last_id = game_state.last_id + 1

skill_direction = maybe_multiply_by_range(skill_params.skill_direction, skill_params.auto_aim?, pool_params.range)

target_position = %{
x: entity.position.x + skill_direction.x,
y: entity.position.y + skill_direction.y
}

Process.send_after(self(), {:activate_pool, last_id}, pool_params.activation_delay)

pool_params =
Map.merge(
%{
id: last_id,
position: target_position,
owner_id: entity.aditional_info.owner_id,
skill_key: entity.aditional_info.skill_key,
status: :WAITING
},
pool_params
)

pool =
Entities.new_pool(pool_params)

put_in(game_state, [:pools, last_id], pool)
|> put_in([:last_id], last_id)
end

def do_mechanic(game_state, player, %{type: "spawn_pool"} = pool_params, skill_params) do
last_id = game_state.last_id + 1

Expand Down
2 changes: 1 addition & 1 deletion apps/arena/lib/arena/game_updater.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ defmodule Arena.GameUpdater do
game_state,
projectile,
projectile.aditional_info.on_explode_mechanics,
%{skill_direction: projectile.direction}
%{skill_direction: projectile.direction, auto_aim?: false}
)
else
game_state
Expand Down
2 changes: 1 addition & 1 deletion apps/arena/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Arena.MixProject do
def project do
[
app: :arena,
version: "0.8.1",
version: "0.9.1",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down
2 changes: 1 addition & 1 deletion apps/arena_load_test/lib/arena_load_test/socket_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ defmodule ArenaLoadTest.SocketHandler do
# This is enough for now. Will request bots from the bots app in future iterations.
# https://github.com/lambdaclass/mirra_backend/issues/410
defp get_random_active_character() do
["muflus", "h4ck", "uma", "valtimer", "kenzu", "otix", "shinko"]
["muflus", "h4ck", "uma", "valtimer", "kenzu", "otix", "shinko", "uren"]
|> Enum.random()
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ defmodule GameBackend.Matches.ArenaMatchResult do
|> validate_inclusion(:result, ["win", "loss", "abandon"])
## TODO: This enums should actually be read from config
## https://github.com/lambdaclass/mirra_backend/issues/601
|> validate_inclusion(:character, ["h4ck", "muflus", "uma", "valtimer", "kenzu", "otix", "shinko"])
|> validate_inclusion(:killed_by, ["h4ck", "muflus", "uma", "valtimer", "kenzu", "otix", "shinko", "zone"])
|> validate_inclusion(:character, ["h4ck", "muflus", "uma", "valtimer", "kenzu", "otix", "shinko", "uren"])
|> validate_inclusion(:killed_by, ["h4ck", "muflus", "uma", "valtimer", "kenzu", "otix", "shinko", "uren", "zone"])
|> foreign_key_constraint(:user_id)
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= if assigns[:current_user_id] do %>
<.form :let={f} for={%{}} action={~p"/"}>
<.input field={f[:character]} name="character" label="Select a Character" type="select" options={["muflus", "h4ck", "uma", "valtimer", "kenzu", "otix", "shinko"]} value=""/>
<.input field={f[:character]} name="character" label="Select a Character" type="select" options={["muflus", "h4ck", "uma", "valtimer", "kenzu", "otix", "shinko", "uren"]} value=""/>
<.input field={f[:user_id]} name="user_id" type="hidden" value={assigns[:user_id]}/>
<.button type="submit" name="game_mode" value="battle-royale">Play Battle Royal</.button>
<.button type="submit" name="game_mode" value="pair">Play Pair</.button>
Expand Down
106 changes: 104 additions & 2 deletions priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ singularity_effect = %{
},
%{
name: "damage",
damage: 13,
damage: 15,
effect_delay_ms: 400,
execute_multiple_times: true
}
Expand Down Expand Up @@ -445,6 +445,41 @@ simple_shoot = %{
}
}

simple_piercing_shoot = %{
"type" => "simple_shoot",
"speed" => 0.8,
"duration_ms" => 2500,
"remove_on_collision" => false,
"projectile_offset" => 100,
"radius" => 150.0,
"damage" => 4
}

multi_piercing_shoot = %{
"type" => "multi_shoot",
"angle_between" => 120.0,
"amount" => 3,
"speed" => 0.8,
"duration_ms" => 1500,
"remove_on_collision" => false,
"projectile_offset" => 100,
"damage" => 5,
"radius" => 150.0,
"on_explode_mechanics" => [
%{
"name" => "tornado",
"type" => "spawn_pool",
"activation_delay" => 250,
"duration_ms" => 4000,
"radius" => 350.0,
"range" => 0.0,
"shape" => "circle",
"vertices" => [],
"effect" => singularity_effect
}
]
}

quickslash_1 = %{
"type" => "circle_hit",
"damage" => 60,
Expand Down Expand Up @@ -992,6 +1027,55 @@ skills = [
"mechanics" => [
putrid_elixir_bomb
]
},
%{
"name" => "uren_basic",
"type" => "basic",
"cooldown_mechanism" => "stamina",
"execution_duration_ms" => 450,
"activation_delay_ms" => 150,
"is_passive" => false,
"autoaim" => true,
"max_autoaim_range" => 1500,
"stamina_cost" => 1,
"can_pick_destination" => false,
"block_movement" => true,
"mechanics" => [simple_piercing_shoot],
"version_id" => version.id
},
%{
"name" => "uren_ultimate",
"type" => "ultimate",
"cooldown_mechanism" => "time",
"cooldown_ms" => 10000,
"execution_duration_ms" => 1000,
"activation_delay_ms" => 0,
"is_passive" => false,
"autoaim" => true,
"max_autoaim_range" => 1200,
"can_pick_destination" => false,
"block_movement" => true,
"mechanics" => [multi_piercing_shoot]
},
%{
"name" => "uren_dash",
"type" => "dash",
"cooldown_mechanism" => "time",
"cooldown_ms" => 4000,
"execution_duration_ms" => 250,
"activation_delay_ms" => 0,
"is_passive" => false,
"autoaim" => false,
"max_autoaim_range" => 0,
"can_pick_destination" => false,
"block_movement" => true,
"mechanics" => [
%{
"type" => "dash",
"speed" => 4,
"duration_ms" => 250
}
]
}
]

Expand Down Expand Up @@ -1161,6 +1245,23 @@ shinko_params = %{
version_id: version.id
}

uren_params = %{
name: "uren",
active: true,
base_speed: 0.68,
base_size: 100.0,
base_health: 400,
base_stamina: 3,
stamina_interval: 2000,
max_inventory_size: 1,
natural_healing_interval: 1000,
natural_healing_damage_interval: 3500,
basic_skill_id: skills["uren_basic"],
ultimate_skill_id: skills["uren_ultimate"],
dash_skill_id: skills["uren_dash"],
version_id: version.id
}

# Insert characters
[
muflus_params,
Expand All @@ -1169,7 +1270,8 @@ shinko_params = %{
valtimer_params,
kenzu_params,
otix_params,
shinko_params
shinko_params,
uren_params
]
|> Enum.each(fn char_params ->
Map.put(char_params, :game_id, curse_of_mirra_id)
Expand Down
Loading