13 lines
421 B
JavaScript
13 lines
421 B
JavaScript
const playerEntity = ecs.lookupPlayerEntity(entity.Owned.owner);
|
|
if (playerEntity !== other && other.Vulnerable) {
|
|
const magnitude = Math.floor(Math.random() * 2)
|
|
other.Vulnerable.damage({
|
|
amount: -Math.floor(
|
|
Math.pow(10, magnitude)
|
|
+ Math.random() * (Math.pow(10, magnitude + 1) - Math.pow(10, magnitude)),
|
|
),
|
|
position: other.Position.toJSON(),
|
|
type: other.Vulnerable.Types.PAIN,
|
|
})
|
|
}
|