mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 13:04:10 +00:00
Fix the missing health bug when an unit is promoted. Promotion component should not do the job of the Health component. Patch by Grugnas.
Accepted by FeXoR. Differential Revision: https://code.wildfiregames.com/D409 This was SVN commit r19995.
This commit is contained in:
@@ -59,7 +59,7 @@ Promotion.prototype.Promote = function(promotedTemplateName)
|
||||
// change promoted unit health to the same percent of hitpoints as unit had before promotion
|
||||
var cmpPromotedUnitHealth = Engine.QueryInterface(promotedUnitEntity, IID_Health);
|
||||
var healthFraction = Math.max(0, Math.min(1, cmpCurrentUnitHealth.GetHitpoints() / cmpCurrentUnitHealth.GetMaxHitpoints()));
|
||||
var promotedUnitHitpoints = Math.round(cmpPromotedUnitHealth.GetMaxHitpoints() * healthFraction);
|
||||
var promotedUnitHitpoints = cmpPromotedUnitHealth.GetMaxHitpoints() * healthFraction;
|
||||
cmpPromotedUnitHealth.SetHitpoints(promotedUnitHitpoints);
|
||||
|
||||
var cmpPromotedUnitPromotion = Engine.QueryInterface(promotedUnitEntity, IID_Promotion);
|
||||
|
||||
Reference in New Issue
Block a user