Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/doc/lua/statuseffect.md
blob: 930bed253cde56fdfa5eb1dd8de9b1c3dd12ce12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# effect

The `effect` table relates to functions specifically for status effects.

---

#### `float` effect.duration()

Returns the remaining duration of the status effect.

---

#### `void` effect.modifyDuration(`float` duration)

Adds the specified duration to the current remaining duration.

---

#### `void` effect.expire()

Immediately expire the effect, setting the duration to 0.

---

#### `EntityId` effect.sourceEntity()

Returns the source entity id of the status effect, if any.

---

#### `void` effect.setParentDirectives(`String` directives)

Sets image processing directives for the entity the status effect is active on.

---

#### `Json` effect.getParameter(`String` name, `Json` def)

Returns the value associated with the parameter name in the effect configuration. If no value is set, returns the default specified.

---

#### `StatModifierGroupId` effect.addStatModifierGroup(`List<StatModifier>` modifiers)

Adds a new stat modifier group and returns the ID created for the group. Stat modifier groups will stay active until the effect expires.

Stat modifiers are of the format:

```lua
{
  stat = "health",

  amount = 50
  --OR baseMultiplier = 1.5
  --OR effectiveMultiplier = 1.5
}
```

---

#### `void` effect.setStatModifierGroup(`StatModifierGroupId`, groupId, `List<StatModifier>` modifiers)

Replaces the list of stat modifiers in a group with the specified modifiers.

---

#### `void` effect.removeStatModifierGroup(`StatModifierGroupId` groupId)

Removes the specified stat modifier group.