Skip to content

Commit

Permalink
tdps.lic - Corrected tdp cost calculation method
Browse files Browse the repository at this point in the history
The previous method gave some errors with certain racial modifiers, the correction fixes that and should now give exact calculations.
  • Loading branch information
BinuDR authored Oct 5, 2023
1 parent c37ef0d commit d2ef9a1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tdps.lic
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def cost(current, modifier)
cost = 0
start = 10 - 2 * modifier
for i in start..current - 1 do
mult = i < 100 ? 3 : 15
mod = (modifier.to_f * i / 2).truncate
cost += (i * mult) + mod
cost += i * (i < 100 ? 3 : 15) + modifier * (i / 2).floor(0)
end
return cost
end
Expand Down Expand Up @@ -52,7 +50,7 @@ else
end

# Calcuate total TDPs spent for each stat
costs = []
costs = Array.new(8)
for i in 0..7
costs[i] = cost(stats[i], mods[i])
end
Expand Down

0 comments on commit d2ef9a1

Please sign in to comment.