public void StartFighting() { ForEach(x => x.Character.PreviousRoleplayMapId = x.Character.Record.MapId); ForEach(x => x.UpdateStep(false, PvpArenaStepEnum.ARENA_STEP_STARTING_FIGHT)); MapRecord map = ArenaMapRecord.GetArenaMap(); foreach (var member in BlueTeam.GetMembers()) { member.Character.Teleport(map.Id, null, true); CheckIntegrity(member); } foreach (var member in RedTeam.GetMembers()) { member.Character.Teleport(map.Id, null, true); CheckIntegrity(member); } FightArena fight = FightProvider.Instance.CreateFightArena(map); foreach (var member in BlueTeam.GetMembers()) { fight.BlueTeam.AddFighter(member.Character.CreateFighter(fight.BlueTeam)); } foreach (var member in RedTeam.GetMembers()) { fight.RedTeam.AddFighter(member.Character.CreateFighter(fight.RedTeam)); } fight.StartPlacement(); this.Dispose(); }
public void ForEach(Action <ArenaMember> action) { foreach (var member in BlueTeam.GetMembers()) { action(member); } foreach (var member in RedTeam.GetMembers()) { action(member); } }
/// <summary> /// Le joueur a t-il le niveau pour rejoindre ce groupe /// </summary> /// <param name="character"></param> /// <returns></returns> public bool CanChallenge(Character character) { if (Empty) // Si le groupe est vide, ... il a forcement le niveau { return(true); } double mediumLevel = 1; double med = Extensions.Med(Array.ConvertAll(BlueTeam.GetMembers(), x => x.Character.Level)); // niveau moyen de l'équipe bleue double med2 = Extensions.Med(Array.ConvertAll(RedTeam.GetMembers(), x => x.Character.Level)); // niveau moyen de l'équipe rouge if (med2 == 0) // si il n'y a aucun membre dans l'équipe rouge { mediumLevel = med; } else if (med == 0) // si il n'y a aucun membre dans l'équipe bleue { mediumLevel = med2; } else { mediumLevel = Extensions.Med(new double[] { med, med2 }); // on calcule la moyenne de niveau entre les deux groupes } return(character.Level > mediumLevel - LEVEL_SHIFT && character.Level < mediumLevel + LEVEL_SHIFT); // mediumLevel - shift < x < mediumLevel + shift }
public ArenaMember[] GetAllMembers() { return(BlueTeam.GetMembers().Concat(RedTeam.GetMembers()).ToArray()); }