Skip to content

Instantly share code, notes, and snippets.

@starhoshi
Created March 21, 2018 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starhoshi/8911f5fea79210f2c68b9c24fa8239d8 to your computer and use it in GitHub Desktop.
Save starhoshi/8911f5fea79210f2c68b9c24fa8239d8 to your computer and use it in GitHub Desktop.
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)
}
@starhoshi
Copy link
Author

line18 でクラッシュ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment