package ru.dbotthepony.kstarbound.defs

import ru.dbotthepony.kstarbound.json.builder.JsonFactory

@JsonFactory
data class ActorMovementModifiers(
	val groundMovementModifier: Double = 0.0,
	val liquidMovementModifier: Double = 0.0,
	val speedModifier: Double = 0.0,
	val airJumpModifier: Double = 0.0,
	val liquidJumpModifier: Double = 0.0,
	val runningSuppressed: Boolean = false,
	val jumpingSuppressed: Boolean = false,
	val movementSuppressed: Boolean = false,
	val facingSuppressed: Boolean = false,
) {
	fun combine(other: ActorMovementModifiers): ActorMovementModifiers {
		return ActorMovementModifiers(
			groundMovementModifier = groundMovementModifier * other.groundMovementModifier,
			liquidMovementModifier = liquidMovementModifier * other.liquidMovementModifier,
			speedModifier = speedModifier * other.speedModifier,
			airJumpModifier = airJumpModifier * other.airJumpModifier,
			liquidJumpModifier = liquidJumpModifier * other.liquidJumpModifier,
			runningSuppressed = runningSuppressed || other.runningSuppressed,
			jumpingSuppressed = jumpingSuppressed || other.jumpingSuppressed,
			movementSuppressed = movementSuppressed || other.movementSuppressed,
			facingSuppressed = facingSuppressed || other.facingSuppressed,
		)
	}
}
