refactor: 重构战斗系统为统一动作包结构
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
30
logic/service/fight/input/team_test.go
Normal file
30
logic/service/fight/input/team_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package input
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
fightinfo "blazing/logic/service/fight/info"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
func TestLivingTeammatesFiltersSelfAndDeadSlots(t *testing.T) {
|
||||
owner := &Input{CurPet: []*fightinfo.BattlePetEntity{{Info: model.PetInfo{Hp: 10}}}}
|
||||
aliveMate := &Input{CurPet: []*fightinfo.BattlePetEntity{{Info: model.PetInfo{Hp: 5}}}}
|
||||
deadMate := &Input{CurPet: []*fightinfo.BattlePetEntity{{Info: model.PetInfo{Hp: 0}}}}
|
||||
|
||||
team := []*Input{owner, aliveMate, deadMate}
|
||||
owner.Team = team
|
||||
aliveMate.Team = team
|
||||
deadMate.Team = team
|
||||
|
||||
teammates := owner.LivingTeammates()
|
||||
if len(teammates) != 1 {
|
||||
t.Fatalf("expected 1 living teammate, got %d", len(teammates))
|
||||
}
|
||||
if teammates[0] != aliveMate {
|
||||
t.Fatalf("expected alive teammate to be returned")
|
||||
}
|
||||
if owner.HasLivingTeammate() != true {
|
||||
t.Fatalf("expected owner to detect living teammate")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user