public void Damage(int dmg, Character chr) { if (HasConditionEffect(ConditionEffects.Paused) || HasConditionEffect(ConditionEffects.Stasis) || HasConditionEffect(ConditionEffects.Invincible)) return; dmg = (int)StatsManager.GetDefenseDamage(this, dmg, ObjectDesc.Defense); if (!HasConditionEffect(ConditionEffects.Invulnerable)) HP -= dmg; UpdateCount++; Owner.BroadcastPacket(new DamagePacket() { TargetId = this.Id, Effects = 0, Damage = (ushort)dmg, Killed = HP <= 0, BulletId = 0, ObjectId = chr.Id }, null); string enName = chr.Name == "" ? null : chr.Name; string killer = enName ?? chr.ObjectDesc.DisplayId ?? chr.ObjectDesc.ObjectId; if (HP <= 0) Death(killer); }
public void Damage(int dmg, Character chr) { if (HasConditionEffect(ConditionEffects.Paused) || HasConditionEffect(ConditionEffects.Stasis) || HasConditionEffect(ConditionEffects.Invincible)) return; dmg = (int)statsMgr.GetDefenseDamage(dmg, false); if (!HasConditionEffect(ConditionEffects.Invulnerable)) HP -= dmg; UpdateCount++; Owner.BroadcastPacket(new DamagePacket() { TargetId = this.Id, Effects = 0, Damage = (ushort)dmg, Killed = HP <= 0, BulletId = 0, ObjectId = chr.Id }, this); if (HP <= 0) Death( chr.ObjectDesc.DisplayId ?? chr.ObjectDesc.ObjectId); }
public void Damage(int dmg, Character chr) { }
public void EnemyKilled(Enemy enemy, Character killer) { if (Overseer != null) Overseer.OnEnemyKilled(enemy, killer); }
public void HitBy(Character chr, Projectile projectile, int dmg) { LastProjectile = projectile; LastHitterChar = chr; }
public void OnEnemyKilled(Enemy enemy, Character killer) { if (enemy.ObjectDesc != null && enemy.ObjectDesc.Quest) { TauntData? dat = null; foreach (var i in criticalEnemies) if ((enemy.ObjectDesc.DisplayId ?? enemy.ObjectDesc.ObjectId) == i.Item1) { dat = i.Item2; break; } if (dat == null) return; if (dat.Value.killed != null) { var arr = dat.Value.killed; string msg = arr[rand.Next(0, arr.Length)]; while (killer == null && msg.Contains("{PLAYER}")) msg = arr[rand.Next(0, arr.Length)]; msg = msg.Replace("{PLAYER}", killer.Name); BroadcastMsg(msg); } if (rand.NextDouble() < 0.25) { var evt = events[rand.Next(0, events.Count)]; if (XmlDatas.ObjectDescs[XmlDatas.IdToType[evt.Item1]].PerRealmMax == 1) events.Remove(evt); SpawnEvent(evt.Item2); dat = null; foreach (var i in criticalEnemies) if (evt.Item1 == i.Item1) { dat = i.Item2; break; } if (dat == null) return; if (dat.Value.spawn != null) { var arr = dat.Value.spawn; string msg = arr[rand.Next(0, arr.Length)]; BroadcastMsg(msg); } } } }