go_dreamfactory/modules/battle/fight/fightbase.go
2022-09-13 17:59:40 +08:00

81 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package fight
import (
"go_dreamfactory/modules/battle/fight/core"
)
type FightBase struct {
/// 战斗控制器
fight core.IFight
/// 战斗类型
fightType core.FightType
/// 战斗是否进行中
fightIng bool
/// 所有参战角色集合
Roles []core.IFightRole
/// 当前回合满足行动值大于等于100的所有角色
CanAtkRoles []core.IFightRole
/// 最后一次攻击的角色
LastActionRole core.IFightRole
/// 战斗AI
FightAI core.IFightAI
///事件系统
FightEvent core.IFightEvent
}
/// 开始战斗
func (this *FightBase) StartFight() {
//战斗开始事件触发
this.FightEvent.EmitForInt(int(core.EventType_OnFightStart))
///战斗开始触发
this.fight.BeforeStart()
///触发队长技
this.fight.EmitCaptainSkill()
///初始化参战角色行动值
this.InitRoleOperateValue()
///开始新的回合
this.fight.TurnRound()
}
/// 开始一个回合
func (this *FightBase) TurnRound() {
//获取当前出手的角色
actionRole := this.fight.GetActionRole()
if actionRole != nil {
//开始行动
actionRole.StartAction()
if actionRole.CanAtk() {
this.FightEvent.EmitForInt((int)(core.EventType_OnRoundStart), actionRole)
//自动战斗逻辑
this.FightAI.AutoEmitSkill(actionRole)
}
} else {
}
}
/// <summary>
/// 初始化所有角色的行动值
/// </summary>
func (this *FightBase) InitRoleOperateValue() {
}
/// <summary>
/// 排序所有角色
/// </summary>
/// <param name="orderBy">排序方式</param>
/// <param name="orderType">升序还是降序asc/desc </param>
func (this *FightBase) Order(orderBy string, pOrder core.EOrderType) {
if len(this.Roles) <= 1 {
return
}
// if (pOrder == core.EOrderType_Asc){
// }
// else{
// }
}