Skip to content

Add syntax to support tuples #53

@Fuco1

Description

@Fuco1

I've been playing with the parser a bit and ended up implementing syntax for tuples for comparison operators. I'm not sure how good the implementation is, I basically turn the single nodes into a list of nodes, so this adds some overhead of creating lists where a single value would most often exist.

It allows for somewhat nice syntax like this:

buy "Metadata/Items/Armours/BodyArmours/BodyDexInt20"

repeat {
  chaos
  show
} until (tier "Intelligence", tier "Dexterity") <= (4, 4)

My initial motivation was to allow comparing rolls for divining. There's actually a lot of recipes where you want to divine, for example: harvest swapping resistances before fracturing, divining expensive mods before fracturing etc (for divining see #52)

Since some mods have multiple stats, we need to be able to write the values for all the stats, such as (hypothetical syntax roll "mod"):

if roll "flat evasion and flat energy shield" >= (300, 80) then ...

I'm not sure how to evaluate the performance hit, to me it seems to be pretty much the same. I run a somewhat complicated recipe 100 times and it came out similar, the old version was actually slower, but that's because I was a bit unlucky on the essences :D

EDIT: I implemented the roll as well so for example this is possible (divine necrotic until perfect flat). Maybe roll is not the best word here because it is both noun and a verb so someone might think it is actually doing some action. I don't have a good idea now for a different word for it though.

buy "Metadata/Items/Armours/BodyArmours/BodyDexInt20"
with "LocalBaseEvasionRatingAndEnergyShield8___"

until roll "LocalBaseEvasionRatingAndEnergyShield" = (375, 80) do divine

For a single value you can omit the parentheses of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions