Page MenuHomeWildfire Games

Allow area damages to have a minimum range.
Needs ReviewPublic

Authored by Freagarach on Sep 9 2019, 12:44 PM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

This is split from D1838 and allows for area damages to have a minimum range, where the target is not damaged. No use case (yet) for vanilla, but useful for modders. E.g. a ring of fire that damages entities until they come close enough.

Test Plan
  • Use a catapult to test that splash damage still works fine.
  • One can add a MinRange to a splash and verify that works (unit will still be damaged by the projectile itself).

Event Timeline

Freagarach created this revision.Sep 9 2019, 12:44 PM
Owners added a subscriber: Restricted Owners Package.Sep 9 2019, 12:44 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/105/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/614/display/redirect

Stan added a subscriber: Stan.Sep 9 2019, 4:09 PM

Maybe this should be affectable by tech, (ie researching close combat weapon or whatever) ? Just an idea it would also work having #252

Freagarach added a comment.EditedSep 9 2019, 4:19 PM

This patch enables a splash to have a minimum range: e.g. when the projectile lands and it has a minRange of 5 m, the first 5 m would not be damaged, only in the range between the minRange and the maxRange damage is dealt.

Stan added a comment.Sep 9 2019, 4:27 PM
In D2270#94462, @Stan wrote:

Maybe this should be affectable by tech, (ie researching close combat weapon or whatever) ? Just an idea it would also work having #252

This patch enables a splash to have a minimum range: e.g. when the projectile lands and it has a minRange of 5 m, the first 5 m would not be damaged, only in the range between the minRange and the maxRange damage is dealt.

Yeah I meant be able to change that during the game :)

Freagarach added a comment.EditedSep 9 2019, 4:52 PM

Oh, I thought focus on the second part ;)
But I thought about adding that (upgradable) here also, but I don't want to spam diffs too much, there's a lot to do already and me creating more diffs is not good for review-morale (although I have a list of diffs I want to create ;) ) and it (upgradable) is out of scope for this one.

Freagarach updated this revision to Diff 11539.Mar 24 2020, 4:49 PM
  • Rebased.
  • Remove unnecessary spaces in JSDoc in Attacking.js.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/Attack.js
| 425| »   return·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Function expected no return value.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1901/display/redirect

wraitii requested changes to this revision.May 30 2020, 3:40 PM

Needs a rebase & see inlines.

binaries/data/mods/public/simulation/components/Attack.js
436

meh for inconsistency here

binaries/data/mods/public/simulation/helpers/Attacking.js
279

probably want to scale between min-range and max-range?

This revision now requires changes to proceed.May 30 2020, 3:40 PM
Freagarach updated this revision to Diff 12137.Jun 5 2020, 9:08 AM
Freagarach marked an inline comment as done.
Freagarach edited the summary of this revision. (Show Details)
  • Rebased.
  • Range -> MaxRange for consistency.

Need to look into the scaling.

Owners added a subscriber: Restricted Owners Package.Jun 5 2020, 9:08 AM
Freagarach added inline comments.Jun 5 2020, 9:09 AM
binaries/data/mods/public/simulation/helpers/Attacking.js
279

Would be nice indeed :)

Vulcan added a comment.Jun 5 2020, 9:36 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2315/display/redirect

Freagarach updated this revision to Diff 12622.Jul 9 2020, 1:59 PM

Scale depending on affected range.

Freagarach marked an inline comment as done.Jul 9 2020, 1:59 PM
Vulcan added a comment.Jul 9 2020, 2:03 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2611/display/redirect

bb added a subscriber: bb.Jul 17 2020, 2:21 PM
bb added inline comments.
binaries/data/mods/public/simulation/components/tests/test_Damage.js
278

no need to call the square function twice
(Do note that calling extra function can have performance influence, ofc these are tests so who cares and probably the best in this case too)

binaries/data/mods/public/simulation/helpers/Attacking.js
279

My math teacher in high-school taught me that x^2/y^2==(x/y)^2

Considering D2759, this number can get less than 0. Maybe add a safeguard for that.

296

If you wish, you can do the same type of falloff here.

wraitii requested changes to this revision.Jul 30 2020, 2:44 PM

@bb 's comments

This revision now requires changes to proceed.Jul 30 2020, 2:44 PM
Freagarach updated this revision to Diff 13173.Aug 11 2020, 5:41 PM
Freagarach marked an inline comment as done.
  • Make sure value stays positive.
  • Square only once.
binaries/data/mods/public/simulation/helpers/Attacking.js
296

But this doesn't use the minRange?