public bool RemoveFighter(FightActor fighter) { if (!Fighters.Contains(fighter)) { return(false); } var index = Fighters.IndexOf(fighter); Fighters.Remove(fighter); if (index > Index) { return(true); } if (index > 0) { Index--; } else { Index = Fighters.Count - 1; } return(true); }
protected void RemoveFighter(double Id) { lock (CheckLock) { Fighters.Remove(Fighters.Find(f => f.Id == Id)); Monsters.Remove(Monsters.Find(m => m.Id == Id)); } }
public void Remove(IFighter fighter) { Fighters.Remove(fighter); fighter.SetTeam(null); SetupDisplayNames(); }
protected void Death(CharacterFeatures deadGuy) { deadGuy.AttackTimer.Stop(); deadGuy.PowerTimer.Stop(); if (DeadFighters.All(dead => deadGuy != null && dead.Id != deadGuy.Id)) { DeadFighters.Add(deadGuy); Fighters.Remove(deadGuy); } }
private void HandleGameActionFightDeathMessage(IAccount account, GameActionFightDeathMessage message) { lock (CheckLock) { if (Fighter.Id == message.TargetId) { Logger.Default.Log("Bot mort"); Fighters.Remove(Fighters.Find(f => f.Id == message.TargetId)); } if (Monsters.Exists(m => m.Id == message.TargetId)) { Logger.Default.Log($"Monstre[{message.TargetId}] est mort"); Monsters.Remove(Monsters.Find(m => m.Id == message.TargetId)); Logger.Default.Log($"Signalig FighterDiedAutoReset", LogMessageType.Divers); FighterDiedAutoReset.Set(); } } }
private void CollectDeadBodies() { foreach (var fighter in Fighters.Values.Where(o => !o.IsAlive(configuration.CalculationValues))) { fighter.States.Clear(); // remove all pending states DeadFighters.Add(fighter.Id, fighter); CurrentRoundTick.Ticks.Add(new EngineFighterDiedTick() { Fighter = fighter.AsStruct() }); } foreach (var fighter in DeadFighters) { if (!Fighters.ContainsKey(fighter.Key)) { continue; } Fighters.Remove(fighter.Key); } }
protected void RemoveFighter(double Id) { Fighters.Remove(Fighters.Find(f => f.Id == Id)); Monsters.Remove(Monsters.Find(m => m.Id == Id)); Companions.Remove(Companions.Find(c => c.Id == Id)); }
public virtual void Exit(Mobile fighter) { if (fighter == null) { return; } // teleport fighter if (fighter.NetState == null && MobileIsInBossArea(fighter.LogoutLocation)) { fighter.LogoutMap = this is CitadelAltar ? Map.Tokuno : Map; fighter.LogoutLocation = ExitDest; } else if (MobileIsInBossArea(fighter) && fighter.Map == Map) { fighter.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); fighter.PlaySound(0x1FE); if (this is CitadelAltar) { fighter.MoveToWorld(ExitDest, Map.Tokuno); } else { fighter.MoveToWorld(ExitDest, Map); } } // teleport his pets if (fighter is PlayerMobile) { foreach (BaseCreature pet in ((PlayerMobile)fighter).AllFollowers.OfType <BaseCreature>().Where(pet => pet != null && (pet.Alive || pet.IsBonded) && pet.Map != Map.Internal && MobileIsInBossArea(pet))) { if (pet is BaseMount) { BaseMount mount = (BaseMount)pet; if (mount.Rider != null && mount.Rider != fighter) { mount.Rider.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); mount.Rider.PlaySound(0x1FE); if (this is CitadelAltar) { mount.Rider.MoveToWorld(ExitDest, Map.Tokuno); } else { mount.Rider.MoveToWorld(ExitDest, Map); } continue; } else if (mount.Rider != null) { continue; } } pet.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); pet.PlaySound(0x1FE); if (this is CitadelAltar) { pet.MoveToWorld(ExitDest, Map.Tokuno); } else { pet.MoveToWorld(ExitDest, Map); } } } Fighters.Remove(fighter); fighter.SendLocalizedMessage(1072677); // You have been transported out of this room. if (MasterKeys.Count == 0 && Fighters.Count == 0 && Owner != null) { StopTimers(); Owner = null; if (Peerless != null) { if (Peerless.Corpse != null && !Peerless.Corpse.Deleted) { Peerless.Corpse.Delete(); } if (!Peerless.Deleted) { Peerless.Delete(); } } CleanupHelpers(); // reset summoner, boss Peerless = null; Deadline = DateTime.MinValue; } }
public virtual void Exit(Mobile fighter) { // teleport fighter if (fighter.NetState == null && MobileIsInBossArea(fighter.LogoutLocation)) { fighter.LogoutMap = this is CitadelAltar ? Map.Tokuno : this.Map; fighter.LogoutLocation = ExitDest; } else if (MobileIsInBossArea(fighter) && fighter.Map == this.Map) { fighter.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); fighter.PlaySound(0x1FE); if (this is CitadelAltar) { fighter.MoveToWorld(ExitDest, Map.Tokuno); } else { fighter.MoveToWorld(ExitDest, Map); } } // teleport his pets if (fighter is PlayerMobile) { foreach (var pet in ((PlayerMobile)fighter).AllFollowers.OfType <BaseCreature>().Where(pet => (pet.Alive || pet.IsBonded) && pet.Map != Map.Internal && MobileIsInBossArea(pet))) { if (pet is BaseMount) { BaseMount mount = (BaseMount)pet; if (mount.Rider != null && mount.Rider != fighter) { mount.Rider.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); mount.Rider.PlaySound(0x1FE); if (this is CitadelAltar) { mount.Rider.MoveToWorld(ExitDest, Map.Tokuno); } else { mount.Rider.MoveToWorld(ExitDest, Map); } continue; } else if (mount.Rider != null) { continue; } } pet.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); pet.PlaySound(0x1FE); if (this is CitadelAltar) { pet.MoveToWorld(ExitDest, Map.Tokuno); } else { pet.MoveToWorld(ExitDest, Map); } } } Fighters.Remove(fighter); fighter.SendLocalizedMessage(1072677); // You have been transported out of this room. }
public async Task <List <CharacterFeatures> > Launch() { Fighters.ForEach(x => { x.OnPower += (sender, e) => { if (Fighters.Count <= 1) { return; } var fighter = sender as CharacterFeatures; if (fighter.CurrentLife > 0) { //Console.WriteLine($"{fighter} utilise son pouvoir"); CharacterFeatures enemy; switch (fighter) { case Zombie: enemy = GetDeadEnemy(fighter); fighter.Power(enemy.MaximumLife); break; case Vampire: enemy = GetEnemy(fighter); fighter.Power(enemy); break; case Pretre: fighter.Power(); break; case Assassin: if (GetNumberOfAliveFighter() > 5) { fighter.Power(); } break; case Necromancien: if (DeadFighters.Count == 0) { fighter.Power(); } else { fighter.IsHide = false; } break; default: //fighter.Power(); break; } } }; x.OnDeath += (sender, args) => { var deadGuy = sender as CharacterFeatures; if (DeadFighters.All(dead => deadGuy != null && dead.Id != deadGuy.Id)) { DeadFighters.Add(deadGuy); Fighters.Remove(deadGuy); Console.WriteLine($"Bouhouhou {deadGuy} is dead"); } }; x.OnAttack += (sender, e) => { if (Fighters.Count <= 1) { return; } var fighter = sender as CharacterFeatures; if (fighter.CurrentLife > 0) { var enemy = GetEnemy(fighter); //Console.WriteLine($"{fighter} attaque {enemy}"); enemy.SufferAttack(fighter, fighter.DamageType); if (enemy.IsDead()) { Death(enemy); } if (fighter.IsDead()) { Death(fighter); } } }; x.StartFight(); }); do { await Task.Delay(2000); } while (Fighters.Count(x => !x.IsDead()) > 1); await Task.Delay(5000); return(DeadFighters.Distinct().ToList()); }