Skip to main content

Modify Resource (Bi-Entity Action Type)

Changes an apoli:resource or apoli:cooldown on one side of a bi-entity pair. It can take the incoming value from a resource on the other side, which the entity action apoli:modify_resource can't do on its own.

Type ID: apoli:modify_resource (type aliases apoli:change_resource and origins:change_resource)

Every field of the entity action (resource, modifier, position, from and from_position) works here unchanged. Two more fields choose which entity each half applies to.

Fields

FieldTypeDefaultDescription
sideString"target"Whose resource is written: "actor" or "target". recipient is accepted as an alias.
from_sideStringthe opposite of sideWhose resource from reads. from_entity is accepted as an alias. It only matters together with from.
resourceIdentifierrequiredThe resource or cooldown power to change on side.
modifierAttribute Modifierset_base of 0Applied to the current value. With from set, only its operation is used and the incoming value is the source slot.
positionInteger or ExpressionoptionalWhich slot of a table resource to write. Leave it out on a table and every slot is written.
fromIdentifieroptionalReads the incoming value from this resource on from_side.
from_positionInteger or ExpressionoptionalWhich slot of from to read.

Examples

"bientity_action": {
  "type": "apoli:modify_resource",
  "side": "target",
  "resource": "example:mana",
  "modifier": {
    "operation": "add_base_early",
    "value": -5
  }
}

This drains five mana from the target. With no from, it is the same as wrapping the entity action in apoli:target_action, so use the wrapper when that is all you need.

"bientity_action": {
  "type": "apoli:modify_resource",
  "side": "actor",
  "resource": "example:stolen_charge",
  "from": "example:mana",
  "modifier": {
    "operation": "add_base_early"
  }
}

This adds the target's current example:mana to the actor's example:stolen_charge. from_side defaults to the opposite of side, so the read comes from the target without being written out. Set it yourself when both halves should come from the same entity.

Reading the other side in value

from_side only decides where from reads. An expression in the modifier's value reads the entity on side, the one being written. To use a number from the other entity, name its side with actor_resource(...) or target_resource(...) (see Expression):

"bientity_action": {
    "type": "apoli:modify_resource",
    "side": "target",
    "resource": "example:minion_speed",
    "modifier": {
        "operation": "set_base",
        "value": "1 + actor_resource(example:haste_upgrade)"
    }
}

Run from the bientity_action of an apoli:summon_minion, this copies the summoner's upgrade onto the new minion. A bare example:haste_upgrade would be read off the minion, which doesn't have it, and come out as 0.