Created
March 21, 2018 02:13
-
-
Save starhoshi/8911f5fea79210f2c68b9c24fa8239d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func calcStat(statType: StatType, level: Int, iv: Int, effort: Int, nature: NatureEffectType = .notChange) -> Int { | |
let baseStat: Int | |
switch statType { | |
case .h(let h): | |
return calcHPStat(h: h, level: level, iv: iv, effort: effort) | |
case .a(let a): | |
baseStat = a | |
case .b(let b): | |
baseStat = b | |
case .c(let c): | |
baseStat = c | |
case .d(let d): | |
baseStat = d | |
case .s(let s): | |
baseStat = s | |
} | |
let float = Float((baseStat * 2) + iv + (effort / 4)) | |
let base = Int((float * (Float(level) / 100)) + 5) | |
return Int(Float(base) * nature.rawValue) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line18 でクラッシュ