-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathtrace.go
More file actions
65 lines (59 loc) · 1.39 KB
/
trace.go
File metadata and controls
65 lines (59 loc) · 1.39 KB
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
package serval
import (
"github.com/simimpact/srsim/pkg/engine/event"
"github.com/simimpact/srsim/pkg/engine/info"
"github.com/simimpact/srsim/pkg/engine/modifier"
"github.com/simimpact/srsim/pkg/engine/prop"
"github.com/simimpact/srsim/pkg/key"
"github.com/simimpact/srsim/pkg/model"
)
// A4:
//
// At the start of the battle, immediately regenerates 15 Energy.
//
// A6:
//
// Upon defeating an enemy, ATK is increased by 20% for 2 turn(s).
const (
A4 = "serval-a4"
A6 = "serval-a6"
A6Check = "serval-a6-check"
)
func init() {
modifier.Register(A6Check, modifier.Config{
Listeners: modifier.Listeners{
OnTriggerDeath: a6Buff,
},
})
modifier.Register(A6, modifier.Config{
StatusType: model.StatusType_STATUS_BUFF,
Stacking: modifier.ReplaceBySource,
CanDispel: true,
})
}
func (c *char) initTraces() {
if c.info.Traces["102"] {
c.engine.Events().BattleStart.Subscribe(func(event event.BattleStart) {
c.engine.ModifyEnergy(info.ModifyAttribute{
Key: A4,
Target: c.id,
Source: c.id,
Amount: 15.0,
})
})
}
if c.info.Traces["103"] {
c.engine.AddModifier(c.id, info.Modifier{
Name: A6Check,
Source: c.id,
})
}
}
func a6Buff(mod *modifier.Instance, target key.TargetID) {
mod.Engine().AddModifier(mod.Owner(), info.Modifier{
Name: A6,
Source: mod.Owner(),
Duration: 2,
Stats: info.PropMap{prop.ATKPercent: 0.2},
})
}