MagicPlugin icon indicating copy to clipboard operation
MagicPlugin copied to clipboard

Improved requirements format

Open temoya1 opened this issue 2 years ago • 6 comments

The current "requirements" is very difficult to understand, so I think it would be better to use a form like "effects". Like this

reqs:
  - req: number
    number: attributeA
    more: 3
    less: 5
  - group: or
      - req: number
        number: variableA + attributeB
        value: 15
      - req: number
        number: variableB
        min: 5
  - group: and
      - req: wand
        target: source
        invert: true
        wands:
          - wand
      - req: light
        max: 5
        min: 3
if (
  (attributeA > 3 && attributeA < 5)
  && ((varA + attributeB == 15) || (varB >= 5))
  && (!wands.contains(wand) && (light <= 5 && light >= 3))
) {
}

temoya1 avatar May 26 '23 05:05 temoya1

do you realize that changing the way action performs will affect every spell ever made with it and likely break them all?

PhvntxmX avatar May 28 '23 04:05 PhvntxmX

also, everything is possible if you are stubborn enough:

    - class: CheckRequirements
      requirements:
        - attributes:
          - attribute: attributeA
            min: 3
            max: 5
      actions:
        - class: ModifyAttribute
          attribute: summ1
          value: varA + attributeB
        - class: CheckRequirements
          requirements:
            - attributes:
              - attribute: summ1
                value: 15
          actions:
            - class: ModifyVariable
              variable: temp1
              value: 1
        - class: CheckRequirements
          requirements:
            - attributes:
              - attribute: varB
                min: 5
          actions:
            - class: ModifyVariable
              variable: temp2
              value: 1
        - class: Probability
          probability: temp1 + temp2
          actions:
             //i gave up on this point

PhvntxmX avatar May 28 '23 05:05 PhvntxmX

I'd actually support this change, even if I'd have to manually rewrite every single config to fit this format. It's much more understandable and logical.

I0nTech avatar May 28 '23 18:05 I0nTech

Definitely not happening. But as a separate new action class - may be.

PhvntxmX avatar May 28 '23 23:05 PhvntxmX

Something like LogicalExpression action with "type" parameter (and,or,xor etc.)

PhvntxmX avatar May 28 '23 23:05 PhvntxmX

I agree that the current requirements format has a steep learning curve. There are maybe ways some shorthands could be added while keeping the existing format for backwards-compatibility, but I would say this won't be high on my list of things to look at.

The suggested format I don't think is valid YAML though.

NathanWolf avatar May 30 '23 14:05 NathanWolf