1
0
forked from mirrors/0ad

Let splash radius be affected by modifications and rename GetSplashDamage to GetSplashData.

Differential Revision: https://code.wildfiregames.com/D2370
Patch by: @Freagarach
Comments by: Stan
This was SVN commit r23378.
This commit is contained in:
Angen
2020-01-12 13:37:14 +00:00
parent a84a896672
commit 19f4e3ef28
3 changed files with 9 additions and 12 deletions
@@ -412,14 +412,15 @@ Attack.prototype.GetTimers = function(type)
return { "prepare": prepare, "repeat": repeat };
};
Attack.prototype.GetSplashDamage = function(type)
Attack.prototype.GetSplashData = function(type)
{
if (!this.template[type].Splash)
return false;
return;
return {
"attackData": this.GetAttackEffectsData(type, true),
"friendlyFire": this.template[type].Splash.FriendlyFire != "false",
"radius": ApplyValueModificationsToEntity("Attack/" + type + "/Splash/Range", +this.template[type].Splash.Range, this.entity),
"shape": this.template[type].Splash.Shape,
};
};
@@ -535,15 +536,10 @@ Attack.prototype.PerformAttack = function(type, target)
"position": realTargetPosition,
"direction": missileDirection,
"projectileId": id,
"attackImpactSound": attackImpactSound
"attackImpactSound": attackImpactSound,
"splash": this.GetSplashData(type),
};
if (this.template[type].Splash)
data.splash = {
"friendlyFire": this.template[type].Splash.FriendlyFire != "false",
"radius": +this.template[type].Splash.Range,
"shape": this.template[type].Splash.Shape,
"attackData": this.GetAttackEffectsData(type, true),
};
cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_DelayedDamage, "MissileHit", +this.template[type].Delay + timeToTarget * 1000, data);
}
else
@@ -418,7 +418,7 @@ GuiInterface.prototype.GetEntityState = function(player, ent)
Object.assign(ret.attack[type], cmpAttack.GetAttackEffectsData(type));
ret.attack[type].splash = cmpAttack.GetSplashDamage(type);
ret.attack[type].splash = cmpAttack.GetSplashData(type);
if (ret.attack[type].splash)
Object.assign(ret.attack[type].splash, cmpAttack.GetAttackEffectsData(type, true));
@@ -184,7 +184,7 @@ attackComponentTest(undefined, true, (attacker, cmpAttack, defender) => {
"repeat": 1000
});
TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetSplashDamage("Ranged"), {
TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetSplashData("Ranged"), {
"attackData": {
"Damage": {
"Hack": 0,
@@ -199,6 +199,7 @@ attackComponentTest(undefined, true, (attacker, cmpAttack, defender) => {
}
},
"friendlyFire": false,
"radius": 10,
"shape": "Circular"
});
});