Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_Damage.js
Show All 34 Lines | let cmpAttack = ConstructComponent(attacker, "Attack", | ||||
}, | }, | ||||
"MaxRange": 50, | "MaxRange": 50, | ||||
"MinRange": 0, | "MinRange": 0, | ||||
"Delay": 0, | "Delay": 0, | ||||
"Projectile": { | "Projectile": { | ||||
"Speed": 75.0, | "Speed": 75.0, | ||||
"Spread": 0.5, | "Spread": 0.5, | ||||
"Gravity": 9.81, | "Gravity": 9.81, | ||||
"FriendlyFire": false, | |||||
Stan: Shouldn't that be text, as it would be in the template ? | |||||
"LaunchPoint": { "@y": 3 } | "LaunchPoint": { "@y": 3 } | ||||
} | } | ||||
} | } | ||||
}); | }); | ||||
let damage = 5; | let damage = 5; | ||||
let target = 21; | let target = 21; | ||||
let targetOwner = 7; | let targetOwner = 7; | ||||
let targetPos = new Vector3D(3, 0, 3); | let targetPos = new Vector3D(3, 0, 3); | ||||
▲ Show 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | function Test_MissileHit() | ||||
let data = { | let data = { | ||||
"type": "Ranged", | "type": "Ranged", | ||||
"attackData": { "Damage": { "Hack": 0, "Pierce": 100, "Crush": 0 } }, | "attackData": { "Damage": { "Hack": 0, "Pierce": 100, "Crush": 0 } }, | ||||
"target": 60, | "target": 60, | ||||
"attacker": 70, | "attacker": 70, | ||||
"attackerOwner": 1, | "attackerOwner": 1, | ||||
"position": targetPos, | "position": targetPos, | ||||
"direction": new Vector3D(1, 0, 0), | "direction": new Vector3D(1, 0, 0), | ||||
"projectileId": 9, | "projectileId": 9, | ||||
"friendlyFire": "false", | |||||
}; | }; | ||||
Done Inline ActionsIsn't it supposed to be a "false" string ? Stan: Isn't it supposed to be a "false" string ? | |||||
AddMock(SYSTEM_ENTITY, IID_PlayerManager, { | AddMock(SYSTEM_ENTITY, IID_PlayerManager, { | ||||
"GetPlayerByID": id => id == 1 ? 10 : 11, | "GetPlayerByID": id => id == 1 ? 10 : 11, | ||||
"GetAllPlayers": () => [0, 1] | "GetAllPlayers": () => [0, 1] | ||||
}); | }); | ||||
AddMock(SYSTEM_ENTITY, IID_ProjectileManager, { | AddMock(SYSTEM_ENTITY, IID_ProjectileManager, { | ||||
"RemoveProjectile": () => {}, | "RemoveProjectile": () => {}, | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | AddMock(61, IID_Footprint, { | ||||
"GetShape": () => ({ "type": "circle", "radius": 20 }), | "GetShape": () => ({ "type": "circle", "radius": 20 }), | ||||
}); | }); | ||||
cmpDelayedDamage.MissileHit(data, 0); | cmpDelayedDamage.MissileHit(data, 0); | ||||
TS_ASSERT(hitEnts.has(61)); | TS_ASSERT(hitEnts.has(61)); | ||||
hitEnts.clear(); | hitEnts.clear(); | ||||
// Add a splash damage. | // Add a splash damage. | ||||
data.splash = {}; | data.splash = {}; | ||||
data.splash.friendlyFire = false; | data.splash.friendlyFire = false; | ||||
data.splash.radius = 10; | data.splash.radius = 10; | ||||
data.splash.shape = "Circular"; | data.splash.shape = "Circular"; | ||||
data.splash.attackData = { "Damage": { "Hack": 0, "Pierce": 0, "Crush": 200 } }; | data.splash.attackData = { "Damage": { "Hack": 0, "Pierce": 0, "Crush": 200 } }; | ||||
Done Inline ActionsMaybe data.splash = { "friendlyFire": "false", "radius": 10, "shape": "Circular" }; Stan: Maybe
```lang=js
data.splash = {
"friendlyFire": "false",
"radius": 10,
"shape"… | |||||
AddMock(SYSTEM_ENTITY, IID_RangeManager, { | AddMock(SYSTEM_ENTITY, IID_RangeManager, { | ||||
"ExecuteQueryAroundPos": () => [61, 62] | "ExecuteQueryAroundPos": () => [61, 62] | ||||
}); | }); | ||||
let dealtDamage = 0; | let dealtDamage = 0; | ||||
AddMock(61, IID_Health, { | AddMock(61, IID_Health, { | ||||
"TakeDamage": (effectData, __, ___, mult) => { | "TakeDamage": (effectData, __, ___, mult) => { | ||||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Shouldn't that be text, as it would be in the template ?