Page MenuHomeWildfire Games

Fix PreferredClasses following rP23831
ClosedPublic

Authored by wraitii on Jan 21 2021, 10:22 AM.

Details

Reviewers
None
Commits
rP24751: Fix PreferredClasses following rP23831
Trac Tickets
#5945
Summary

rP23831 introduced a "Unit+!Ship" preferred class for 'Hack' melee units. However, Preferred classes don't actually use MatchesClassList, and thus this resulted in no preference whatsoever.

This fixes that, and fixes the macemen / melee elephant while at it.

Reported by: Valirhant, snelius

Test Plan

Put some fields down, some units, an attacker, watch as it no longer attacks the field.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.Jan 21 2021, 10:22 AM
Owners added a subscriber: Restricted Owners Package.Jan 21 2021, 10:22 AM
wraitii added inline comments.Jan 21 2021, 10:24 AM
binaries/data/mods/public/simulation/components/Attack.js
351 ↗(On Diff #15595)

Am using this because with for in pref is a string

binaries/data/mods/public/simulation/templates/template_unit_champion_elephant_melee.xml
15 ↗(On Diff #15595)

I think that's fair given their crush damage

Build is green

builderr-debug-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics_dbg.a(precompiled.o) has no symbols
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/C

See https://jenkins.wildfiregames.com/job/macos-differential/3002/display/redirect for more details.

wraitii requested review of this revision.Jan 21 2021, 10:30 AM
Nescio added a subscriber: Nescio.Jan 21 2021, 11:49 AM

It's intentional that swordsmen have Unit+!Ship and macemen don't: swordsmen inflict hack damage, making them effective vs all units, whereas macemen (like elephants) inflict crush damage, which is effective vs structures and siege engines, but not really vs soldiers.

It's intentional that swordsmen have Unit+!Ship and macemen don't: swordsmen inflict hack damage, making them effective vs all units, whereas macemen (like elephants) inflict crush damage, which is effective vs structures and siege engines, but not really vs soldiers.

I guess I should give them "!Ship" like Elephant then ?

Or just leave them with no preferences at all, elephants too.

wraitii updated this revision to Diff 15601.Jan 21 2021, 1:19 PM

I think it's more coherent to give them '!Ship' since others have that.

Build is green

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stu

See https://jenkins.wildfiregames.com/job/macos-differential/3005/display/redirect for more details.

Stan added a subscriber: Stan.EditedJan 21 2021, 1:34 PM

Can they attack ships at all? (And should they)

Stan added inline comments.Jan 21 2021, 1:36 PM
binaries/data/mods/public/simulation/components/Attack.js
353 ↗(On Diff #15601)

could early continue. no strong feelings

357 ↗(On Diff #15601)
In D3442#152384, @Stan wrote:

Can they attack ships at all? (And should they)

They can if the ship is on the shore. I would argue they shouldn't, hence the 'non-preferred' status.

Nescio added a comment.EditedJan 21 2021, 1:48 PM

Is having a preferred class as fast as having none at all?

They can if the ship is on the shore. I would argue they shouldn't, hence the 'non-preferred' status.

If they shouldn't then you can use

<RestrictedClasses datatype="tokens">Ship</RestrictedClasses>
binaries/data/mods/public/simulation/templates/template_unit_hero_cavalry_maceman.xml
14 ↗(On Diff #15601)

?

Is having a preferred class as fast as having none at all?

No, it's definitely slower, but it's not like I've added it to the core of any army here.

They can if the ship is on the shore. I would argue they shouldn't, hence the 'non-preferred' status.

If they shouldn't then you can use

Should have worded "they shouldn't attack those first". I think it's OK that ships can be targeted.

Yeah, I think it's fine they could attack ships, it's not something that'll happen frequently.
However, I'm unconvinced adding the proposed preferred class is really necessary, for the same reason.

Yeah, I think it's fine they could attack ships, it's not something that'll happen frequently.
However, I'm unconvinced adding the proposed preferred class is really necessary, for the same reason.

My main reason for adding it is that Spearmen/Swordsman/Pikeman have it, and I think for consistency Macemen should too, and elephants probably as well. Otherwise it should probably be removed there too.

The pikemen and swordsmen don't have !Ship, only axemen and swordsmen do, see https://code.wildfiregames.com/D2851#123342 as for why.

The pikemen and swordsmen don't have !Ship, only axemen and swordsmen do, see https://code.wildfiregames.com/D2851#123342 as for why.

They indirectly have, since Human implies !Ship

This revision was not accepted when it landed; it landed in state Needs Review.Jan 21 2021, 3:34 PM
This revision was automatically updated to reflect the committed changes.