public void Update(IEnumerable <TSPlayer> shieldedPlayers) { foreach (var player in shieldedPlayers) { ForceFieldUser user = player.GetForceFieldUser(); if (!user.HasField(this)) { continue; } var pos = player.TPlayer.position; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; if (npc.active && !npc.friendly && !npc.townNPC && npc.life != 0 && Vector2.Distance(pos, npc.position) < Radius) { Main.npc[i].active = false; Main.npc[i].type = 0; TSPlayer.All.SendData(PacketTypes.NpcUpdate, "", i); } } } }
public void Update(IEnumerable <TSPlayer> shieldedPlayers) { foreach (var player in shieldedPlayers) { ForceFieldUser user = player.GetForceFieldUser(); if (!user.HasField(this)) { continue; } var pos = player.TPlayer.position; var plrList = TShock.Players.Where( p => p != null && p.Active && p.Team == player.Team && p.Team != 0 && Vector2.Distance(pos, p.TPlayer.position) < Radius); if ((DateTime.UtcNow - (DateTime)user["LastHealthRecovered"]).TotalSeconds >= (int)user["TimeBetweenHeals"]) { foreach (var plr in plrList) { plr.Heal((int)user["HealthRecoveryAmount"]); } user["LastHealthRecovered"] = DateTime.UtcNow; } } }
public void Update(IEnumerable <TSPlayer> shieldedPlayers) { foreach (var player in shieldedPlayers) { ForceFieldUser user = player.GetForceFieldUser(); if (!user.HasField(this)) { continue; } var pos = player.TPlayer.position; var plrList = TShock.Players.Where( p => p != null && p.Active && p.Team == player.Team && p.Team != 0 && Vector2.Distance(pos, p.TPlayer.position) < Radius); if ((DateTime.UtcNow - (DateTime)user["LastBuffSet"]).TotalSeconds >= 1) { foreach (TSPlayer plr in plrList) { foreach (int buff in (List <int>)user["BuffList"]) { plr.SetBuff(buff, 60, true); } } user["LastBuffSet"] = DateTime.UtcNow; } } }
public void Update(IEnumerable <TSPlayer> shieldedPlayers) { foreach (var player in shieldedPlayers) { ForceFieldUser user = player.GetForceFieldUser(); if (!user.HasField(this)) { continue; } var pos = player.TPlayer.position; var npcList = Main.npc.Where( n => n != null && n.active && !n.friendly && !n.townNPC && n.life != 0 && Vector2.Distance(pos, n.position) < Radius); foreach (var npc in npcList) { TSPlayer.Server.StrikeNPC(npc.whoAmI, npc.lifeMax + (npc.defense * 2) + 200, 0, 0); } } }
public void Update(IEnumerable <TSPlayer> shieldedPlayers) { foreach (var player in shieldedPlayers) { ForceFieldUser user = player.GetForceFieldUser(); if (!user.HasField(this)) { continue; } var pos = player.TPlayer.position; var npcList = Main.npc.Where( n => n != null && n.active && !n.friendly && !n.townNPC && n.life != 0 && Vector2.Distance(pos, n.position) < Radius); foreach (var npc in npcList) { var xDirection = 1; var yDirection = 1; if (npc.position.X < player.TPlayer.position.X) { xDirection = -1; } if (npc.position.Y < player.TPlayer.position.Y) { yDirection = -1; } if (npc.velocity == Vector2.Zero) { npc.velocity.X = 3; npc.velocity.Y = 3; } float force; if (npc.velocity.X > npc.velocity.Y) { force = npc.velocity.X / 15f; npc.velocity.X = 25; npc.velocity.Y *= force; } else { force = npc.velocity.Y / 15f; npc.velocity.X *= force; npc.velocity.Y = 25; } npc.velocity.X *= xDirection; npc.velocity.Y *= yDirection; } } }
public void Update(IEnumerable <TSPlayer> shieldedPlayers) { foreach (var player in shieldedPlayers) { ForceFieldUser user = player.GetForceFieldUser(); if (!user.HasField(this)) { continue; } var pos = player.TPlayer.position; var plrList = TShock.Players.Where( p => p != null && p.Active && p.Team == player.Team && p.Team != 0 && Vector2.Distance(pos, p.TPlayer.position) < Radius); if ((DateTime.UtcNow - (DateTime)user["LastManaRecovered"]).TotalSeconds >= (int)user["TimeBetweenRestores"]) { foreach (var plr in plrList) { var restore = Math.Min((int)user["ManaRecoveryAmount"], plr.TPlayer.statManaMax2 - plr.TPlayer.statMana); if (Main.ServerSideCharacter) { plr.TPlayer.statMana += restore; plr.SendData(PacketTypes.PlayerMana, "", plr.Index); plr.SendData(PacketTypes.EffectMana, "", plr.Index, restore); } } user["LastManaRecovered"] = DateTime.UtcNow; } } }
public void Update(IEnumerable <TSPlayer> shieldedPlayers) { foreach (var player in shieldedPlayers) { ForceFieldUser user = player.GetForceFieldUser(); if (!user.HasField(this)) { continue; } var pos = player.TPlayer.position; var plrList = TShock.Players.Where( p => p != null && p != player && p.Active && Vector2.Distance(pos, p.TPlayer.position) < Radius); foreach (TSPlayer plr in plrList) { plr.DamagePlayer(Math.Max(plr.TPlayer.statLifeMax, plr.TPlayer.statLifeMax2)); } } }