-
Notifications
You must be signed in to change notification settings - Fork 2
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
[GH-309] add valtimer teleport #305
Changes from 24 commits
5262a02
1a329ce
f56cf43
005a62c
32c96a5
02c53a5
d39b231
a7b45f6
4127bc4
aa31613
170bb3a
6eb1801
b4aa6f4
509ca7c
efd3906
da321d3
cafc5e9
7faf8bb
d013f05
9a684de
d7f579c
3671dba
d5f2da8
b338946
52fc65c
abbacf7
9c21fce
2c3fb72
3d476c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,11 @@ defmodule Arena.Game.Player do | |
alias Arena.Utils | ||
alias Arena.Game.Skill | ||
|
||
def add_action(player, action_name, duration_ms) do | ||
Process.send_after(self(), {:remove_skill_action, player.id, action_name}, duration_ms) | ||
def add_action(player, action) do | ||
Process.send_after(self(), {:remove_skill_action, player.id, action.action}, action.duration) | ||
|
||
update_in(player, [:aditional_info, :current_actions], fn current_actions -> | ||
current_actions ++ [%{action: action_name, duration: duration_ms}] | ||
current_actions ++ [action] | ||
end) | ||
end | ||
|
||
|
@@ -189,19 +189,39 @@ defmodule Arena.Game.Player do | |
skill.activation_delay_ms | ||
) | ||
|
||
action_name = skill_key_execution_action(skill_key) | ||
action = | ||
%{ | ||
action: skill_key_execution_action(skill_key), | ||
duration: skill.execution_duration_ms | ||
} | ||
|> maybe_add_destination(player, skill_direction, skill) | ||
|
||
player = | ||
add_action(player, action_name, skill.execution_duration_ms) | ||
add_action(player, action) | ||
|> apply_skill_cooldown(skill_key, skill) | ||
|> put_in([:direction], skill_direction |> Utils.normalize()) | ||
|> put_in([:is_moving], false) | ||
|> put_in([:aditional_info, :last_skill_triggered], System.monotonic_time(:millisecond)) | ||
|> maybe_make_invinsible(skill) | ||
|
||
put_in(game_state, [:players, player.id], player) | ||
end | ||
end | ||
|
||
# This is a messy solution to get a mechanic result before actually running the mechanic sinc the client needed the | ||
# position in wich the player will spawn when the skill start and not when we actually execute the teleport | ||
# this is also optmistic since we asume the destination will be always available | ||
defp maybe_add_destination(action, player, skill_direction, %{mechanics: [{:teleport, teleport}]}) do | ||
target_position = %{ | ||
x: player.position.x + skill_direction.x * teleport.range, | ||
y: player.position.y + skill_direction.y * teleport.range | ||
} | ||
|
||
Map.put(action, :destination, target_position) | ||
end | ||
|
||
defp maybe_add_destination(action, _, _, _), do: action | ||
|
||
@doc """ | ||
|
||
Receives a player that owns the damage and the damage number | ||
|
@@ -362,4 +382,16 @@ defmodule Arena.Game.Player do | |
player | ||
end | ||
end | ||
|
||
defp maybe_make_invinsible( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why "invisible" instead of "invulnerable"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was the name given by the item implementation, i just s̶t̶o̶l̶e̶ use that in this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I just realized it says "invinsible", not "invisible" as in not visible. There's a typo there though, it should be "invincible"! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right! i didn't noticed it either lol fixed! |
||
player, | ||
%{inmune_while_executing: true, execution_duration_ms: execution_duration_ms} = _skill | ||
) do | ||
Process.send_after(self(), {:remove_damage_immunity, player.id}, execution_duration_ms) | ||
put_in(player, [:aditional_info, :damage_immunity], true) | ||
end | ||
|
||
defp maybe_make_invinsible(player, _) do | ||
player | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -304,6 +304,27 @@ | |
], | ||
"effects_to_apply": [] | ||
}, | ||
{ | ||
"name": "valt_warp", | ||
"cooldown_mechanism": "time", | ||
"cooldown_ms": 2000, | ||
"execution_duration_ms": 800, | ||
"inmune_while_executing": true, | ||
"activation_delay_ms": 600, | ||
"is_passive": false, | ||
"autoaim": false, | ||
"can_pick_destination": true, | ||
"stamina_cost": 1, | ||
"mechanics": [ | ||
{ | ||
"teleport": { | ||
"range": 1000, | ||
"duration_ms": 300 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should include the radius of the ability so we can displayed it in the client. Or maybe we can use the hitbox radius in the client to display it. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm i think the radius and the range are the same in the context of the teleport, we could simply rename this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think that is gonna work because we use the range and area to draw different indicators in the client. I mean with the range we draw the outer circle area and with the radius the inner circle area. What I suggest is that maybe we can use the hitbox of the character to display the inner area since it indicates where the character body is gonna be placed. WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooooh right! yeah we should use the body size for the inner circle indicator |
||
} | ||
} | ||
], | ||
"effects_to_apply": [] | ||
}, | ||
{ | ||
"name": "uma_sneak", | ||
"cooldown_mechanism": "time", | ||
|
@@ -454,7 +475,7 @@ | |
"skills": { | ||
"1": "valt_antimatter", | ||
"2": "valt_singularity", | ||
"3": "valt_sneak" | ||
"3": "valt_warp" | ||
} | ||
} | ||
], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think
action_name
would be a better name here? At first sight it looks likeaction
contains an action, as a sort of compound entity, which is not what you're trying to represent here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that makes sense , so we can avoid this abomination
action.action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually i think this is a bigger change than just renaming this, because we need to change the player action everywhere. This change was only something to avoid adding multiple parameters to the add_action function, if you think this make things worse we can revert it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, let's leave it like this then