Opened 10 years ago

Last modified 4 years ago

#2706 closed enhancement

[PATCH] Allow individual entities to upgrade to other entities — at Initial Version

Reported by: wraitii Owned by:
Priority: Nice to Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

(this is not a duplicate of #1919 though the behavior can be similar)

The attached patch implements an "Upgrade" component which allows to upgrade individual entities to other entities. It allows any entity to transform into any other. Usage examples would be: upgrading individual units to their advanced or elite form, upgrading individual towers. It is not meant to upgrade all of a buildings' type (ie a wall strength technology for example).

It checks for entity limit counts and updates them appropriately, and can check for buildRestrictions.

It can take a required technology or use the upgraded template's default. It can take a cost and a "time" to upgrade (those two currently can't be derived form the upgraded template but that could be added). It supports multiple possible upgrades (though they are mutually exclusive). It supports having a custom icon and a custom tooltip information. It also supports using {civ}.

It currently does not pass all data (such as trainingqueue, experience…) to the new entity. It reimburses the player fully if the upgrade is cancelled or the building destroyed, to mimic foundations.

Attached patch also changes the "Long wall->Gate" transformation to use this system and removes obsolete code.

As in #1919, this has some duplicate code with promotion. I think we should move the actual "replacing" code to a helper since it will be similar in #1919, promotion, and this patch. I think however the behavior of packing/unpacking is different enough from upgrading that it should be kept separate.

Change History (2)

by wraitii, 10 years ago

Attachment: UpgradeComponent.patch added

by wraitii, 10 years ago

Attachment: UpgradeComponent.2.patch added

Updated.

Note: See TracTickets for help on using tickets.