Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion backend/app/parsers/monster_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,37 @@ def parse_single_monster(
depth -= 1
i += 1
init_block = content[start : i - 1]
# AfterAddedToRoom often delegates its combat-start setup to a private helper
# rather than writing every PowerCmd.Apply inline. Lagavulin Matriarch, for
# instance, calls `await Sleep();` and applies its innate Plating inside
# Sleep(). Follow local same-class method calls (await Foo(...) where Foo is a
# method defined in this file, not base.X / Cmd.X) so those applied powers are
# captured too. Bounded to a couple of levels with a visited set.
scan_block = init_block
seen_helpers: set[str] = set()
frontier = [init_block]
hops = 0
while frontier and hops < 8:
block = frontier.pop()
for call in re.finditer(r"\bawait\s+(\w+)\s*\(", block):
helper = call.group(1)
if helper in seen_helpers or helper == "AfterAddedToRoom":
continue
# Only follow methods actually DEFINED in this class (a private/
# protected/etc. helper); the modifier prefix excludes bare framework
# calls and `await base.X()` (which has no local definition here).
helper_body = _extract_method_body(
content,
r"(?:private|protected|internal|public)[^\n;{]*\b"
+ re.escape(helper)
+ r"\s*\(",
)
if helper_body is None:
continue
seen_helpers.add(helper)
scan_block += "\n" + helper_body
frontier.append(helper_body)
hops += 1
# v0.104+ added an optional context arg before the target, same as the
# move-effects regex above:
# OLD: PowerCmd.Apply<ArtifactPower>(base.Creature, 3m, ...)
Expand All @@ -1054,7 +1085,7 @@ def parse_single_monster(
# no `<Power>` token and is still not captured here.
for pm in re.finditer(
r"PowerCmd\.Apply<(\w+)>\(\s*(?:new\s+\w+\([^)]*\)\s*,\s*)?[\w.]+\s*,\s*(\w+?)m?\b",
init_block,
scan_block,
):
power_name = pm.group(1).replace("Power", "")
amount_ref = pm.group(2)
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/deu/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/eng/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/esp/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/fra/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/ita/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/jpn/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/kor/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/pol/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/ptb/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/rus/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/spa/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/tha/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/tur/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data-beta/v0.108.0/zhs/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data/deu/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4572,7 +4572,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data/eng/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4572,7 +4572,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data/esp/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4572,7 +4572,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data/fra/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4572,7 +4572,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
11 changes: 10 additions & 1 deletion data/ita/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4572,7 +4572,16 @@
"is_weak": false
}
],
"innate_powers": null,
"innate_powers": [
{
"power_id": "PLATING",
"amount": 12
},
{
"power_id": "ASLEEP",
"amount": 3
}
],
"attack_pattern": {
"type": "conditional",
"initial_move": "SLEEP",
Expand Down
Loading
Loading