Fix statistics
This commit is contained in:
parent
e9f4b367a6
commit
815ab5b372
@ -1,5 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlinVersion = '1.3.60'
|
ext.kotlinVersion = '1.3.61'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
@ -15,9 +15,9 @@ class Creature {
|
|||||||
val statuses = mutableListOf<Status>()
|
val statuses = mutableListOf<Status>()
|
||||||
|
|
||||||
val atk : Int get() = statFormula(genes.atk, growth.atk)
|
val atk : Int get() = statFormula(genes.atk, growth.atk)
|
||||||
val def : Int get() = statFormula(genes.atk, growth.atk)
|
val def : Int get() = statFormula(genes.def, growth.def)
|
||||||
val spd : Int get() = statFormula(genes.atk, growth.atk)
|
val spd : Int get() = statFormula(genes.spd, growth.spd)
|
||||||
val maxHp : Int get() = statFormula(genes.atk, growth.atk)
|
val maxHp : Int get() = hpStatFormula(genes.hp, growth.hp)
|
||||||
|
|
||||||
fun apply(dmg : Damage, attacker : Creature) {
|
fun apply(dmg : Damage, attacker : Creature) {
|
||||||
val critical = if (random(32) < attacker.genes.spd) { 1.5 } else { 1.0 }
|
val critical = if (random(32) < attacker.genes.spd) { 1.5 } else { 1.0 }
|
||||||
@ -61,4 +61,5 @@ class Creature {
|
|||||||
inline fun <reified S : Status> hasStatus() = statuses.filterIsInstance<S>().isNotEmpty()
|
inline fun <reified S : Status> hasStatus() = statuses.filterIsInstance<S>().isNotEmpty()
|
||||||
|
|
||||||
private fun statFormula(gene : Int, growth : Int) = (2 * gene + growth / 4) * level / 100 + 5
|
private fun statFormula(gene : Int, growth : Int) = (2 * gene + growth / 4) * level / 100 + 5
|
||||||
|
private fun hpStatFormula(gene : Int, growth : Int) = (2 * gene + growth / 4) * level / 100 + level + 10
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user