Skip to content

Commit 29955fd

Browse files
authored
Merge pull request #935 from espionn/haunt-pandemic
Haunt pandemic behaviour and pre-pull shard cost fix
2 parents 1d6fad2 + 15c7604 commit 29955fd

9 files changed

Lines changed: 1179 additions & 1146 deletions

File tree

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ toolchain go1.23.4
66

77
require (
88
github.com/golang/protobuf v1.5.4
9-
github.com/google/go-cmp v0.6.0
9+
github.com/google/go-cmp v0.7.0
1010
github.com/google/uuid v1.6.0
1111
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
1212
github.com/spf13/cobra v1.7.0
1313
github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a
1414
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394
1515
golang.org/x/text v0.24.0
16-
google.golang.org/protobuf v1.34.2
16+
google.golang.org/protobuf v1.36.10
1717
modernc.org/sqlite v1.37.0
1818
)
1919

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
77
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
88
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
99
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
10+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
11+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
1012
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
1113
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
1214
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -44,6 +46,8 @@ golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
4446
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
4547
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
4648
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
49+
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
50+
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
4751
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4852
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4953
modernc.org/cc/v4 v4.25.2 h1:T2oH7sZdGvTaie0BRNFbIYsabzCxUQg8nLqCdQ2i0ic=

sim/core/apl_values_spell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ func (value *APLValueSpellInFlight) Type() proto.APLValueType {
405405
return proto.APLValueType_ValueTypeBool
406406
}
407407
func (value *APLValueSpellInFlight) GetBool(sim *Simulation) bool {
408-
return (value.spell.Unit.SpellsInFlight[value.spell] > 0)
408+
return value.spell.Unit.SpellInFlight(value.spell)
409409
}
410410
func (value *APLValueSpellInFlight) String() string {
411411
return fmt.Sprintf("SpellInFlight(%s)", value.spell.ActionID)

sim/core/dot.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ func (dot *Dot) DurationExtendSnapshot(sim *Simulation, extendBy time.Duration)
272272
// Forces an instant tick. Does not reset the tick timer or aura duration,
273273
// the tick is simply an extra tick.
274274
func (dot *Dot) TickOnce(sim *Simulation) {
275-
dot.onTick(sim, dot.Unit, dot)
275+
if dot.onTick != nil {
276+
dot.onTick(sim, dot.Unit, dot)
277+
}
276278
}
277279

278280
func (dot *Dot) periodicTick(sim *Simulation) {

sim/core/unit.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,15 @@ func (unit *Unit) GetSpellsMatchingSchool(school SpellSchool) []*Spell {
825825
return spells
826826
}
827827

828+
func (unit *Unit) SpellInFlight(spell *Spell) bool {
829+
return unit.SpellsInFlight[spell] > 0
830+
}
831+
832+
func (unit *Unit) SpellInFlightByID(spellID int32) bool {
833+
spell := unit.GetSpell(ActionID{SpellID: spellID})
834+
return unit.SpellInFlight(spell)
835+
}
836+
828837
func (unit *Unit) GetUnit(ref *proto.UnitReference) *Unit {
829838
return unit.Env.GetUnit(ref, unit)
830839
}

0 commit comments

Comments
 (0)