Пример #1
0
            void Regulus.Game.IStage.Enter()
            {
                var team1 = new Team(TeamSide.Left,_Platoon);

                var enemys = (from enemy in _Prototype.Enemys select new Teammate(new ActorInfomation() { Exp = 0, Prototype = enemy })).ToArray();

                var platoonEnemy = new Platoon(new Squad(Contingent.FormationType.Auxiliary, enemys , new AIController()));
                var team2 = new Team(TeamSide.Right, platoonEnemy);
                _Combat.Initial(team1, team2);
                _Combat.WinnerEvent += (winner) =>
                {
                    if (winner == team1)
                        ResultEvent(Result.Victory);
                    else
                        ResultEvent(Result.Failure);
                };

                _Combat.DrawEvent += () =>
                {
                    ResultEvent(Result.Failure);
                };
                _Platoons = new Utility.Updater<Platoon>();
                _Platoons.Add(platoonEnemy);
            }
Пример #2
0
 private int _GetTeamCount(Team[] _Teams)
 {
     return (from team in _Teams select team.Members.Length).Sum();
 }
Пример #3
0
 private Team.Member[] _GetSurvivor(Team[] teams)
 {
     List<Team.Member> teammates = new List<Team.Member>();
     foreach (var team in teams)
     {
         teammates.AddRange(from member in  team.Members where member.Teammate.Hp > 0 select member);
     }
     return teammates.OrderBy(t => t.Teammate.Int + Regulus.Utility.Random.Next(-2 , 2)).ToArray();
 }
Пример #4
0
 private bool _GetStrategy(Team.Member memeber, Strategy[] strategys)
 {
     for (int i = 0; i < strategys.Length; ++i )
     {
         if (memeber.Teammate.Specializes == strategys[i])
         {
             memeber.Owner.AddStrategy(strategys[i]);
             strategys[i] = Strategy.None;
             return true;
         }
     }
     for (int i = 0; i < strategys.Length; ++i)
     {
         if (strategys[i] != Strategy.None)
         {
             memeber.Owner.AddStrategy(strategys[i]);
             strategys[i] = Strategy.None;
             return true;
         }
     }
     return false;
 }
Пример #5
0
 public StrategyStage(Team[] teams)
 {
     this._Teams = teams;
 }
Пример #6
0
 public Activists(int order, int remaining, Team.Member member, Team[] targets, CommonSkillSet common_skill_set)
 {
     _Remaining = remaining;
     _CommonSkillSet = common_skill_set;
     _Targets = targets;
     this._Member = member;
     _Member.Teammate.SetBattleThinkTime(LocalTime.Instance.Ticks, (order + 1) * ThinkTime, false);
 }
Пример #7
0
            private Activists[] _GetSurvivor(Team[] teams, CommonSkillSet common_skill_set)
            {
                var members = _Sort(teams);
                int i = 0;
                List<Activists> activistss = new List<Activists>();
                foreach(var member in members)
                {
                    activistss.Add(new Activists(i++, members.Count - i, member, (from team in teams where member.Owner != team select team).ToArray(), common_skill_set));
                }

                return activistss.ToArray();
            }
Пример #8
0
 public Member(Team owner, ITeammate teammate)
 {
     Owner = owner;
     Teammate = teammate;
 }
Пример #9
0
 public ActionStage(Team[] teams, CommonSkillSet common_skill_set)
 {
     _Teams = teams;
     _Activists = new Queue<Activists>(_GetSurvivor(teams, common_skill_set));
 }
Пример #10
0
 private void _ToStrategy(Team[] teams)
 {
     var stage = new StrategyStage(teams);
     stage.DoneEvent += _ToAction;
     _StageMachine.Push(stage);
 }
Пример #11
0
 private void _Take(Team[] teams, CommonSkillSet common_skill_set)
 {
     foreach (var team in teams)
     {
         foreach(var member in team.Members)
         {
             member.Teammate.Take(common_skill_set);
         }
     }
 }
Пример #12
0
 private void _ReleaseBroadcasting(Team[] teams)
 {
     foreach (var team in teams)
     {
         team.FinalialBroadcast();
     }
 }
Пример #13
0
 private void _InitialBroadcasting(Team[] teams)
 {
     foreach (var team in teams)
     {
         team.InitialBroadcast(teams);
     }
 }
Пример #14
0
 private void _EliminateTeam(Team[] eliminates)
 {
     List<Team> teams = _Teams.ToList();
     foreach (var eliminate in eliminates)
     {
         teams.Remove(eliminate);
     }
     if (teams.Count == 1)
     {
         WinnerEvent(teams.ToArray()[0]);
     }
 }
Пример #15
0
        internal void Initial(Team team1, Team team2)
        {
            _CommonSkillSet = new CommonSkillSet();
            _CommonSkillSet.Shuffle();
            _CommonSkillSet.EmptyEvent += () => { DrawEvent(); };
            _Teams = new Team[] { team1 , team2 };
            _StageMachine = new Regulus.Game.StageMachine();

            _Take(_Teams , _CommonSkillSet);
            _InitialBroadcasting(_Teams);

            _ToStrategy(_Teams);
        }
Пример #16
0
            private static List<Team.Member> _Sort(Team[] teams)
            {
                List<Team.Member> teammates = new List<Team.Member>();
                foreach (var team in teams)
                {
                    teammates.AddRange(from member in team.Members where member.Teammate.Hp > 0 select member);
                }

                return teammates.OrderBy(t => t.Teammate.Dex + Regulus.Utility.Random.Next(-2, 2)).ToList();
            }
Пример #17
0
        Skill.Effect[] ITeammate.GetActivitiesEffects(Team team, CommonSkillSet common_skill_set)
        {
            List<Skill.Effect> effects = new List<Skill.Effect>();
            List<int> removSkills = new List<int>();

            foreach (var pair in _ActivitiesSkills)
            {
                var skill = pair.Value;
                Skill.Effect effect = skill.GetActivitiesEffect();
                if (team.Consumer(effect.Demand))
                {
                    effects.Add(effect);
                    if (skill.IsConsumed())
                    {
                        removSkills.Add(pair.Key);
                        _Recover.Add(skill);
                        _Recover.Add(common_skill_set.Licensing());
                    }
                }
            }
            if (_RemoveEnableEvent != null)
                _RemoveEnableEvent( (from removeSkill in removSkills select _ActivitiesSkills[removeSkill].ToIndex(removeSkill)).ToArray() );
            foreach(var skill in removSkills)
            {
                _ActivitiesSkills.Remove(skill);

            }

            return effects.ToArray();
        }
Пример #18
0
 internal void InitialBroadcast(Team[] teams)
 {
     _Platoon.BattleBegins();
     _Platoon.SetTeams(teams);
     foreach (var teammates in from t in teams where t != this select t._Platoon.Teammates)
         _Platoon.SetEnemys(teammates);
 }