41 lines
875 B
Go
41 lines
875 B
Go
package effect
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func Test_mainTT(t *testing.T) {
|
|
battle := NewBattle()
|
|
player := &Player{ID: "player1"}
|
|
|
|
container := NewEffectContainer("container1", []*Effect{
|
|
{
|
|
ID: "startEffect",
|
|
Priority: 10,
|
|
Triggers: []EnumEffectTrigger{EffectTrigger.TurnStart},
|
|
Apply: func(ctx *EffectContext, next func()) {
|
|
fmt.Println("回合开始效果: 增加护盾")
|
|
next()
|
|
},
|
|
},
|
|
{
|
|
ID: "endEffect",
|
|
Priority: 5,
|
|
Triggers: []EnumEffectTrigger{EffectTrigger.TurnEnd},
|
|
Apply: func(ctx *EffectContext, next func()) {
|
|
fmt.Println("回合结束效果: 恢复怒气")
|
|
next()
|
|
},
|
|
},
|
|
}, battle, player)
|
|
|
|
for i := 0; i < 2; i++ {
|
|
battle.NextTurn([]*EffectContainer{container})
|
|
time.Sleep(500 * time.Millisecond)
|
|
}
|
|
|
|
fmt.Println("测试 BattleMode 枚举:", BattleMode.PVE, BattleMode.PVP)
|
|
}
|