상속: Entity
예제 #1
0
파일: NPC.cs 프로젝트: Club559/RotMGNPCs
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public void Damage(int dmg, Character chr)
 {
 }
예제 #4
0
 public void EnemyKilled(Enemy enemy, Character killer)
 {
     if (Overseer != null)
         Overseer.OnEnemyKilled(enemy, killer);
 }
예제 #5
0
 public void HitBy(Character chr, Projectile projectile, int dmg)
 {
     LastProjectile = projectile;
     LastHitterChar = chr;
 }
예제 #6
0
파일: Oryx.cs 프로젝트: Club559/RotMGNPCs
        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);
                    }
                }
            }
        }
예제 #7
0
 public void Damage(int dmg, Character chr)
 {
 }