Page MenuHomeWildfire Games

Support attacks costing resources.
Needs ReviewPublic

Authored by Freagarach on Jul 23 2019, 2:38 PM.
This revision needs review, but all reviewers have resigned.

Details

Reviewers
Silier
Summary

Feature request from @Nescio.
Uploading it here because perhaps someday someone wants support for this in vanilla.

Test Plan

Give an entity the ResourceCost-node in the attack-template and watch every attack cost resources.

Unit TestsFailed

TimeTest
0 msJenkins > TestComponentScripts::test_scripts
Assertion failed: componentManager->LoadScript(VfsPath(L"simulation/components") / pathname) Test failed: L"Running script simulation/components/tests/test_Attack.js" Assertion failed: scriptInterface.LoadScript(pathname, content)
0 msJenkins > cxxtest-debug-gcc6.xml::[failed-to-read]
Failed to read test report file /zpool0/trunk/cxxtest-debug-gcc6.xml org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. at org.dom4j.io.SAXReader.read(SAXReader.java:462)
0 msJenkins > TestAllocators::test_da
0 msJenkins > TestAtlasObjectXML::test_parse_attributes1
0 msJenkins > TestAtlasObjectXML::test_parse_attributes2
View Full Test Results (2 Failed · 332 Passed)

Event Timeline

Freagarach created this revision.Jul 23 2019, 2:38 PM
Freagarach created this object with visibility "Subscribers".
Owners added a subscriber: Restricted Owners Package.Jul 23 2019, 2:38 PM
Freagarach removed a subscriber: Restricted Owners Package.Jul 23 2019, 2:39 PM

Thanks again!
Interestingly, the technology contribution is displayed in the tooltips (5 stone), but somehow only the default (4 stone) is deduced in game. I suppose something should be changed in Attack.js lines 692 to 697?

binaries/data/mods/public/gui/common/tooltips.js
340

"costs"? Elsewhere simply "cost" is used. (Again, just curious; it works here.)

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

Any particular reason why you list it here (melee) before bonusSchema etc but below (ranged) after? (Just curious, doesn't really matter.)

Nescio added inline comments.Jul 24 2019, 3:26 PM
binaries/data/mods/public/simulation/components/Attack.js
594

successful

Quick patch, little checking ;)

binaries/data/mods/public/gui/common/tooltips.js
340

Yeah I don't always remember which I use in other files. I'll standardise it to "cost".

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

It should be before, since it is more readable.

Freagarach updated this revision to Diff 9117.Jul 25 2019, 4:22 PM
Freagarach marked 3 inline comments as done.
  • costs => cost
  • Should fix the modifications.
Owners added a subscriber: Restricted Owners Package.Jul 25 2019, 4:22 PM
Freagarach removed a subscriber: Restricted Owners Package.Jul 25 2019, 4:22 PM

Thanks, I tried again, and it works now.

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

successful

Freagarach added inline comments.Jul 28 2019, 11:44 AM
binaries/data/mods/public/simulation/components/Attack.js
594

Oh boy, I'm sorry you had to correct me on this twice,,,

I did not test this or had critical view but I have some notes:

Attack.prototype.GetResourceCost = function(attackType) is very expensive function which will be called a lot

Entity should take resource to its repository and if has enough of them then start to attack. Now it looks like this:

entity 1 can attack so it starts attack (attack animation is playing)
another entity or player uses all resources
entity 1 cannot finish attack but animation is at the end so its gives up

and it should be like

entity 1 can attack so it takes resources from player and starts attack (attack animation is playing)
another entity or player uses all resources
entity 1 can still finish attack and fails later because does not have enough resources

Another note to think is that getBestAttackAgainst should probably not return attack without needed resources

Petra will probably screw up her resources usage and planing with having this.

Freagarach marked an inline comment as done.
Freagarach changed the visibility from "Subscribers" to "Public (No Login Required)".
  • Try to take resources before attack.
  • Fix typo.
  • Proper tooltip.
Owners added a subscriber: Restricted Owners Package.Dec 21 2019, 11:46 AM
In D2113#103693, @Angen wrote:

Another note to think is that getBestAttackAgainst should probably not return attack without needed resources

It check whether one can attack the target, so that is covered.

In D2113#103693, @Angen wrote:

Petra will probably screw up her resources usage and planing with having this.

Aye, badly.

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

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

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

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

Silier requested changes to this revision.Dec 27 2019, 11:14 AM
This revision now requires changes to proceed.Dec 27 2019, 11:14 AM
Silier resigned from this revision.Jul 31 2023, 5:26 PM
This revision now requires review to proceed.Jul 31 2023, 5:26 PM