Added Faith to stats

This commit is contained in:
Yair Morgenstern 2020-07-07 23:26:24 +03:00
parent 210011fb15
commit cb9687a1c9
2 changed files with 24 additions and 16 deletions

View File

@ -6,5 +6,6 @@ enum class Stat{
Gold, Gold,
Science, Science,
Culture, Culture,
Happiness Happiness,
Faith
} }

View File

@ -10,6 +10,7 @@ open class Stats() {
var science: Float=0f var science: Float=0f
var culture: Float=0f var culture: Float=0f
var happiness: Float=0f var happiness: Float=0f
var faith: Float=0f
constructor(hashMap: HashMap<Stat, Float>) : this() { constructor(hashMap: HashMap<Stat, Float>) : this() {
setStats(hashMap) setStats(hashMap)
@ -22,6 +23,7 @@ open class Stats() {
science = 0f science = 0f
culture = 0f culture = 0f
happiness = 0f happiness = 0f
faith = 0f
} }
fun add(other: Stats) { fun add(other: Stats) {
@ -32,6 +34,7 @@ open class Stats() {
science += other.science science += other.science
culture += other.culture culture += other.culture
happiness += other.happiness happiness += other.happiness
faith += other.faith
} }
@ -71,7 +74,9 @@ open class Stats() {
Stat.Gold to gold, Stat.Gold to gold,
Stat.Food to food, Stat.Food to food,
Stat.Happiness to happiness, Stat.Happiness to happiness,
Stat.Science to science) Stat.Science to science,
Stat.Faith to faith
)
} }
fun get(stat:Stat):Float{ fun get(stat:Stat):Float{
@ -85,6 +90,7 @@ open class Stats() {
food = hashMap[Stat.Food]!! food = hashMap[Stat.Food]!!
happiness = hashMap[Stat.Happiness]!! happiness = hashMap[Stat.Happiness]!!
science = hashMap[Stat.Science]!! science = hashMap[Stat.Science]!!
faith = hashMap[Stat.Faith]!!
} }
fun equals(otherStats: Stats):Boolean { fun equals(otherStats: Stats):Boolean {
@ -94,6 +100,7 @@ open class Stats() {
&& food == otherStats.food && food == otherStats.food
&& happiness == otherStats.happiness && happiness == otherStats.happiness
&& science == otherStats.science && science == otherStats.science
&& faith == otherStats.faith
} }
} }