Skip to content
Snippets Groups Projects
Commit 90528d6a authored by phenixceleste's avatar phenixceleste
Browse files

useCapcity returns Unit

parent ca96bce0
No related branches found
No related tags found
1 merge request!16Resolve "Add random fight response"
Pipeline #9753 failed with stage
in 1 minute and 41 seconds
......@@ -25,7 +25,7 @@ trait Pokemon(
def speed: Int = 5 + scala.math.floor(2.0 * this.baseSpeed * this.level / 100.0).toInt
def maxLife: Int = scala.math.floor(2.0 * this.baseSpeed * this.level / 100.0).toInt + 10 + this.level
def useCapacity(capacity: Capacity, other: Pokemon): Boolean =
def useCapacity(capacity: Capacity, other: Pokemon): Unit =
assert(capacity.isUsable, "This capacity is not usable.")
......@@ -41,10 +41,9 @@ trait Pokemon(
other.decreaseLife(Math.round(damage.toFloat))
def decreaseLife(x: Int): Boolean =
def decreaseLife(x: Int): Unit =
if this.life - x <= 0 then this._life = 0
else this._life = this.life - x
this.isAlive
def isAlive: Boolean = this.life != 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment