Skip to content

Commit 7b52c87

Browse files
committed
Merge branch 'dev' into issue-9451-loadout-management
2 parents 4260e40 + f0b9ea7 commit 7b52c87

33 files changed

Lines changed: 33462 additions & 23634 deletions

CONTRIBUTING.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,15 @@ More tests can be added to this folder to test specific functionality, or new te
224224
Please try to include tests for your new features in your pull request. Additionally, if your pr breaks a test that should be passing please update it accordingly.
225225

226226
### Debugging tests
227-
When running tests with a docker container it is possible to use EmmyLua for debugging. Follow the instructions for inserting the debugger snippet as shown above in [Visual Studio Code](#Visual-Studio-Code), then uncomment the `dbg.waitIDE()` line.
228-
229-
After running `docker-compose up` the code will wait at that line until a debugger is attached. This will allow stepping through any code that is internal to POB but will not work for busted related code. Note that this only works for unit tests described above.
227+
When running tests with a docker container it is possible to use EmmyLua for debugging. Paste in the following right under `function launch:OnInit()` in `./src/Launch.lua`:
228+
```lua
229+
package.cpath = package.cpath .. ";/usr/local/bin/?.so"
230+
local dbg = require("emmy_core")
231+
-- This port must match the IDE Code configuration. Default is 9966.
232+
dbg.tcpListen("localhost", 9966)
233+
dbg.waitIDE()
234+
```
235+
After running `docker-compose up` the code will wait at the `dbg.waitIDE()` line until a debugger is attached. This will allow stepping through any code that is internal to POB but will not work for busted related code. Note that this only works for unit tests described above.
230236

231237
## Path of Building development tutorials
232238

spec/System/TestItemParse_spec.lua

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,13 @@ describe("TestItemParse", function()
392392
assert.truthy(item.explicitModLines[1].synthesis)
393393
end)
394394

395+
it("unscalable", function()
396+
local item = new("Item", raw("{unscalable}+8 to Strength"))
397+
assert.truthy(item.explicitModLines[1].unscalable)
398+
item = new("Item", raw("+8 to Strength - Unscalable Value"))
399+
assert.truthy(item.explicitModLines[1].unscalable)
400+
end)
401+
395402
it("multiple bases", function()
396403
local item = new("Item", [[
397404
Ashcaller
@@ -465,3 +472,198 @@ describe("TestItemParse", function()
465472
assert.are.equal("+1500 to Armour", item.buffModLines[1].line)
466473
end)
467474
end)
475+
476+
describe("TestAdvancedItemParse #item", function()
477+
local function raw(s, base)
478+
base = base or "Plate Vest"
479+
return "Rarity: Rare\nName\n"..base.."\n"..s
480+
end
481+
482+
it("parses to craft", function()
483+
local item = new("Item", raw([[
484+
{ Prefix Modifier "Fecund" (Tier: 1) — Life }
485+
+142(130-144) to maximum Life
486+
]], "Cord Belt"))
487+
assert.are.equals("IncreasedLife9", item.prefixes[1].modId)
488+
assert.are.equals(0.857, item.prefixes[1].range)
489+
assert.are.equals("life", item.explicitModLines[1].modTags[1])
490+
item = new("Item", raw([[
491+
{ Master Crafted Suffix Modifier "of Craft" (Rank: 3) — Elemental, Cold, Resistance }
492+
+35(29-35)% to Cold Resistance
493+
]], "Cord Belt"))
494+
assert.truthy(item.explicitModLines[1].crafted)
495+
end)
496+
497+
it("parses correct range", function()
498+
local item = new("Item", raw([[
499+
{ Prefix Modifier "Freezing" (Tier: 5) — Damage, Elemental, Cold, Caster — 8% Increased }
500+
Adds 17(16-20) to 35(30-36) Cold Damage to Spells
501+
]], "Void Sceptre"))
502+
assert.are.equals("Adds 17 to 35 Cold Damage to Spells", item.explicitModLines[1].line)
503+
end)
504+
505+
-- GGG scales each mod line separately here, but PoB scales them both together, so this parsing is a bit wonky
506+
it("parses multi-line mod", function()
507+
local item = new("Item", raw([[
508+
{ Prefix Modifier "Warlock's" (Tier: 4) — Mana, Damage, Caster }
509+
32(30-37)% increased Spell Damage
510+
+46(42-47) to maximum Mana
511+
]], "Royal Staff"))
512+
assert.are.equals("SpellDamageAndManaOnTwoHandWeapon4", item.prefixes[1].modId)
513+
assert.are.equals(0.286, item.prefixes[1].range)
514+
assert.are.equals(0.8, item.explicitModLines[2].range)
515+
end)
516+
517+
it("resets linePrefix", function()
518+
local item = new("Item", raw([[
519+
{ Prefix Modifier "Warlock's" (Tier: 4) — Mana, Damage, Caster }
520+
32(30-37)% increased Spell Damage
521+
+46(42-47) to maximum Mana
522+
--------
523+
+15 to maximum life
524+
]], "Royal Staff"))
525+
assert.are_not.equals("mana", item.explicitModLines[3].modTags[1])
526+
end)
527+
528+
it("resets linePostfix", function()
529+
local item = new("Item", raw([[
530+
{ Corruption Enhancement — Mana }
531+
24(20-30)% increased Mana Regeneration Rate
532+
--------
533+
+15 to maximum life
534+
]]))
535+
assert.falsy(item.explicitModLines[1].enchant)
536+
end)
537+
538+
it("parses vaaled catalyst", function()
539+
local item = new("Item", raw([[
540+
Quality (Attribute Modifiers): +19% (augmented)
541+
{ Unique Modifier — Attribute — 19% Increased }
542+
+120(80-100) to all Attributes
543+
(Attributes are Strength, Dexterity, and Intelligence)
544+
]], "Onyx Amulet"))
545+
assert.are.equals(142, item.baseModList[1].value)
546+
-- assert.falsy(item.explicitModLines[1].range) -- Not sure why this is returning 0.5
547+
assert.are.equals(6, item.catalyst)
548+
assert.are.equals(19, item.catalystQuality)
549+
end)
550+
551+
it("parses vaaled catalyst within range", function()
552+
local item = new("Item", raw([[
553+
Quality (Attribute Modifiers): +19% (augmented)
554+
{ Unique Modifier — Attribute — 19% Increased }
555+
+95(80-100) to all Attributes
556+
(Attributes are Strength, Dexterity, and Intelligence)
557+
]], "Onyx Amulet"))
558+
assert.are.equals(113, item.baseModList[1].value)
559+
assert.are.equals(0.75, item.explicitModLines[1].range)
560+
assert.are.equals(6, item.catalyst)
561+
assert.are.equals(19, item.catalystQuality)
562+
end)
563+
564+
it("doesn't scale unscalable", function()
565+
local item = new("Item", raw([[
566+
Quality (Life and Mana Modifiers): +20% (augmented)
567+
{ Unique Modifier — Life, Defences, Energy Shield, Minion, Gem }
568+
Socketed Golem Skills gain 20% of Maximum Life as Extra Maximum Energy Shield — Unscalable Value
569+
]]))
570+
assert.are.equals(20, item.baseModList[1].value.mod.value)
571+
end)
572+
573+
it("correctly matches conqueror mod", function()
574+
local item = new("Item", raw([[
575+
{ Suffix Modifier "of the Conquest" (Tier: 1) — Elemental, Cold }
576+
10(8-10)% chance to Avoid Cold Damage from Hits
577+
(No chance to avoid damage can be higher than 75%)
578+
Warlord Item
579+
]]))
580+
assert.are.equals(10, item.baseModList[1].value)
581+
-- assert.are.equals(1, item.explicitModLines[1].range) -- Not sure why this is returning 0.5
582+
end)
583+
584+
it("parses enchant correctly #enchant", function()
585+
local item = new("Item", raw([[
586+
{ Corrupted Enhancement }
587+
+8(6-10)% to Fire Resistance
588+
]]))
589+
assert.are.equals(8, item.enchantModLines[1].modList[1].value)
590+
end)
591+
592+
it("parses enchant with tags correctly #enchant", function()
593+
local item = new("Item", raw([[
594+
{ Corrupted Enhancement - Energy Shield }
595+
+8(6-10)% to Fire Resistance
596+
]]))
597+
assert.are.equals(8, item.enchantModLines[1].modList[1].value)
598+
assert.are.equals("energyshield", item.enchantModLines[1].modTags[1])
599+
end)
600+
601+
it("parses junk", function()
602+
local godTestItem = new("Item", [[
603+
Item Class: Sceptres
604+
Rarity: Unique
605+
Nebulis
606+
Synthesised Void Sceptre
607+
--------
608+
Sceptre
609+
Physical Damage: 50-76
610+
Critical Strike Chance: 7.30%
611+
Attacks per Second: 1.25
612+
Weapon Range: 1.1 metres
613+
Memory Strands: 58
614+
--------
615+
Requirements:
616+
Level: 68
617+
Str: 104
618+
Int: 122
619+
--------
620+
Sockets: B R
621+
--------
622+
Item Level: 87
623+
--------
624+
+30% to Fire Resistance (scourge)
625+
22% reduced Global Defences (scourge)
626+
(Armour, Evasion Rating and Energy Shield are the standard Defences) (scourge)
627+
--------
628+
8% increased Explicit Cold Modifier magnitudes (enchant)
629+
Has 1 White Socket (enchant)
630+
--------
631+
{ Searing Exarch Implicit Modifier (Lesser) }
632+
Tempest Shield has 15(15-17)% increased Buff Effect
633+
{ Implicit Modifier — Damage, Critical — 106% Increased }
634+
+15(15-17)% to Global Critical Strike Multiplier
635+
--------
636+
{ Prefix Modifier "Freezing" (Tier: 5) — Damage, Elemental, Cold, Caster — 8% Increased }
637+
Adds 17(16-20) to 35(30-36) Cold Damage to Spells
638+
{ Prefix Modifier "Beetle's" (Tier: 6) — Defences, Armour }
639+
9(6-13)% increased Armour
640+
7(6-7)% increased Stun and Block Recovery
641+
{ Master Crafted Prefix Modifier "Upgraded" — Life, Defences, Armour }
642+
21(18-21)% increased Armour
643+
+18(17-19) to maximum Life
644+
{ Unique Modifier }
645+
106(60-120)% increased Implicit Modifier magnitudes — Unscalable Value
646+
(Implicit Modifiers are those that come from an item's type, rather than its random properties)
647+
{ Master Crafted Suffix Modifier "of Craft" (Rank: 3) — Elemental, Cold, Resistance }
648+
+35(29-35)% to Cold Resistance
649+
{ Fractured Prefix Modifier "Thorny" (Tier: 2) — Damage, Physical }
650+
Reflects 3(1-4) Physical Damage to Melee Attackers
651+
{ Prefix Modifier "Veiled" }
652+
Veiled Prefix
653+
Searing Exarch Item
654+
--------
655+
{ Allocated Crucible Passive Skill (Tier: 2) }
656+
Adds 2 to 6 Physical Damage to Spells
657+
--------
658+
Synthesised Item
659+
--------
660+
Corrupted
661+
--------
662+
Scourged
663+
--------
664+
Hinekora's Lock
665+
--------
666+
Note: ~b/o 2 chaos
667+
]])
668+
end)
669+
end)

0 commit comments

Comments
 (0)