silphius/resources/magic-swords/collision-start.js

13 lines
421 B
JavaScript
Raw Normal View History

2024-07-26 10:36:59 -05:00
const playerEntity = ecs.lookupPlayerEntity(entity.Owned.owner);
if (playerEntity !== other && other.Vulnerable) {
2024-07-27 12:31:52 -05:00
const magnitude = Math.floor(Math.random() * 2)
2024-07-27 09:47:17 -05:00
other.Vulnerable.damage({
2024-07-27 12:31:52 -05:00
amount: -Math.floor(
2024-07-27 09:47:17 -05:00
Math.pow(10, magnitude)
+ Math.random() * (Math.pow(10, magnitude + 1) - Math.pow(10, magnitude)),
),
position: other.Position.toJSON(),
2024-07-27 10:52:49 -05:00
type: other.Vulnerable.Types.PAIN,
2024-07-27 09:47:17 -05:00
})
2024-07-26 10:36:59 -05:00
}