Page MenuHomeWildfire Games

Allow Promotion to add arbitrary modifiers when a unit reaches the next rank instead of changing entities.
Needs ReviewPublic

Authored by wraitii on Aug 18 2019, 6:46 PM.

Details

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

With D274, Promotion can be made to add modifiers every time a unit gains a "level", instead of promoting to a different entity.
This is great for RPG or tower-defense mods. This allows creating entities that can gain a small amount of HP every time they gain a level, for example.
The system is designed with some flexibility, one can designate "ranges" where modifiers can differ (see tests).

With a bit more work, and a few more details, this could replace the existing Promotion->Entity system entirely, and would allow removing the Advanced and Elite technology hacks.

Test Plan

Check out the Athenian Hero Themistocles: he gains 100 HP when he gains a level. With D2296 the effect can stack.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
D274_techOverhaul
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 8911
Build 14625: Vulcan BuildJenkins
Build 14624: arc lint + arc unit

Event Timeline

wraitii created this revision.Aug 18 2019, 6:46 PM

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

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

Stan added a subscriber: Stan.Aug 18 2019, 7:12 PM

What's the difference between this and a status effect ?

binaries/data/mods/public/simulation/components/Promotion.js
149

Capital.

185

delete ?

In D2188#91103, @Stan wrote:

What's the difference between this and a status effect ?

This deals with "when to add a promotion modifier", and "what to add". I guess the "what" could be a permanent status effect... Needs some thinking.

Nescio added a subscriber: Nescio.Aug 19 2019, 11:20 AM
Nescio added inline comments.
binaries/data/mods/public/simulation/templates/units/brit_hero_caratacos.xml
11

This sounds great, but wouldn't it be better to follow the template format? E.g.

<Promotion>
  <Whatever from="0" until="1">
    <RequiredXp>10</RequiredXp>
    <Modifiers>
      <Health>
        <Max op="add">100</Max>
      </Health>
    </Modifiers>
  </Whatever>
</Promotion>

Also, I don't understand the necessity of the <Whatever> wrapper.

It could indeed be a permanent status effect.

binaries/data/mods/public/simulation/components/Promotion.js
202

When there is no requiredXP, it does not necesarrily mean XP is not to be added?
There may be scripted use cases (I do not have any yet). So we might consider moving this down to under the addition?

Stan added inline comments.Sep 10 2019, 5:28 PM
binaries/data/mods/public/simulation/templates/units/brit_hero_caratacos.xml
11

It would be used for different levels

like level1 to level2 etc.

Angen added a subscriber: Angen.Sep 10 2019, 7:06 PM
Angen added inline comments.
binaries/data/mods/public/simulation/components/Promotion.js
201

!! cheat promote unit is replacing requiredXp with 0, so this is breaking cheats

Can this add a "visual" modifier were the unit assets are changed? IE: Shields, Weapons, Helmets. This option for have an "upgradable" weapon-like system for assault rifles like upgrading to Scopes or Handgrips or even magazines.

I don't think so, perhaps with D1989 that would become possible?

Freagarach updated this revision to Diff 11489.EditedMar 16 2020, 8:27 PM
Freagarach retitled this revision from Allow Promotion to add arbitrary modifiers when a unit reaches the next rank instead of changing entities to Allow Promotion to add arbitrary modifiers when a unit reaches the next rank instead of changing entities..
Freagarach edited the test plan for this revision. (Show Details)
Freagarach added a reviewer: Restricted Owners Package.
  • Rebased.
  • Use StatusEffects.

Tests will fail, still some stuff to do.

Owners added a subscriber: Restricted Owners Package.Mar 16 2020, 8:27 PM

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

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

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

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

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/436/display/redirect

Stan added inline comments.Mar 16 2020, 11:50 PM
binaries/data/mods/public/simulation/components/Promotion.js
121

Array.find() ?

122

Maybe we should not call the function but use the members instead?

Nescio removed a subscriber: Nescio.Mar 17 2020, 6:52 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
| 827| 827| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 828| 828| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 829| 829| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 830|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 830|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 831| 831| 	}
| 832| 832| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 833| 833| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1660|1660| 			{
|1661|1661| 				minDist2 = dist2;
|1662|1662| 				minDistEntitySnapData = {
|1663|    |-						"x": pos.x,
|    |1663|+					"x": pos.x,
|1664|1664| 						"z": pos.z,
|1665|1665| 						"angle": cmpPosition.GetRotation().y,
|1666|1666| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1661|1661| 				minDist2 = dist2;
|1662|1662| 				minDistEntitySnapData = {
|1663|1663| 						"x": pos.x,
|1664|    |-						"z": pos.z,
|    |1664|+					"z": pos.z,
|1665|1665| 						"angle": cmpPosition.GetRotation().y,
|1666|1666| 						"ent": ent
|1667|1667| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1662|1662| 				minDistEntitySnapData = {
|1663|1663| 						"x": pos.x,
|1664|1664| 						"z": pos.z,
|1665|    |-						"angle": cmpPosition.GetRotation().y,
|    |1665|+					"angle": cmpPosition.GetRotation().y,
|1666|1666| 						"ent": ent
|1667|1667| 				};
|1668|1668| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
|1663|1663| 						"x": pos.x,
|1664|1664| 						"z": pos.z,
|1665|1665| 						"angle": cmpPosition.GetRotation().y,
|1666|    |-						"ent": ent
|    |1666|+					"ent": ent
|1667|1667| 				};
|1668|1668| 			}
|1669|1669| 		}
Executing section cli...

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

Stan added inline comments.Mar 25 2020, 3:12 PM
binaries/data/mods/public/simulation/components/ProductionQueue.js
111

!! not needed?

binaries/data/mods/public/simulation/components/Promotion.js
111

array.find ?

189

check for cmpPlayer?