Skip to content

Commit 73c389f

Browse files
pdbethkeclaude
andcommitted
fix: AreaEffect.total_value reads the MINVAL-clamped levels, not the raw field
Java's getTotalValue calls getLevels(), and GenericObject.getLevels (GenericObject.java:1996-2002) floors at minVal — AOE's template states MINVAL="1", so a document that writes LEVELS="0" (kirby-api's Inferna fixture does) still prices a 1m radius instead of raising log(0). Same defect class as Modifier.total_value, fixed yesterday. 1724 passed; corpus parity unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrVDXgpDfQpzEGErZTLjEs
1 parent 58c346e commit 73c389f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

kirby_cost/objects/modifiers/areaeffect.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,18 @@ def total_value(self) -> float:
9797
lp = self.level_power
9898
lm = self.level_multiplier
9999
if lp > 0 and lm > 0:
100-
n2 = int(math.ceil(math.log(float(self._levels) / float(lm)) / math.log(lp)))
100+
# The MINVAL-clamped accessor, not the raw field: Java's
101+
# getTotalValue reads getLevels(), and GenericObject.getLevels
102+
# (GenericObject.java:1996-2002) floors at minVal — AOE's
103+
# template states MINVAL="1", so a document that writes no
104+
# LEVELS still prices a 1m radius instead of feeding log(0).
105+
levels = self.levels
106+
n2 = int(math.ceil(math.log(float(levels) / float(lm)) / math.log(lp)))
101107
if n2 < 1:
102108
n2 = 1
103109
# Special case: IMAGES power at level 1 gets 0 level cost
104110
progenitor = self.progenitor
105-
if progenitor is not None and progenitor.xmlid == "IMAGES" and self._levels == 1:
111+
if progenitor is not None and progenitor.xmlid == "IMAGES" and levels == 1:
106112
n2 = 0
107113
d += float(n2) * self._level_cost
108114

0 commit comments

Comments
 (0)