- Timestamp:
- 08/09/11 20:42:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/simulation/components/Promotion.js
r9663 r9984 52 52 cmpPromotedUnitOwnership.SetOwner(cmpCurrentUnitOwnership.GetOwner()); 53 53 54 // change promoted unit health to the same percent of hitpoints as unit had before promotion 55 var cmpCurrentUnitHealth = Engine.QueryInterface(this.entity, IID_Health); 56 var cmpPromotedUnitHealth = Engine.QueryInterface(promotedUnitEntity, IID_Health); 57 var healthFraction = Math.max(0, Math.min(1, cmpCurrentUnitHealth.GetHitpoints() / cmpCurrentUnitHealth.GetMaxHitpoints())); 58 var promotedUnitHitpoints = Math.round(cmpPromotedUnitHealth.GetMaxHitpoints() * healthFraction); 59 cmpPromotedUnitHealth.SetHitpoints(promotedUnitHitpoints); 60 54 61 var cmpPromotedUnitPromotion = Engine.QueryInterface(promotedUnitEntity, IID_Promotion); 55 62 if (cmpPromotedUnitPromotion)
Note:
See TracChangeset
for help on using the changeset viewer.
