-
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-399] Deal damage over time #662
Conversation
…deal-damage-over-time
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.
The overall implementation is in line with what I had imagined, love it! Left some small code design comments and general details
…deal-damage-over-time
|> Map.put(:health, target.health - damage_after_defense) | ||
|> update_in([:executions_over_time], fn current_executions -> | ||
Enum.map(current_executions, fn exec -> | ||
if exec == execution_over_time do |
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.
I think there is a really, really edge-y edge case here where this fails still. Do you think we should add an issue to revisit this later?
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.
As discussed, the case in which two units of the same character apply the same EoT to a target would be handled by this comparison because the execution over time would have different values in the caster
field.
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.
Code is looking fine to me! However I'm getting an error when trying to play a level:
[error] Ranch listener Gateway.Endpoint.HTTP had connection process started with :cowboy_clear:start_link/4 at #PID<0.1514.0> exit with reason: {%Protocol.UndefinedError{protocol: Enumerable, value: nil, description: ""}, [{Enumerable, :impl_for!, 1, [file: ~c"lib/enum.ex", line: 1]}, {Enumerable, :reduce, 3, [file: ~c"lib/enum.ex", line: 166]}, {Enum, :reduce, 3, [file: ~c"lib/enum.ex", line: 4399]}, {Champions.Battle.Simulator, :apply_tags, 4, [file: ~c"lib/champions/battle/simulator.ex", line: 968]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: ~c"lib/enum.ex", line: 2528]}, {Champions.Battle.Simulator, :"-process_step_for_effects/1-fun-0-", 4, [file: ~c"lib/champions/battle/simulator.ex", line: 592]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: ~c"lib/enum.ex", line: 2528]}, {Champions.Battle.Simulator, :"-process_step_for_effects/1-fun-2-", 2, [file: ~c"lib/champions/battle/simulator.ex", line: 588]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: ~c"lib/enum.ex", line: 2528]}, {Champions.Battle.Simulator, :process_step_for_effects, 1, [file: ~c"lib/champions/battle/simulator.ex", line: 579]}, {Champions.Battle.Simulator, :"-simulate_battle/3-fun-0-", 3, [file: ~c"lib/champions/battle/simulator.ex", line: 193]}, {Enumerable.Range, :reduce, 5, [file: ~c"lib/range.ex", line: 538]}, {Enum, :reduce_while, 3, [file: ~c"lib/enum.ex", line: 2582]}, {Champions.Battle.Simulator, :simulate_battle, 3, [file: ~c"lib/champions/battle/simulator.ex", line: 184]}, {Champions.Battle, :run_battle, 3, [file: ~c"lib/champions/battle.ex", line: 61]}, {Ecto.Multi, :apply_operation, 5, [file: ~c"lib/ecto/multi.ex", line: 883]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: ~c"lib/enum.ex", line: 2528]}, {Ecto.Multi, :"-apply_operations/5-fun-1-", 5, [file: ~c"lib/ecto/multi.ex", line: 856]}, {Ecto.Adapters.SQL, :"-checkout_or_transaction/4-fun-0-", 3, [file: ~c"lib/ecto/adapters/sql.ex", line: 1358]}, {DBConnection, :run_transaction, 4, [file: ~c"lib/db_connection.ex", line: 1710]}]}
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.
LGTM!
Motivation
We need to implement the damage over time executions for effects, following the guidelines found in the design document
Closes lambdaclass/afk_gacha_game#399
Summary of changes
executions_over_time
to effectsHow to test it?
Check the tests and play with the skills cooldowns, DoT duration and period to check that the behaviour is the expected one.
Checklist