예제 #1
0
        public void AppendAddDamage(Creature attacker, Creature attacked,
                                    int dmg, ImmunityType type, bool magic)
        {
            lock (lockThis) {
                if (attacked.IsImmune(type))
                {
                    AddMagicEffect(MagicEffect.PUFF, attacked.CurrentPosition);
                    return;
                }

                if (magic && (attacker is Player))
                {
                    dmg = dmg / 2;
                }

                HealthStatus healthStatus = attacked.CurrentHealthStatus;
                Position     pos          = attacked.CurrentPosition;

                attacked.AddDamage(dmg, attacker, magic);
                if (!magic)
                {
                    attacker.NotifyOfAttack();
                }
                if (attacked.IsDead())
                {
                    Item corpse = Item.CreateItem(attacked.Corpse);
                    AppendAddItem(corpse, attacked.CurrentPosition);
                    attacked.AppendNotifyOfDeath(corpse, gameMap);
                }

                if (healthStatus != attacked.CurrentHealthStatus)
                {
                    UpdateHealthStatus(attacked, pos);
                }
            }
        }
예제 #2
0
        public void AppendAddDamage(Creature attacker, Creature attacked,
            int dmg, ImmunityType type, bool magic)
        {
            lock (lockThis) {
                if (attacked.IsImmune(type)) {
                    AddMagicEffect(MagicEffect.PUFF, attacked.CurrentPosition);
                    return;
                }

                if (magic && (attacker is Player)) {
                    dmg = dmg / 2;
                }

                HealthStatus healthStatus = attacked.CurrentHealthStatus;
                Position pos = attacked.CurrentPosition;

                attacked.AddDamage(dmg, attacker, magic);
                if (!magic) {
                    attacker.NotifyOfAttack();
                }
                if (attacked.IsDead()) {
                    Item corpse = Item.CreateItem(attacked.Corpse);
                    AppendAddItem(corpse, attacked.CurrentPosition);
                    attacked.AppendNotifyOfDeath(corpse, gameMap);
                }

                if (healthStatus != attacked.CurrentHealthStatus) {
                    UpdateHealthStatus(attacked, pos);
                }
            }
        }