Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_Damage.js
Show All 29 Lines | function Test_Generic() | ||||
let atkPlayerEntity = 1; | let atkPlayerEntity = 1; | ||||
let attackerOwner = 6; | let attackerOwner = 6; | ||||
let cmpAttack = ConstructComponent(attacker, "Attack", | let cmpAttack = ConstructComponent(attacker, "Attack", | ||||
{ | { | ||||
"Ranged": { | "Ranged": { | ||||
"MaxRange": 50, | "MaxRange": 50, | ||||
"MinRange": 0, | "MinRange": 0, | ||||
"Delay": 0, | "Delay": 0, | ||||
"FriendlyFire": "false", | |||||
"Projectile": { | "Projectile": { | ||||
"Speed": 75.0, | "Speed": 75.0, | ||||
"Spread": 0.5, | "Spread": 0.5, | ||||
"Gravity": 9.81, | "Gravity": 9.81, | ||||
"LaunchPoint": { "@y": 3 } | "LaunchPoint": { "@y": 3 } | ||||
Stan: Shouldn't that be text, as it would be in the template ? | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
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); | ||||
let type = "Melee"; | let type = "Melee"; | ||||
let damageTaken = false; | let damageTaken = false; | ||||
cmpAttack.GetAttackStrengths = attackType => ({ "hack": 0, "pierce": 0, "crush": damage }); | cmpAttack.GetAttackStrengths = attackType => ({ "hack": 0, "pierce": 0, "crush": damage }); | ||||
let data = { | let data = { | ||||
"attacker": attacker, | "attacker": attacker, | ||||
"target": target, | "target": target, | ||||
"type": "Melee", | "type": "Melee", | ||||
"strengths": { "hack": 0, "pierce": 0, "crush": damage }, | "strengths": { "hack": 0, "pierce": 0, "crush": damage }, | ||||
"multiplier": 1.0, | "multiplier": 1.0, | ||||
"attackerOwner": attackerOwner, | "attackerOwner": attackerOwner, | ||||
"position": targetPos, | "position": targetPos, | ||||
"isSplash": false, | "isSplash": false, | ||||
"friendlyFire": "false", | |||||
"projectileId": 9, | "projectileId": 9, | ||||
"direction": new Vector3D(1,0,0) | "direction": new Vector3D(1,0,0) | ||||
}; | }; | ||||
AddMock(atkPlayerEntity, IID_Player, { | AddMock(atkPlayerEntity, IID_Player, { | ||||
"GetEnemies": () => [targetOwner] | "GetEnemies": () => [targetOwner] | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | let data = { | ||||
"type": "Ranged", | "type": "Ranged", | ||||
"attacker": 70, | "attacker": 70, | ||||
"target": 60, | "target": 60, | ||||
"strengths": { "hack": 0, "pierce": 100, "crush": 0 }, | "strengths": { "hack": 0, "pierce": 100, "crush": 0 }, | ||||
"position": targetPos, | "position": targetPos, | ||||
"direction": new Vector3D(1, 0, 0), | "direction": new Vector3D(1, 0, 0), | ||||
"projectileId": 9, | "projectileId": 9, | ||||
"bonus": undefined, | "bonus": undefined, | ||||
"isSplash": false, | "isSplash": false, | ||||
"friendlyFire": "false", | |||||
Done Inline ActionsIsn't it supposed to be a "false" string ? Stan: Isn't it supposed to be a "false" string ? | |||||
"attackerOwner": 1 | "attackerOwner": 1 | ||||
}; | }; | ||||
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] | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | function Test_MissileHit() | ||||
hitEnts.clear(); | hitEnts.clear(); | ||||
// Add a splash damage. | // Add a splash damage. | ||||
data.friendlyFire = false; | data.friendlyFire = false; | ||||
data.radius = 10; | data.radius = 10; | ||||
data.shape = "Circular"; | data.shape = "Circular"; | ||||
data.isSplash = true; | data.isSplash = true; | ||||
data.splashStrengths = { "hack": 0, "pierce": 0, "crush": 200 }; | data.splashStrengths = { "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_DamageReceiver, { | AddMock(61, IID_DamageReceiver, { | ||||
"TakeDamage": (strengths, multiplier) => { | "TakeDamage": (strengths, multiplier) => { | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Shouldn't that be text, as it would be in the template ?