Exemplo n.º 1
0
        public override void hit(double damage, Hits.HitType type)
        {
            bool redemption = prayers.getHeadIcon() == PrayerData.PrayerHeadIcon.REDEMPTION;
            byte maxHp      = (byte)skills.getMaxLevel(Skills.SKILL.HITPOINTS);
            byte newHp      = (byte)(skills.getMaxLevel(Skills.SKILL.HITPOINTS) - damage);

            if (redemption)
            {
                if (newHp >= 1 && newHp <= maxHp * 0.10)
                {
                    setLastGraphics(new Graphics(436, 0, 0));
                    packets.sendMessage("Using your prayer skill, you heal yourself.");
                    skills.setCurLevel(Skills.SKILL.PRAYER, 0);
                    packets.sendSkillLevel(Skills.SKILL.PRAYER);
                    heal((int)(skills.getMaxLevel(Skills.SKILL.PRAYER) * 0.25));
                }
            }
            if (duelSession != null)
            {
                if (duelSession.getStatus() >= 8)
                {
                    return;
                }
            }
            else
            {
                if (newHp >= 1 && newHp <= maxHp * 0.10 && !redemption)
                {
                    if (equipment.getItemInSlot(ItemData.EQUIP.RING) == 2570)
                    {
                        teleport(new Location(3221 + misc.random(1), 3217 + misc.random(3), 0));
                        packets.sendMessage("Your ring of life shatters whilst teleporting you to safety.");
                        equipment.getSlot(ItemData.EQUIP.RING).setItemId(-1);
                        equipment.getSlot(ItemData.EQUIP.RING).setItemAmount(0);
                        packets.refreshEquipment();
                        queuedHits.Clear();
                        Combat.resetCombat(this, 1);
                        return;
                    }
                }
            }
            bool damageOverZero = damage > 0.10;

            if (damage > skills.getCurLevel(Skills.SKILL.HITPOINTS))
            {
                damage = skills.getCurLevel(Skills.SKILL.HITPOINTS);
            }

            if (!damageOverZero || isDead())
            {
                type   = Hits.HitType.NO_DAMAGE;
                damage = 0;
            }

            lock (queuedHits)
            {
                queuedHits.Enqueue(new Hits.Hit(damage, type));
            }
        }
Exemplo n.º 2
0
        public override void hit(int damage, Hits.HitType type)
        {
            bool damageOverZero = damage > 0;

            if (damage > skills.getCurLevel(NpcSkills.SKILL.HITPOINTS))
            {
                damage = skills.getCurLevel(NpcSkills.SKILL.HITPOINTS);
            }
            if (damageOverZero && damage == 0)
            {
                type = Hits.HitType.NO_DAMAGE;
            }
            if (!updateFlags.isHitUpdateRequired())
            {
                getHits().setHit1(new Hits.Hit(damage, type));
                updateFlags.setHitUpdateRequired(true);
            }
            else
            {
                if (!updateFlags.isHit2UpdateRequired())
                {
                    getHits().setHit2(new Hits.Hit(damage, type));
                    updateFlags.setHit2UpdateRequired(true);
                }
                else
                {
                    lock (queuedHits)
                    {
                        queuedHits.Enqueue(new Hits.Hit(damage, type));
                    }
                }
            }
            skills.setCurLevel(NpcSkills.SKILL.HITPOINTS, skills.getCurLevel(NpcSkills.SKILL.HITPOINTS) - damage);
            if (skills.getCurLevel(NpcSkills.SKILL.HITPOINTS) == 0)
            {
                if (!isDead())
                {
                    Server.registerEvent(new DeathEvent(this));
                    setDead(true);
                }
            }
        }
Exemplo n.º 3
0
        public override void hit(double damage, Hits.HitType type)
        {
            //damage of 0.10 is shown as damage of 1. (lowest possible damage).
            //damage of 1 is shown as damage of 10.
            //damage of 10 is shown as damage of 100.
            bool damageOverZero = damage > 0.10;

            if (damage > skills.getCurLevel(NpcSkills.SKILL.HITPOINTS))
            {
                damage = skills.getCurLevel(NpcSkills.SKILL.HITPOINTS);
            }

            if (!damageOverZero || isDead())
            {
                type   = Hits.HitType.NO_DAMAGE;
                damage = 0;
            }

            lock (queuedHits)
            {
                queuedHits.Enqueue(new Hits.Hit(damage, type));
            }
        }
Exemplo n.º 4
0
 public abstract void hit(double damage, Hits.HitType type);
Exemplo n.º 5
0
 public abstract void hit(int damage, Hits.HitType type);