public Enemy(RealmManager manager, ushort objType)
     : base(manager, objType, new wRandom())
 {
     stat = ObjectDesc.MaxHP == 0;
     counter = new DamageCounter(this);
     LootState = "";
     Name = ObjectDesc.ObjectId;
 }
Exemplo n.º 2
0
 public Enemy(RealmManager manager, ushort objType)
     : base(manager, objType, new wRandom())
 {
     stat = ObjectDesc.MaxHP == 0;
     MaxHP = ObjectDesc.MaxHP;
     Defense = ObjectDesc.Defense;
     counter = new DamageCounter(this);
 }
Exemplo n.º 3
0
        /*public void Death(RealmTime time)
         * {
         *  if (Corpse != null)
         *  {
         *      Corpse.Parent = this;
         *      return;
         *  }
         *
         *  List<Tuple<Player, int>> eligiblePlayers = new List<Tuple<Player, int>>();
         *  int totalDamage = 0;
         *  int totalPlayer = 0;
         *  var enemy = (Parent ?? this).enemy;
         *  foreach (var i in (Parent ?? this).hitters)
         *  {
         *      if (i.Key.Owner == null) continue;
         *      totalDamage += i.Value;
         *      totalPlayer++;
         *      eligiblePlayers.Add(new Tuple<Player, int>(i.Key, i.Value));
         *  }
         *  if (totalPlayer != 0)
         *  {
         *      float totalExp = totalPlayer * (enemy.ObjectDesc.MaxHP / 10f) * (enemy.ObjectDesc.ExpMultiplier ?? 1);
         *      float lowerLimit = totalExp / totalPlayer * 0.1f;
         *      int lvUps = 0;
         *      foreach (var i in eligiblePlayers)
         *      {
         *          float playerXp = totalExp * i.Item2 / totalDamage;
         *
         *          float upperLimit = i.Item1.ExperienceGoal * 0.1f;
         *          if (i.Item1.Quest == enemy)
         *              upperLimit = i.Item1.ExperienceGoal * 0.5f;
         *
         *          if (playerXp < lowerLimit) playerXp = lowerLimit;
         *          if (playerXp > upperLimit) playerXp = upperLimit;
         *
         *          var killer = (Parent ?? this).LastHitter == i.Item1;
         *          if (i.Item1.EnemyKilled(
         *              enemy,
         *              (int)playerXp,
         *              killer) && !killer)
         *              lvUps++;
         *      }
         *      (Parent ?? this).LastHitter.FameCounter.LevelUpAssist(lvUps);
         *  }
         *
         *  if (enemy.Owner is Realm)
         *      (enemy.Owner as Realm).EnemyKilled(enemy, (Parent ?? this).LastHitter);
         * }*/

        public void TransferData(DamageCounter dc)
        {
            dc.LastProjectile = LastProjectile;
            dc.LastHitter     = LastHitter;

            foreach (var plr in hitters.Keys)
            {
                int totalDmg;
                int totalExistingDmg;

                if (!hitters.TryGetValue(plr, out totalDmg))
                {
                    totalDmg = 0;
                }
                if (!dc.hitters.TryGetValue(plr, out totalExistingDmg))
                {
                    totalExistingDmg = 0;
                }

                dc.hitters[plr] = totalDmg + totalExistingDmg;
            }
        }
 public void SetDamageCounter(DamageCounter counter, Enemy enemy)
 {
     this.counter = counter;
     this.counter.UpdateEnemy(enemy);
 }
 public override void Dispose()
 {
     counter = null;
     base.Dispose();
 }
Exemplo n.º 6
0
 public void SetDamageCounter(DamageCounter counter, Enemy target)
 {
     target.counter = counter;
 }
Exemplo n.º 7
0
 public Enemy(short objType)
     : base(objType, new wRandom())
 {
     stat = ObjectDesc.MaxHP == 0;
     counter = new DamageCounter(this);
 }