| 1 |
Interesting.
|
1 |
Interesting.
|
| 2 |
I
haven't
looked
through
the
whole
but
this
seems
counterintuitive:
|
2 |
I
haven't
looked
through
the
whole
code
but
this
seems
counterintuitive:
|
| 3 |
\n
|
3 |
\n
|
| 4 |
[quote]-- Metal, discounted by how much of the unit is left. A Minotaur down to a third of its
|
4 |
[quote]-- Metal, discounted by how much of the unit is left. A Minotaur down to a third of its
|
| 5 |
-- health is not a third of a Minotaur in a fight, but it is a great deal less than one,
|
5 |
-- health is not a third of a Minotaur in a fight, but it is a great deal less than one,
|
| 6 |
-- and counting it whole is the error that makes a losing push look winnable.
|
6 |
-- and counting it whole is the error that makes a losing push look winnable.
|
| 7 |
local function UnitValue(unitID, defID)
|
7 |
local function UnitValue(unitID, defID)
|
| 8 |
local base = (spuGetUnitCost and spuGetUnitCost(unitID, defID)) or cost[defID] or 0
|
8 |
local base = (spuGetUnitCost and spuGetUnitCost(unitID, defID)) or cost[defID] or 0
|
| 9 |
local hp, maxHp = spGetUnitHealth(unitID)
|
9 |
local hp, maxHp = spGetUnitHealth(unitID)
|
| 10 |
if hp and maxHp and maxHp > 0 then
|
10 |
if hp and maxHp and maxHp > 0 then
|
| 11 |
local frac = hp / maxHp
|
11 |
local frac = hp / maxHp
|
| 12 |
if frac < 0.05 then
|
12 |
if frac < 0.05 then
|
| 13 |
frac = 0.05
|
13 |
frac = 0.05
|
| 14 |
elseif frac > 1 then
|
14 |
elseif frac > 1 then
|
| 15 |
frac = 1
|
15 |
frac = 1
|
| 16 |
end
|
16 |
end
|
| 17 |
return base * frac
|
17 |
return base * frac
|
| 18 |
end
|
18 |
end
|
| 19 |
return base
|
19 |
return base
|
| 20 |
end[/quote]
|
20 |
end[/quote]
|
| 21 |
\n
|
21 |
\n
|
| 22 |
\n
|
22 |
\n
|
| 23 |
The description does not actually do what is says.
|
23 |
The description does not actually do what is says.
|
| 24 |
Can't it just be simplified to:
|
24 |
Can't it just be simplified to:
|
| 25 |
(hp / maxHP) * unitCost
|
25 |
(hp / maxHP) * unitCost
|
| 26 |
?
|
26 |
?
|
| 27 |
\n
|
27 |
\n
|
| 28 |
Also in what situation does the game return more HP than maxHP and why shouldn't it be accounted for?
|
28 |
Also in what situation does the game return more HP than maxHP and why shouldn't it be accounted for?
|