private void SpawnSlaves() { int count = Math.Min(3, 6 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (Envir.Random.Next(4)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob4)); break; } if (mob == null) continue; if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
private void SpawnSlaves() { int count = Math.Min(6, 40 - SlaveList.Count); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; for (int i = 0; i < count; i++) { MonsterObject mob = null; mob = GetMonster(Envir.GetMonsterInfo(Settings.AncientBatName)); if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Target.CurrentLocation)) { mob.Spawn(CurrentMap, Target.CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
private void SpawnSlaves() { _SpawnedSlaves = true; ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; for (int i = 0; i < 3; i++) { MonsterObject mob = GetMonster(Envir.GetMonsterInfo(Settings.SnowWolfKingMob)); if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Target.Back)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
/// <summary> /// Method to spawn other monsters /// </summary> /// <returns></returns> public bool SpawnMinion() { MonsterObject mob = null; // Get the monster to spawn as slave by name defined mob = GetMonster(Envir.GetMonsterInfo(SlaveName)); // Ensure we're not trying to spawn an invalid monster if (mob == null) { return(false); } // Get a random point on the map within 6 spots from current location Point randomLocation = GetRandomPoint(14, 6, CurrentMap); // Spawn the monster at the random location if (!mob.Spawn(CurrentMap, randomLocation)) { // If we can't spawn the monster at the random location, spawn it on the CrystalBeast mob.Spawn(CurrentMap, CurrentLocation); } // Ensure the target isn't null or dead if (Target == null || Target.Dead) { // Find a new target if the conditions are met FindTarget(); } // Slaves will target the CrystalBeasts target. mob.Target = Target; mob.ActionTime = Envir.Time + 2000; // Add the Slave the the custom slave list so we can destroy it if the CrystalBeast dies (see the Die override) slaves.Add(mob); return(true); }
private void SpawnSlaves() { //一次召唤8个帮手 int count = Math.Min(8, 40 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (RandomUtils.Next(7)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma4)); break; case 4: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma5)); break; case 5: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma6)); break; case 6: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma7)); break; } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
private void SpawnSlaves() { int count = Math.Min(1, 4 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; if (slaves1 == true) { switch (Envir.Random.Next(2)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob2)); break; } } if (slaves2 == true) { switch (Envir.Random.Next(2)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob3)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob4)); break; } } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, Target.CurrentLocation); } mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
private void SpawnBomb() { int distance = Envir.Random.Next(_bombSpreadMin, _bombSpreadMax); for (int j = 0; j < CurrentMap.Players.Count; j++) { Point playerLocation = CurrentMap.Players[j].CurrentLocation; Point location = new Point(playerLocation.X + Envir.Random.Next(-distance, distance + 1), playerLocation.Y + Envir.Random.Next(-distance, distance + 1)); MonsterObject mob = null; switch (Envir.Random.Next(3)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb3)); break; } if (mob == null) { return; } mob.Spawn(CurrentMap, location); } }
private void SpawnSlaves() { int count = Math.Min(8, 40 - SlaveList.Count); Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (Envir.Random.Next(4)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.BoneMonster1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.BoneMonster2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.BoneMonster3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.BoneMonster4)); break; } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
private void SpawnSlaves() { int count = Math.Min(8, 30 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (Envir.Random.Next(7)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.Turtle1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.Turtle2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.Turtle3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.Turtle4)); break; case 4: mob = GetMonster(Envir.GetMonsterInfo(Settings.Turtle5)); break; } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } //mob.Master = this; mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
public bool SpawnSlaves() { int spawnCount = 0; int count = Math.Min(8, 40 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (Envir.Random.Next(4)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.LordMonster1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.LordMonster2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.LordMonster3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.LordMonster4)); break; } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); spawnCount++; } return(spawnCount > 0); }
protected override void ProcessAI() { if (Dead) { return; } if (!IsChild && HP <= MaxHP / 10 && !FinalTeleport) { Point teleportlocation = CurrentLocation; if (TeleportRandom(40, 0)) { FinalTeleport = true; MonsterObject mob = null; for (int i = 0; i < WhiteSnakeCount; i++) { mob = GetMonster(Envir.GetMonsterInfo(Settings.WhiteSnake)); if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, teleportlocation)) { continue; } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; } Target = null; } } if (!IsChild && !ChildSpawned && Envir.Time > SpawnTime) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 }); SpawnSlave(); return; } if (IsChild && SisterMobReady()) { if (Functions.InRange(CurrentLocation, SisterMob.CurrentLocation, 2) && Target == null && Functions.MaxDistance(CurrentLocation, SisterMob.CurrentLocation) < 10) { MoveTo(SisterMob.CurrentLocation); return; } } base.ProcessAI(); }
private void SpawnSlaves() { List <MapObject> targets = FindAllTargets(10, CurrentLocation); int count = Math.Min(8, (targets.Count * 5) - SlaveList.Count); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (Envir.Random.Next(4)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.BehemothMonster1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.BehemothMonster2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.BehemothMonster3)); break; } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = targets[Envir.Random.Next(targets.Count)]; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
private void SpawnSlave() { ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; MonsterObject mob = null; mob = GetMonster(Envir.GetMonsterInfo(Settings.TucsonGeneralEgg)); if (mob == null) { return; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); }
private void CreateGuards() { foreach (GuardInfo info in Info.Guards) { MonsterObject mob = MonsterObject.GetMonster(info.Monster); mob.Direction = info.Direction; if (!mob.Spawn(this, new Point(info.X, info.Y))) { SEnvir.Log($"Failed to spawn Guard Map:{Info.Description}, Location: {info.X}, {info.Y}"); continue; } } }
public void SpawnPet() { MonsterObject mob = GetMonster(SEnvir.MonsterInfoList.Binding.First(x => x.Flag == MonsterFlag.Shinsu)); if (mob == null) { return; } Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); mob.Spawn(CurrentMap.Info, CurrentMap.GetRandomLocation(CurrentLocation, 1)); mob.Target = Target; if (++SummonCount > 5) { CanSummon = false; } }
private void SpawnSlaves() { int count = System.Math.Min(5, 25 - SlaveList.Count); MonsterObject mob = null; var nr = Envir.Random.Next(3); for (int i = 0; i < count; i++) { switch (nr) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.Jar1Mob)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.Jar2Mob)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.Jar3Mob)); break; } if (mob == null) { continue; } mob.Spawn(CurrentMap, Target.CurrentLocation); mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
public override bool SpawnMinion(MonsterObject mob) { return(mob.Spawn(CurrentMap, CurrentMap.GetRandomLocation(CurrentLocation, 10))); }
public override void Die() { base.Die(); if (CurrentMap.HasSafeZone) { return; } if (SEnvir.Random.Next(2) == 0) { MonsterInfo boss; while (true) { boss = SEnvir.BossList[SEnvir.Random.Next(SEnvir.BossList.Count)]; if (boss.Level >= 300) { continue; } break; } MonsterObject mob = GetMonster(boss); mob.Spawn(CurrentMap, CurrentMap.GetRandomLocation(CurrentLocation, 2)); } else { for (int i = CurrentMap.Objects.Count - 1; i >= 0; i--) { MonsterObject mob = CurrentMap.Objects[i] as MonsterObject; if (mob == null) { continue; } if (mob.PetOwner != null) { continue; } if (mob is Guard) { continue; } if (mob.Dead || mob.MoveDelay == 0 || !mob.CanMove) { continue; } if (mob.Target != null) { continue; } if (mob.Level >= 300) { continue; } mob.Teleport(CurrentMap, CurrentMap.GetRandomLocation(CurrentLocation, 15)); } } }
public bool Load() { try { MonsterInfo info = Envir.GetMonsterInfo(Info.MonsterName); if (info == null) { MessageQueue.Enqueue("加载龙失败(错误怪物名): " + Info.MonsterName); return(false); } LinkedMonster = MonsterObject.GetMonster(info); Map map = Envir.GetMapByNameAndInstance(Info.MapFileName); if (map == null) { MessageQueue.Enqueue("加载龙失败(错误的地图名): " + Info.MapFileName); return(false); } if (Info.Location.X > map.Width || Info.Location.Y > map.Height) { MessageQueue.Enqueue("加载龙失败(错误地图XY): " + Info.MapFileName); return(false); } if (LinkedMonster.Spawn(map, Info.Location)) { if (LinkedMonster is EvilMir) { EvilMir mob = (EvilMir)LinkedMonster; if (mob != null) { mob.DragonLink = true; } } MonsterInfo bodyinfo = Envir.GetMonsterInfo(Info.BodyName); if (bodyinfo != null) { MonsterObject bodymob; Point spawnlocation = Point.Empty; for (int i = 0; i <= BodyLocations.Length - 1; i++) { bodymob = MonsterObject.GetMonster(bodyinfo); spawnlocation = new Point(LinkedMonster.CurrentLocation.X + BodyLocations[i].X, LinkedMonster.CurrentLocation.Y + BodyLocations[i].Y); if (bodymob != null) { bodymob.Spawn(LinkedMonster.CurrentMap, spawnlocation); } } } DropArea = new Rectangle(Info.DropAreaTop.X, Info.DropAreaTop.Y, Info.DropAreaBottom.X - Info.DropAreaTop.X, Info.DropAreaBottom.Y - Info.DropAreaTop.Y); Loaded = true; return(true); } } catch (Exception ex) { MessageQueue.Enqueue(ex); } MessageQueue.Enqueue("加载龙失败"); return(false); }
public override bool SpawnMinion(MonsterObject mob) { return(mob.Spawn(CurrentMap.Info, CurrentMap.GetRandomLocation(CurrentLocation, AttackRange))); }
//刷新小怪,这里控制下,不要无限刷新? private void SpawnBomb() { //当前地图怪物超过1200,不刷新了 if (CurrentMap.MonsterCount > 1000) { return; } int NearCount = 0; //周围5格的怪物超过200个,也不刷新了 for (int d = 0; d <= 5; d++) { for (int y = CurrentLocation.Y - d; y <= CurrentLocation.Y + d; y++) { if (y < 0) { continue; } if (y >= CurrentMap.Height) { break; } for (int x = CurrentLocation.X - d; x <= CurrentLocation.X + d; x += Math.Abs(y - CurrentLocation.Y) == d ? 1 : d * 2) { if (x < 0) { continue; } if (x >= CurrentMap.Width) { break; } //Cell cell = CurrentMap.GetCell(x, y); if (!CurrentMap.Valid(x, y) || CurrentMap.Objects[x, y] == null) { continue; } NearCount += CurrentMap.Objects[x, y].Count; } } } if (NearCount > 200) { return; } int distance = RandomUtils.Next(_bombSpreadMin, _bombSpreadMax); for (int j = 0; j < CurrentMap.Players.Count; j++) { Point playerLocation = CurrentMap.Players[j].CurrentLocation; Point location = new Point(playerLocation.X + RandomUtils.Next(-distance, distance + 1), playerLocation.Y + RandomUtils.Next(-distance, distance + 1)); MonsterObject mob = null; switch (RandomUtils.Next(3)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb3)); break; } if (mob == null) { return; } mob.Spawn(CurrentMap, location); } }
public override bool SpawnMinion(MonsterObject mob) { return(mob.Spawn(CurrentMap.Info, Functions.Move(CurrentLocation, Functions.ShiftDirection(Direction, 3)))); }
public override bool SpawnMinion(MonsterObject mob) { return(mob.Spawn(CurrentMap, CurrentMap.GetRandomLocation(Functions.Move(CurrentLocation, MirDirection.DownLeft, 5), 4))); }
public override bool SpawnMinion(MonsterObject mob) { return(mob.Spawn(CurrentMap.Info, CurrentLocation)); }
public void StartRaid() { if (CurrentMap == null || LobbyMap == null) { return; } // Get the Mob info for sub0 MonsterInfo mInfo = Envir.GetMonsterInfo(Info.Sub0Index); // Check it's not null if (mInfo != null) { // Get a Monster object MonsterObject mob = MonsterObject.GetMonster(mInfo); // Check it's not null if (mob != null) { // Set a default direction mob.Direction = MirDirection.DownRight; // Set it's action time mob.ActionTime = Envir.Time + 1000; mob.Raid = this; mob.IsRaidBoss = true; // Inital attempt to spawn bool spawned = mob.Spawn(CurrentMap, Info.BossAreas[0]); // Check if it's not been spawned if (!spawned) { // Loop through locations in a 10x10 square area for (int x = Info.BossAreas[0].X - 5; x < Info.BossAreas[0].X + 5; x++) { // Stop if it's spawned already if (spawned) { continue; } for (int y = Info.BossAreas[0].Y - 5; y < Info.BossAreas[0].Y; y++) { // Attempt to spawn the sub0 if (mob.Spawn(CurrentMap, new Point(x, y))) { // It successfully spawned. spawned = true; } } } } if (spawned) { // Loop through the players on the lobby map for (int i = LobbyMap.Players.Count - 1; i >= 0; i--) { // Notify how logn they have. LobbyMap.Players[i].ReceiveChat(string.Format("You have {0} minutes to complete the raid!", Info.Duration), ChatType.Announcement); LobbyMap.Players[i].ReceiveChat(string.Format("You must defeat {0} located at X:{1} Y:{2} before proceeding to the next boss.", mob.Info.GameName, mob.CurrentLocation.X, mob.CurrentLocation.Y), ChatType.Hint); // Teleport them in within a distance of 12 LobbyMap.Players[i].TeleportRandom(100, 12, CurrentMap); } Envir.Broadcast(new ServerPackets.Chat { Message = string.Format("{0} raid has started!", Info.Title), Type = ChatType.Announcement }); Started = true; } } } }