From 815ab5b3721e0084f35f693e1d976b0d3fb76794 Mon Sep 17 00:00:00 2001 From: Matt Soucy Date: Sun, 1 Dec 2019 20:16:51 -0500 Subject: [PATCH] Fix statistics --- build.gradle | 2 +- core/src/me/msoucy/ptures/model/Creature.kt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 632fd46..d2b2c29 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlinVersion = '1.3.60' + ext.kotlinVersion = '1.3.61' repositories { mavenLocal() diff --git a/core/src/me/msoucy/ptures/model/Creature.kt b/core/src/me/msoucy/ptures/model/Creature.kt index 093aa1b..f1ce883 100644 --- a/core/src/me/msoucy/ptures/model/Creature.kt +++ b/core/src/me/msoucy/ptures/model/Creature.kt @@ -15,9 +15,9 @@ class Creature { val statuses = mutableListOf() val atk : Int get() = statFormula(genes.atk, growth.atk) - val def : Int get() = statFormula(genes.atk, growth.atk) - val spd : Int get() = statFormula(genes.atk, growth.atk) - val maxHp : Int get() = statFormula(genes.atk, growth.atk) + val def : Int get() = statFormula(genes.def, growth.def) + val spd : Int get() = statFormula(genes.spd, growth.spd) + val maxHp : Int get() = hpStatFormula(genes.hp, growth.hp) fun apply(dmg : Damage, attacker : Creature) { val critical = if (random(32) < attacker.genes.spd) { 1.5 } else { 1.0 } @@ -61,4 +61,5 @@ class Creature { inline fun hasStatus() = statuses.filterIsInstance().isNotEmpty() 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 } \ No newline at end of file