Page MenuHomeWildfire Games

[WIP] - Status Effects v2 - Allow modifiers.
Needs ReviewPublic

Authored by Freagarach on Tue, Sep 10, 3:57 PM.

Details

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

This allows modifiers to be used as an effect of statuseffects.
E.g. slowing a unit down when hit, lowering morale, you name it basically ;)


ToDo:

  • GUI Support (depends on D2218 probably).
  • Improve code.
  • Support stackable.
Test Plan

Test some modifs and verify that they are applied and removed appropriately.

Event Timeline

Freagarach created this revision.Tue, Sep 10, 3:57 PM

Build failure - The Moirai have given mortals hearts that can endure.

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

Freagarach added inline comments.Tue, Sep 10, 3:58 PM
binaries/data/mods/public/simulation/helpers/Attacking.js
42–64

This should be a one or more choice probably.

Build failure - The Moirai have given mortals hearts that can endure.

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

Stan added subscribers: wraitii, Stan.EditedTue, Sep 10, 4:00 PM
This comment has been deleted.
binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
27

Pretty sure it's missing some spaces, I guess the linter will complain :D

Cheers for the diff :)

I implemented something similar in D2188 and we should settle right away on how we want it to look.
XML doesn't support multiple items with the same name, so that's annoying. In D2188 I used the path as name, replacing / with -. That worked well enough, but was kinda meh. I also didn't bother with splitting operation and value.

Something like this:

"<element name='Modifiers' a:help='Modifiers caused by the status.'>" +
	"<interleave>" +
		"<element name='Affects' a:help='An array of classes to affect.'>" +
			"<attribute name='datatype'>" +
				"<value>tokens</value>" +
			"</attribute>" +
			"<text/>" +
		"</element>" +
		"<oneOrMore>" +
			"<element>" +
				"<anyName />" +
				"<interleave>" +
					"<element name='Path' a:help='Path to modify.'><text/></element>" +
					"<element name='Operation' a:help='What operation to perform.'><text/></element>" +
					"<element name='Value' a:help='The value of the operation to perform.'><data type='decimal'/></element>" +
				"</interleave>" +
			"</element>" +
		"</oneOrMore>" +
	"</interleave>" +
"</element>" +

?

Angen added a subscriber: Angen.Tue, Sep 10, 7:28 PM
Angen added inline comments.
binaries/data/mods/public/simulation/templates/template_unit_infantry_ranged_archer.xml
15

do not use tabs :)

Angen added inline comments.Tue, Sep 10, 7:32 PM
binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
27

looks like long line, maybe you should format it and make multiple lines of it :)

binaries/data/mods/public/simulation/templates/template_unit_infantry_ranged_archer.xml
15

Bogus -> Bonus ?

Stan added inline comments.Tue, Sep 10, 7:36 PM
binaries/data/mods/public/simulation/templates/template_unit_infantry_ranged_archer.xml
15

I believe it's just for the test :D hence the bogus bad indented bonus

Freagarach marked 3 inline comments as done.Tue, Sep 10, 8:41 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
27

Both correct, waiting for the discussion how to unify and properly pass things. Thanks for noticing :)

binaries/data/mods/public/simulation/templates/template_unit_infantry_ranged_archer.xml
15

Ah, @Stan is getting my laziness ;)

Freagarach updated this revision to Diff 9751.Sat, Sep 14, 8:48 AM
Freagarach marked an inline comment as done.
Freagarach edited the summary of this revision. (Show Details)

Some more fiddling.
Not yet the proper way of defining what effects can occur.

Build failure - The Moirai have given mortals hearts that can endure.

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

Build failure - The Moirai have given mortals hearts that can endure.

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

Freagarach added inline comments.Sat, Sep 14, 8:53 AM
binaries/data/mods/public/simulation/helpers/Attacking.js
38–40

Optional because we could have permanent status effects.

41–63

Optional because we can have effects with only modifiers (which are applied once and removed after duration (or not)). But for Damage a lack of interval makes no sense.

Freagarach updated this revision to Diff 9752.Sat, Sep 14, 8:55 AM

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
|  38|  38| 		let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager);
|  39|  39| 		for (let modifier in data.Modifiers)
|  40|  40| 		{
|  41|    |-			status.Modifiers[modifier] = data.Modifiers[modifier].Path
|    |  41|+			status.Modifiers[modifier] = data.Modifiers[modifier].Path;
|  42|  42| 			cmpModifiersManager.AddModifier(data.Modifiers[modifier].Path, statusName, {
|  43|  43| 				"affects": data.Modifiers[modifier].Affects._string.split(/\s+/),
|  44|  44| 				[data.Modifiers[modifier].Operation]: +data.Modifiers[modifier].Value

binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
|  41| »   »   »   status.Modifiers[modifier]·=·data.Modifiers[modifier].Path
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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