Current scope: tibiakt-core| all classes
|
com.galarzaa.tibiakt.core.section.community.character.model
Coverage Summary for Class: Death (com.galarzaa.tibiakt.core.section.community.character.model)
| Class | Method, % | Branch, % | Line, % | Instruction, % |
|---|---|---|---|---|
| Death | 66.7% (2/3) | 0% (0/8) | 75% (6/8) | 63.8% (90/141) |
| Death$Companion | 0% (0/1) | 0% (0/1) | 0% (0/2) | |
| Total | 50% (2/4) | 0% (0/8) | 66.7% (6/9) | 62.9% (90/143) |
/*
* Copyright © 2025 Allan Galarza
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.galarzaa.tibiakt.core.section.community.character.model
import kotlinx.serialization.Serializable
import kotlin.time.Instant
/**
* A death by a [character][CharacterInfo].
*
* @property occurredAt The date and time when the death happened.
* @property level The level of the character when they died.
* @property killers The list of killers.
* @property assists The list of characters that helped in the death without dealing damage.
*/
@Serializable
public data class Death(
val occurredAt: Instant,
val level: Int,
val killers: List<DeathParticipant>,
val assists: List<DeathParticipant>,
) {
/**
* Whether this death was caused by players.
*/
val isByPlayers: Boolean
get() = killers.any { it is DeathParticipant.Player || it is DeathParticipant.Summon } ||
assists.any { it is DeathParticipant.Player || it is DeathParticipant.Summon }
}