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 {
}
}
///
/// 初始化所有角色的行动值
///
func (this *FightBase) InitRoleOperateValue() {
}
///
/// 排序所有角色
///
/// 排序方式
/// 升序还是降序:asc/desc
func (this *FightBase) Order(orderBy string, pOrder core.EOrderType) {
if len(this.Roles) <= 1 {
return
}
// if (pOrder == core.EOrderType_Asc){
// }
// else{
// }
}