Made it so crits ignore defense boosts and elements use enumerations for type effectiveness

This commit is contained in:
dalyjame
2019-06-24 16:51:31 -04:00
parent 4d456d7e5d
commit 7c9942066f
8 changed files with 373 additions and 347 deletions

View File

@@ -148,12 +148,17 @@ abstract class Move extends MoveTurn {
if (damageCallback != null) {
damageCallback(user, this, target, reader, rng)
} else {
val crit = critMultiplier(user, target)
println(crit)
val atkStat = if (category == MoveType.Physical) PAtk else MAtk
val defStat = if (category == MoveType.Physical) PDef else MDef
val atk = if (crit > 1.0) Math.max(user(atkStat), user.stats(atkStat)) else user(atkStat)
val defense = if (crit > 1.0) Math.min(target(defStat), target.stats(defStat)) else user(defStat)
println(target(defStat), target.stats(defStat), defense)
val actualPow = if (powCallback != null) powCallback(user, this, target, reader, rng) else pow
val baseDmg = (2 * user.level / 5 + 2) * actualPow * user(atkStat) / (target(defStat) * 50) + 2
val baseDmg = (2 * user.level / 5 + 2) * actualPow * atk / (defense * 50) + 2
val effectiveness = target.effectiveness(element)
val multiplier = effectiveness * critMultiplier(user, target) * stabMultiplier(user)
val multiplier = effectiveness * crit * stabMultiplier(user)
if (effectiveness > 1.0) {
reader ! Message("It's super effective!")
} else if (effectiveness < 1.0) {