Coverage Summary for Class: LevelAware (com.galarzaa.tibiakt.core.domain.character)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| LevelAware |
0%
(0/1)
|
|
0%
(0/3)
|
0%
(0/33)
|
| LevelAware$DefaultImpls |
0%
(0/1)
|
|
0%
(0/1)
|
0%
(0/2)
|
| Total |
0%
(0/2)
|
|
0%
(0/4)
|
0%
(0/35)
|
/*
* 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.domain.character
import kotlin.math.ceil
import kotlin.math.floor
/** A character with a level attribute. */
public interface LevelAware {
/**
* The character's level up.
*/
public val level: Int
/**
* The party shared experience range of the character.
*/
public val shareRange: IntRange
get() {
val minLevel = floor((level / 3.0) * 2).toInt()
val maxLevel = ceil((level / 2.0) * 3).toInt() + if (level % 2 == 0) 1 else 0
return minLevel..maxLevel
}
}