Beispiel #1
0
        public override void ReduceHp(L2Character attacker, double damage)
        {
            if (Dead)
            {
                return;
            }

            //if ((this is L2Player && attacker is L2Player))
            //{
            //    if (CurCp > 0)
            //    {
            //        CurCp -= damage;

            //        if (CurCp < 0)
            //        {
            //            damage = CurCp * -1;
            //            CurCp = 0;
            //        }
            //    }
            //}

            CurHp -= damage;

            StatusUpdate su = new StatusUpdate(this);

            su.Add(StatusUpdate.CurHp, (int)CurHp);
            // su.Add(StatusUpdate.CurCp, (int)CurCp);
            BroadcastPacket(su);

            if (CurHp <= 0)
            {
                CurHp = 0;
                DoDie(attacker);
                return;
            }
        }
Beispiel #2
0
 public virtual void ReduceHp(L2Character attacker, double damage)
 {
 }
Beispiel #3
0
 public virtual void AddAbnormal(Skill skill, L2Character caster, bool permanent, bool unlim)
 {
 }
Beispiel #4
0
 public void RemoveFromZones(L2Character character)
 {
     _zones.ForEach(zone => zone.RemoveCharacter(character));
 }
Beispiel #5
0
        public virtual void DoAttack(L2Character target)
        {
            if (target == null)
            {
                return;
            }

            if (target.Dead)
            {
                return;
            }

            if ((AttackToHit != null) && AttackToHit.Enabled)
            {
                return;
            }

            if ((AttackToEnd != null) && AttackToEnd.Enabled)
            {
                return;
            }

            double dist  = 60,
                   reqMp = 0;

            L2Item weapon  = ActiveWeapon;
            double timeAtk = 100;//attackspeed
            bool   dual    = false,
                   ranged  = false,
                   ss      = false;

            if (weapon != null)
            {
            }
            else
            {
                timeAtk = (1362 * 345) / timeAtk;
            }

            if (!Calcs.CheckIfInRange((int)dist, this, target, true))
            {
                TryMoveTo(target.X, target.Y, target.Z);
                return;
            }

            if ((reqMp > 0) && (reqMp > CurMp))
            {
                SendMessage($"no mp {CurMp} {reqMp}");
                return;
            }

            Attack atk = new Attack(this, target, ss, 5);

            if (dual)
            {
                Hit1 = GenHitSimple(true, ss);
                atk.AddHit(target.ObjId, (int)Hit1.Damage, Hit1.Miss, Hit1.Crit, Hit1.ShieldDef > 0);

                Hit2 = GenHitSimple(true, ss);
                atk.AddHit(target.ObjId, (int)Hit2.Damage, Hit2.Miss, Hit2.Crit, Hit2.ShieldDef > 0);
            }
            else
            {
                Hit1 = GenHitSimple(false, ss);
                atk.AddHit(target.ObjId, (int)Hit1.Damage, Hit1.Miss, Hit1.Crit, Hit1.ShieldDef > 0);
            }

            Target = target;

            if (AttackToHit == null)
            {
                AttackToHit          = new Timer();
                AttackToHit.Elapsed += AttackDoHit;
            }

            double timeToHit = ranged ? timeAtk * 0.5 : timeAtk * 0.6;

            AttackToHit.Interval = timeToHit;
            AttackToHit.Enabled  = true;

            if (dual)
            {
                if (AttackToHitBonus == null)
                {
                    AttackToHitBonus          = new Timer();
                    AttackToHitBonus.Elapsed += AttackDoHit2Nd;
                }

                AttackToHitBonus.Interval = timeAtk * 0.78;
                AttackToHitBonus.Enabled  = true;
            }

            if (AttackToEnd == null)
            {
                AttackToEnd          = new Timer();
                AttackToEnd.Elapsed += AttackDoEnd;
            }

            AttackToEnd.Interval = timeAtk;
            AttackToEnd.Enabled  = true;

            BroadcastPacket(atk);
        }