Пример #1
0
	    public Entity() {
            this.entityFocusId = -1;
            queuedHits = new Queue<Hits.Hit>();
            hits = new Hits();
            visible = true;
            dead = false;
            target = null;
            attacker = null;
            combatTurns = 0;
            poisonAmount = 0;
            damageTaken = 0; //this is used for small damages such as 0.10 etc. when it reaches 1.0 it will take 1 hp off health.
            killers = new Dictionary<Entity, double>();
            temporaryAttributes = new Dictionary<string, Object>();
            follow = new Follow(this);
            sprite = new Sprite();
            this.location = new Location(2322 + misc.random(1), 3171 + misc.random(5), 0);
	    }
Пример #2
0
 public Entity()
 {
     this.entityFocusId = -1;
     queuedHits         = new Queue <Hits.Hit>();
     hits                = new Hits();
     visible             = true;
     dead                = false;
     target              = null;
     attacker            = null;
     combatTurns         = 0;
     poisonAmount        = 0;
     damageTaken         = 0; //this is used for small damages such as 0.10 etc. when it reaches 1.0 it will take 1 hp off health.
     killers             = new Dictionary <Entity, double>();
     temporaryAttributes = new Dictionary <string, Object>();
     follow              = new Follow(this);
     sprite              = new Sprite();
     this.location       = new Location(2322 + misc.random(1), 3171 + misc.random(5), 0);
 }
Пример #3
0
 public abstract void hit(double damage, Hits.HitType type);
Пример #4
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));
            }
        }
Пример #5
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));
            }
        }