aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-03-25 18:29:04 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:10 +0200
commita635c5a045ec0ea74993f5de877e8a2010009156 (patch)
tree455af30eebfdf25a53a6c7921aeb58c75ed10708
parentc8b2b38cd43c2a54b02a19637e45660a39fe8d1b (diff)
downloadmuhqs-game-a635c5a045ec0ea74993f5de877e8a2010009156.tar.gz
muhqs-game-a635c5a045ec0ea74993f5de877e8a2010009156.zip
emit target and death events
-rw-r--r--go/game/state.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/go/game/state.go b/go/game/state.go
index 0631e5eb..6c1182d2 100644
--- a/go/game/state.go
+++ b/go/game/state.go
@@ -99,6 +99,10 @@ func (s *State) Loop() []*Player {
return winners
}
+func (s *State) addTrigger(trigger Trigger) {
+ s.triggers = append(s.triggers, trigger)
+}
+
func (s *State) removeTriggers(triggers []Trigger) {
for _, t := range triggers {
s.triggers = utils.RemoveFromUnorderedSlice(s.triggers, t)
@@ -360,6 +364,10 @@ func (s *State) declareAction(a Action) {
}
s.broadcastNotification(newDeclaredActionNotification(a, err))
+ t := a.Targets()
+ if t != nil {
+ s.events = append(s.events, newTargetEvent(a, t))
+ }
}
func (s *State) orderTriggeredActions(triggeredActions []*TriggeredAction) []Action {
@@ -442,6 +450,8 @@ func (s *State) addPermanent(perm Permanent) {
if perm.Tile() != nil {
enterTile(perm, perm.Tile())
}
+
+ perm.Card().Impl.onETB(s, perm)
}
func (s *State) addNewUnit(card *Card, pos Position, owner *Player) *Unit {
@@ -500,6 +510,8 @@ func (s *State) destroyPermanent(p Permanent) {
}
p.Owner().DiscardPile.AddCard(p.Card())
+
+ s.events = append(s.events, Event{eventType: EventTypes.Destruction, affected: []interface{}{p}})
}
func (s *State) fight(p1, p2 Permanent) {