SpellEngine icon indicating copy to clipboard operation
SpellEngine copied to clipboard

[1.21.1] Impact Action with "apply_to_caster" true, cancels all the other impacts that come afterwards.

Open ProfessorFichte opened this issue 4 months ago • 1 comments

Version: spell_engine-fabric-1.8.2+1.21.1 A Impact-action with "apply_to_caster" set true, will always cancel all the other impact-actions that come afterwards. Its a Spell with a AREA target-type. "apply_to_caster" was set to true, because I only want the caster to get the effect and not allied players in the area. For example, here the Damage gets applied to targets and the Caster will receive the Resistance effect:

  "impacts": [
    {
      "action": {
        "type": "DAMAGE",
        "damage": {
          "spell_power_coefficient": 0.6,
          "knockback": 4.0
        }
      },
      "particles": [
        {
          "particle_id": "gust",
          "shape": "CIRCLE",
          "origin": "CENTER",
          "count": 1.0,
          "min_speed": 0.2,
          "max_speed": 0.3
        }
      ]
    },
    {
      "action": {
        "type": "STATUS_EFFECT",
        "status_effect": {
          "effect_id": "resistance",
          "duration": 10,
          "apply_mode": "SET",
          "amplifier": 0,
          "refresh_duration": true,
          "show_particles": false
        },
        "apply_to_caster": true
      }
    }
  ]

Here only the resistance buff gets applied to the caster:

  "impacts": [
    {
      "action": {
        "type": "STATUS_EFFECT",
        "status_effect": {
          "effect_id": "resistance",
          "duration": 10,
          "apply_mode": "SET",
          "amplifier": 0,
          "refresh_duration": true,
          "show_particles": false
        },
        "apply_to_caster": true
      }
    }
    {
      "action": {
        "type": "DAMAGE",
        "damage": {
          "spell_power_coefficient": 0.6,
          "knockback": 4.0
        }
      },
      "particles": [
        {
          "particle_id": "gust",
          "shape": "CIRCLE",
          "origin": "CENTER",
          "count": 1.0,
          "min_speed": 0.2,
          "max_speed": 0.3
        }
      ]
    },
  ]

ProfessorFichte avatar Oct 07 '25 15:10 ProfessorFichte

Investigation result:

  • apply_to_caster sets selectedIntent (temp var) to HELPFUL, hence the rest of the actions are filtered out
  • a proper fix would require splitting impacts into target_impacts + caster_impacts
  • additionally caster_impacts should not execute any area_impacts

ZsoltMolnarrr avatar Oct 09 '25 20:10 ZsoltMolnarrr