Esempio n. 1
0
        // Token: 0x0600376E RID: 14190 RVA: 0x000F8FA0 File Offset: 0x000F71A0
        public void DoBehavor()
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_DoBehavor_hotfix != null)
            {
                this.m_DoBehavor_hotfix.call(new object[]
                {
                    this
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            if (this.m_curBehaviorCfg == null)
            {
                return;
            }
            BattleActor leader = this.m_leader;

            if (this.m_singleBehaviors.Count != this.m_actors.Count)
            {
                if (this.m_team.Battle.IsEnableDebugLog())
                {
                    DebugUtility.Log(string.Format("!@# {0}: 存储群组成员的个体行为", this.InstanceID));
                }
                this.m_singleBehaviors.Clear();
                foreach (BattleActor battleActor in this.m_actors)
                {
                    this.m_singleBehaviors.Add(battleActor.GetBehaviorId());
                }
            }
            if (this.m_leader != null && (this.m_leader.IsDeadOrRetreat() || !this.m_leader.CheckBehaviorCondition(this.m_curBehaviorCfg.SelectLeaderCondition, this.m_curBehaviorCfg.SLCParamData)))
            {
                if (this.m_team.Battle.IsEnableDebugLog())
                {
                    DebugUtility.Log(string.Format("!@# {0}: 老队长{1}卸任", this.InstanceID, this.m_leader.InstanceID));
                }
                this.m_leader.ActionValue = this.m_leaderNormalActionPriority;
                this.m_leader             = null;
            }
            if (this.m_leader == null)
            {
                foreach (BattleActor battleActor2 in BattleActor.FindActorsAlive(this.m_actors))
                {
                    if (battleActor2.CheckBehaviorCondition(this.m_curBehaviorCfg.SelectLeaderCondition, this.m_curBehaviorCfg.SLCParamData))
                    {
                        this.m_leader = battleActor2;
                        if (this.m_team.Battle.IsEnableDebugLog())
                        {
                            DebugUtility.Log(string.Format("!@# {0}: 新队长{1}上任", this.InstanceID, this.m_leader.InstanceID));
                        }
                        this.m_leaderNormalActionPriority = this.m_leader.ActionValue;
                        this.m_leader.ActionValue         = 32767;
                        this.m_leader.SetBehavior(this.m_curBehaviorCfg.LeaderBehavior);
                        foreach (BattleActor battleActor3 in this.m_actors)
                        {
                            if (battleActor3 != this.m_leader)
                            {
                                battleActor3.SetBehavior(this.m_curBehaviorCfg.MemberBehavior);
                            }
                        }
                        break;
                    }
                }
            }
            if (this.m_leader == null && leader != null && this.m_singleBehaviors.Count == this.m_actors.Count)
            {
                if (this.m_team.Battle.IsEnableDebugLog())
                {
                    DebugUtility.Log(string.Format("!@# {0}: 没有合适的队长,恢复群组成员的个体行为", this.InstanceID));
                }
                for (int i = 0; i < this.m_singleBehaviors.Count; i++)
                {
                    this.m_actors[i].SetBehavior(this.m_singleBehaviors[i]);
                }
                this.m_singleBehaviors.Clear();
            }
        }