Fix statistics
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
buildscript {
 | 
			
		||||
    ext.kotlinVersion = '1.3.60'
 | 
			
		||||
    ext.kotlinVersion = '1.3.61'
 | 
			
		||||
 | 
			
		||||
    repositories {
 | 
			
		||||
        mavenLocal()
 | 
			
		||||
 
 | 
			
		||||
@@ -15,9 +15,9 @@ class Creature {
 | 
			
		||||
    val statuses = mutableListOf<Status>()
 | 
			
		||||
 | 
			
		||||
    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 <reified S : Status> hasStatus() = statuses.filterIsInstance<S>().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
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user