feat(currency_wars): complete systems, settlement Rank SS, damage report, camera and recovery fixes
This commit is contained in:
1 parent
c008243f11
commit
0995055296
78 files changed
+33840
-9525
No files matched your search
@@ -0,0 +1,64 @@
|
||||
package common
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCurrencyWarsXaodevRulesMatchCapturedDivisions(t *testing.T) {
|
||||
c := loadCurrencyWarsTestCatalog(t)
|
||||
v, err := LoadCurrencyWarsXaodev(c)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, d := range v.Divisions {
|
||||
for _, r := range v.NodeRules {
|
||||
add, err := v.BranchDifficulty(d.DivisionID, r.ID)
|
||||
if err != nil {
|
||||
t.Fatalf("division %d option %d: %v", d.DivisionID, r.ID, err)
|
||||
}
|
||||
if d.BinaryNodeDiffAddRule == 0 && add != 0 {
|
||||
t.Fatalf("division %d with zero rule adds difficulty %d", d.DivisionID, add)
|
||||
}
|
||||
if r.Quality == v.Policy.NormalQuality && add != 0 {
|
||||
t.Fatal("normal branch adds difficulty")
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, err := v.BranchDifficulty(0, 0); err == nil {
|
||||
t.Fatal("unknown rule accepted")
|
||||
}
|
||||
changed := *c
|
||||
changed.ClientVersion += "-mismatch"
|
||||
if _, err := LoadCurrencyWarsXaodev(&changed); err == nil {
|
||||
t.Fatal("revision mismatch accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCurrencyWarsBattleNodeExperienceUsesModeChapterAndBoss(t *testing.T) {
|
||||
c := loadCurrencyWarsTestCatalog(t)
|
||||
for _, boss := range []bool{false, true} {
|
||||
kind, scalar, array := "Monster", "GridFight_GainExpWhenWaveEnd", "GridFight_OCGainExpWhenWaveEndList"
|
||||
if boss {
|
||||
kind, scalar, array = "Boss", "GridFight_GainExpWhenBossWaveEnd", "GridFight_OCGainExpWhenBossWaveEndList"
|
||||
}
|
||||
want, err := c.IntegerRule(scalar)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := c.BattleNodeExperience(false, 1, kind)
|
||||
if err != nil || uint64(got) != uint64(want) {
|
||||
t.Fatalf("normal %s: gain=%d err=%v", kind, got, err)
|
||||
}
|
||||
values, err := c.IntegerArrayRule(array)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for index, want := range values {
|
||||
got, err := c.BattleNodeExperience(true, uint32(index+1), kind)
|
||||
if err != nil || got != want {
|
||||
t.Fatalf("OC %s chapter %d: gain=%d err=%v", kind, index+1, got, err)
|
||||
}
|
||||
}
|
||||
if _, err := c.BattleNodeExperience(true, uint32(len(values)+1), kind); err == nil {
|
||||
t.Fatal("missing chapter accepted")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user