pre cw with probe and a bunch script to read game behavior
This commit is contained in:
1 parent
5120219ae2
commit
da8a32f60d
310 files changed
+219693
-872
No files matched your search
@@ -7,6 +7,14 @@ import (
|
||||
goproto "gac-hkrpg-go/protocol/proto"
|
||||
)
|
||||
|
||||
func TestBattleReportUsesActualBattleSlots(t *testing.T) {
|
||||
r := &BattleReport{Avatars: []*BattleAvatarReport{{AvatarID: 11}, {AvatarID: 10}}}
|
||||
ApplyBattleReportContext(r, &goproto.SceneBattleInfo{BattleId: 7, StageId: 20, BattleAvatarList: []*goproto.BattleAvatar{{Id: 10, Index: 0}, {Id: 11, Index: 2}}})
|
||||
if r.BattleID != 7 || r.StageID != 20 || r.Avatars[0].AvatarID != 10 || r.Avatars[0].Slot == nil || *r.Avatars[0].Slot != 0 || *r.Avatars[1].Slot != 2 {
|
||||
t.Fatalf("battle identity/order lost: %+v", r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBattleReportSerialization(t *testing.T) {
|
||||
defer os.Remove(BattleReportFile)
|
||||
|
||||
@@ -128,6 +136,44 @@ func TestBattleReportUsesAvatarDamageEventsWhenAvatarTotalsAreZero(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBattleReportUsesDealtDamagePropertiesAndDoesNotCountDamageTaken(t *testing.T) {
|
||||
stt := &goproto.BattleStatistics{
|
||||
BattleAvatarList: []*goproto.AvatarBattleInfo{
|
||||
{
|
||||
Id: 1503,
|
||||
AttackTypeDamage: []*goproto.AttackDamageProperty{
|
||||
{AttackType: "Normal", Damage: 600},
|
||||
},
|
||||
// Native NOGHNMCDDAI contains damage taken, not dealt.
|
||||
NOGHNMCDDAI: []*goproto.AttackDamageProperty{
|
||||
{AttackType: "Normal", Damage: 900},
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: 1511,
|
||||
NOGHNMCDDAI: []*goproto.AttackDamageProperty{
|
||||
{AttackType: "Skill", Damage: 400},
|
||||
},
|
||||
},
|
||||
},
|
||||
MonsterList: []*goproto.MonsterBattleInfo{{TotalDamageTaken: 1200}},
|
||||
}
|
||||
|
||||
report := BattleReportFromStatistics(stt, 1, 0, "WIN")
|
||||
if report.TeamTotalDamage != 600 {
|
||||
t.Fatalf("expected dealt damage 600, got %f", report.TeamTotalDamage)
|
||||
}
|
||||
if report.Avatars[0].TotalDamage != 600 || report.Avatars[0].DamagePercent != 100 {
|
||||
t.Fatalf("unexpected avatar 1503 report: %+v", report.Avatars[0])
|
||||
}
|
||||
if report.Avatars[1].TotalDamage != 0 || report.Avatars[1].DamagePercent != 0 {
|
||||
t.Fatalf("unexpected avatar 1511 report: %+v", report.Avatars[1])
|
||||
}
|
||||
if len(report.Avatars[1].AttackTypeDamage) != 0 {
|
||||
t.Fatalf("damage taken became dealt damage: %+v", report.Avatars[1].AttackTypeDamage)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBattleReportFallsBackToMonsterDamageTakenForTeamTotal(t *testing.T) {
|
||||
stt := &goproto.BattleStatistics{
|
||||
BattleAvatarList: []*goproto.AvatarBattleInfo{{Id: 1503}},
|
||||
@@ -145,3 +191,46 @@ func TestBattleReportFallsBackToMonsterDamageTakenForTeamTotal(t *testing.T) {
|
||||
t.Fatalf("cannot infer avatar share from monster totals, got %f", report.Avatars[0].DamagePercent)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBattleReportUsesSupplementalAvatarDamageWhenStandardFieldsAreEmpty(t *testing.T) {
|
||||
stt := &goproto.BattleStatistics{
|
||||
BattleAvatarList: []*goproto.AvatarBattleInfo{
|
||||
{Id: 1409},
|
||||
{Id: 1507},
|
||||
},
|
||||
MFOJKJGKDGD: &goproto.FAHGFCIJHFK{
|
||||
TotalDamage: 1000,
|
||||
INBNCAKGDPJ: []*goproto.PMPCIBGILIE{
|
||||
{AvatarId: 1409, Damage: 400},
|
||||
{AvatarId: 1507, Damage: 600},
|
||||
},
|
||||
},
|
||||
MonsterList: []*goproto.MonsterBattleInfo{{TotalDamageTaken: 1500}},
|
||||
}
|
||||
|
||||
report := BattleReportFromStatistics(stt, 1, 1052106, "WIN")
|
||||
if report.TeamTotalDamage != 1000 {
|
||||
t.Fatalf("expected supplemental team total damage 1000, got %f", report.TeamTotalDamage)
|
||||
}
|
||||
if report.Avatars[0].TotalDamage != 400 || report.Avatars[0].DamagePercent != 40 {
|
||||
t.Fatalf("unexpected avatar 1409 report: %+v", report.Avatars[0])
|
||||
}
|
||||
if report.Avatars[1].TotalDamage != 600 || report.Avatars[1].DamagePercent != 60 {
|
||||
t.Fatalf("unexpected avatar 1507 report: %+v", report.Avatars[1])
|
||||
}
|
||||
}
|
||||
|
||||
func TestBattleReportDoesNotReplaceStandardDamageWithSupplementalAggregate(t *testing.T) {
|
||||
stt := &goproto.BattleStatistics{
|
||||
BattleAvatarList: []*goproto.AvatarBattleInfo{{Id: 1409, TotalDamage: 400}},
|
||||
MFOJKJGKDGD: &goproto.FAHGFCIJHFK{
|
||||
TotalDamage: 900,
|
||||
INBNCAKGDPJ: []*goproto.PMPCIBGILIE{{AvatarId: 1409, Damage: 900}},
|
||||
},
|
||||
}
|
||||
|
||||
report := BattleReportFromStatistics(stt, 1, 1052106, "WIN")
|
||||
if report.TeamTotalDamage != 400 || report.Avatars[0].TotalDamage != 400 {
|
||||
t.Fatalf("supplemental data replaced standard damage: %+v", report)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user