public void HitBy(Player player, Projectile projectile, int dmg) { int totalDmg; if (!hitters.TryGetValue(player, out totalDmg)) totalDmg = 0; totalDmg += dmg; hitters[player] = totalDmg; LastProjectile = projectile; LastHitter = player; player.FameCounter.Hit(projectile, enemy); }
public override bool HitByProjectile(Projectile projectile, RealmTime time) { return false; }
public override bool HitByProjectile(Projectile projectile, RealmTime time) { if (stat) return false; if (HasConditionEffect(ConditionEffects.Invincible)) return false; if (projectile.ProjectileOwner is Player && !HasConditionEffect(ConditionEffects.Paused) && !HasConditionEffect(ConditionEffects.Stasis)) { var def = this.ObjectDesc.Defense; if (projectile.Descriptor.ArmorPiercing) def = 0; int dmg = (int)StatsManager.GetDefenseDamage(this, projectile.Damage, def); if (!HasConditionEffect(ConditionEffects.Invulnerable)) HP -= dmg; ApplyConditionEffect(projectile.Descriptor.Effects); Owner.BroadcastPacket(new DamagePacket() { TargetId = this.Id, Effects = projectile.ConditionEffects, Damage = (ushort)dmg, Killed = HP < 0, BulletId = projectile.ProjectileId, ObjectId = projectile.ProjectileOwner.Self.Id }, projectile.ProjectileOwner as Player); foreach (var i in CondBehaviors) if ((i.Condition & BehaviorCondition.OnHit) != 0) i.Behave(BehaviorCondition.OnHit, this, time, projectile); counter.HitBy(projectile.ProjectileOwner as Player, projectile, dmg); if (HP < 0) { foreach (var i in CondBehaviors) if ((i.Condition & BehaviorCondition.OnDeath) != 0) i.Behave(BehaviorCondition.OnDeath, this, time, counter); counter.Death(); if (Owner != null) Owner.LeaveWorld(this); } UpdateCount++; return true; } return false; }