Exemple #1
0
        public virtual void Add(HumanObject player)
        {
            if (player.Race != ObjectType.Player)
            {
                return;
            }

            if (Race == ObjectType.Merchant)
            {
                NPCObject npc = (NPCObject)this;
                npc.CheckVisible((PlayerObject)player, true);
                return;
            }

            player.Enqueue(GetInfo());

            //if (Race == ObjectType.Player)
            //{
            //    PlayerObject me = (PlayerObject)this;
            //    player.Enqueue(me.GetInfoEx(player));
            //}
            //else
            //{
            //    player.Enqueue(GetInfo());
            //}
        }
Exemple #2
0
 public virtual void ApplyNegativeEffects(HumanObject attacker, DefenceType type, ushort levelOffset)
 {
     if (attacker.SpecialMode.HasFlag(SpecialItemMode.Paralize) && type != DefenceType.MAC && type != DefenceType.MACAgility && 1 == Envir.Random.Next(1, 15))
     {
         ApplyPoison(new Poison {
             PType = PoisonType.Paralysis, Duration = 5, TickSpeed = 1000
         }, attacker);
     }
     if ((attacker.Stats[Stat.Freezing] > 0) && (Settings.PvpCanFreeze || Race != ObjectType.Player) && type != DefenceType.MAC && type != DefenceType.MACAgility)
     {
         if ((Envir.Random.Next(Settings.FreezingAttackWeight) < attacker.Stats[Stat.Freezing]) && (Envir.Random.Next(levelOffset) == 0))
         {
             ApplyPoison(new Poison {
                 PType = PoisonType.Slow, Duration = Math.Min(10, (3 + Envir.Random.Next(attacker.Stats[Stat.Freezing]))), TickSpeed = 1000
             }, attacker);
         }
     }
     if (attacker.Stats[Stat.PoisonAttack] > 0 && type != DefenceType.MAC && type != DefenceType.MACAgility)
     {
         if ((Envir.Random.Next(Settings.PoisonAttackWeight) < attacker.Stats[Stat.PoisonAttack]) && (Envir.Random.Next(levelOffset) == 0))
         {
             ApplyPoison(new Poison {
                 PType = PoisonType.Green, Duration = 5, TickSpeed = 1000, Value = Math.Min(10, 3 + Envir.Random.Next(attacker.Stats[Stat.PoisonAttack]))
             }, attacker);
         }
     }
 }
Exemple #3
0
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
        {
            int currentMoveDistance = 0;

            Point target = Functions.PointMove(CurrentLocation, attacker.Direction, _ballMoveDistance);

            MirDirection dir = Functions.DirectionFromPoint(CurrentLocation, target);

            while (currentMoveDistance < _ballMoveDistance)
            {
                Point location = Functions.PointMove(CurrentLocation, dir, 1);

                if (location.X < 0 || location.Y < 0 || location.X >= CurrentMap.Width || location.Y >= CurrentMap.Height)
                {
                    break;
                }

                currentMoveDistance++;

                if (!CurrentMap.GetCell(location).Valid)
                {
                    dir = Functions.ReverseDirection(dir);
                    continue;
                }

                Walk(dir);
                MoveTime   = 0;
                ActionTime = 0;
            }

            return(0);
        }
Exemple #4
0
        public override void PoisonDamage(int damage, MapObject attacker)
        {
            damage = damage * (-1);
            if (attacker == null || (attacker is MonsterObject && attacker.Master == null))
            {
                return;
            }

            if (_currentAttacker != null && (_currentAttacker != attacker || _currentAttacker != attacker.Master))
            {
                OutputAverage();
            }

            if (_currentAttacker == null)
            {
                _StartTime = Envir.Time;
            }
            _currentAttacker = attacker is MonsterObject ? (PlayerObject)attacker.Master : (PlayerObject)attacker;
            _hitCount++;
            _totalDamage   += damage;
            _lastAttackTime = Envir.Time;

            long timespend = Math.Max(1000, (Envir.Time - _StartTime));//avoid division by 0

            if (_StartTime == 0)
            {
                timespend = 1000;
            }
            double Dps = _totalDamage / (timespend * 0.001);

            _currentAttacker.ReceiveChat(string.Format("{1} inflicted {0} Damage, Dps: {2:#.00}.", damage, attacker is MonsterObject ? "Your pets poison" : "Your poison", Dps), ChatType.Trainer);
            Poisoned = true;
        }
Exemple #5
0
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
        {
            if (DragonLink)
            {
                if (Envir.DragonSystem.LinkedMonster != null)
                {
                    MonsterObject ob = Envir.DragonSystem.LinkedMonster;
                    if (ob.EXPOwner == null || ob.EXPOwner.Dead)
                    {
                        ob.EXPOwner = GetAttacker(attacker);
                    }

                    if (ob.EXPOwner == attacker)
                    {
                        ob.EXPOwnerTime = Envir.Time + EXPOwnerDelay;
                    }
                }

                if (damageWeapon)
                {
                    attacker.DamageWeapon();
                }

                Envir.DragonSystem.GainExp(Envir.Random.Next(1, 40));
                return(1);
            }

            return(0);
        }
Exemple #6
0
 public override bool IsFriendlyTarget(HumanObject ally)
 {
     if (Owner == null)
     {
         return(false);
     }
     return(Owner.IsFriendlyTarget(ally));
 }
Exemple #7
0
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
        {
            if (_stage >= 4)
            {
                return(base.Attacked(attacker, damage, type, damageWeapon));
            }

            return(0);
        }
Exemple #8
0
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
        {
            if (!Conquest.WarIsOn || attacker.MyGuild != null && Conquest.GuildInfo.Owner == attacker.MyGuild.Guildindex)
            {
                damage = 0;
            }

            return(base.Attacked(attacker, damage, type, damageWeapon));
        }
Exemple #9
0
        public override bool IsFriendlyTarget(HumanObject ally)
        {
            if (Stoned)
            {
                return(false);
            }

            return(base.IsFriendlyTarget(ally));
        }
Exemple #10
0
        public override bool IsAttackTarget(HumanObject attacker)
        {
            if (attacker.MyGuild != null && attacker.MyGuild.Conquest != null && attacker.MyGuild.Conquest == Conquest)
            {
                return(false);
            }

            return(Closed && base.IsAttackTarget(attacker));
        }
Exemple #11
0
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
        {
            if (_runAway && Envir.Random.Next(4) == 0)
            {
                _runAway = false;
            }

            return(base.Attacked(attacker, damage, type, damageWeapon));
        }
Exemple #12
0
 private void ResetStats()
 {
     _currentAttacker = null;
     _hitCount        = 0;
     _totalDamage     = 0;
     _lastAttackTime  = 0;
     _StartTime       = 0;
     Poisoned         = false;
     PoisonList.Clear();
 }
Exemple #13
0
        // Player attacking trainer.
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = false)
        {
            if (attacker == null)
            {
                return(0);
            }

            if (_currentAttacker != null && _currentAttacker != attacker)
            {
                OutputAverage();
                ResetStats();
            }

            damage += attacker.Stats[Stat.AttackBonus];

            int armour = 0;

            //deal with trainers defense
            switch (type)
            {
            case DefenceType.AC:
            case DefenceType.ACAgility:
                armour = GetAttackPower(Stats[Stat.MinAC], Stats[Stat.MaxAC]);
                break;

            case DefenceType.MAC:
            case DefenceType.MACAgility:
                armour = GetAttackPower(Stats[Stat.MinMAC], Stats[Stat.MaxMAC]);
                break;
            }
            if (armour >= damage)
            {
                BroadcastDamageIndicator(DamageType.Miss);
                return(0);
            }

            damage -= armour;

            attacker.GatherElement();

            if (_currentAttacker == null)
            {
                _StartTime = Envir.Time;
            }
            _currentAttacker = attacker;
            _hitCount++;
            _totalDamage   += damage;
            _lastAttackTime = Envir.Time;

            ReportDamage(damage, type, false);
            return(1);
        }
Exemple #14
0
 public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
 {
     if (ChildRock)
     {
         ParentRock.FirstAttack = false;
     }
     if (!ChildRock && FirstAttack == true)
     {
         Die();
         return(0);
     }
     return(base.Attacked(attacker, damage, type, damageWeapon));
 }
Exemple #15
0
        public override bool IsAttackTarget(HumanObject attacker)
        {
            if (Owner == null)
            {
                return(false);
            }
            if (Dead)
            {
                return(false);
            }

            return(Owner.IsAttackTarget(attacker));
        }
Exemple #16
0
        public override void ApplyNegativeEffects(HumanObject attacker, DefenceType type, ushort levelOffset)
        {
            base.ApplyNegativeEffects(attacker, type, levelOffset);

            if (Envir.Random.Next(3) == 0)
            {
                Broadcast(new S.ObjectEffect {
                    ObjectID = ObjectID, Effect = SpellEffect.DeathCrawlerBreath
                });

                PoisonTarget(attacker, 5, 5, PoisonType.Green, 2000);
            }
        }
Exemple #17
0
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
        {
            int attackerDamage = base.Attacked(attacker, damage, type, damageWeapon);

            int ownDamage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);

            if (attackerDamage > ownDamage && Envir.Random.Next(2) == 0)
            {
                FindWeakerTarget();
            }

            return(attackerDamage);
        }
Exemple #18
0
 public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
 {
     throw new NotSupportedException();
 }
Exemple #19
0
 public MountInfo(HumanObject ob)
 {
     Player = ob;
 }
Exemple #20
0
 public abstract bool IsAttackTarget(HumanObject attacker);
Exemple #21
0
 public override bool IsAttackTarget(HumanObject attacker)
 {
     return(!Sleeping && base.IsAttackTarget(attacker));
 }
Exemple #22
0
 public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
 {
     return(Sleeping ? 0 : base.Attacked(attacker, damage, type, damageWeapon));
 }
Exemple #23
0
        public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
        {
            int armour = 0;

            switch (type)
            {
            case DefenceType.ACAgility:
                if (Envir.Random.Next(Stats[Stat.Agility] + 1) > attacker.Stats[Stat.Accuracy])
                {
                    return(0);
                }
                armour = GetAttackPower(Stats[Stat.MinAC], Stats[Stat.MaxAC]);
                break;

            case DefenceType.AC:
                armour = GetAttackPower(Stats[Stat.MinAC], Stats[Stat.MaxAC]);
                break;

            case DefenceType.MACAgility:
                if (Envir.Random.Next(Stats[Stat.Agility] + 1) > attacker.Stats[Stat.Accuracy])
                {
                    return(0);
                }
                armour = GetAttackPower(Stats[Stat.MinMAC], Stats[Stat.MaxMAC]);
                break;

            case DefenceType.MAC:
                armour = GetAttackPower(Stats[Stat.MinMAC], Stats[Stat.MaxMAC]);
                break;

            case DefenceType.Agility:
                if (Envir.Random.Next(Stats[Stat.Agility] + 1) > attacker.Stats[Stat.Accuracy])
                {
                    return(0);
                }
                break;
            }

            if (armour >= damage)
            {
                return(0);
            }

            if (damageWeapon)
            {
                attacker.DamageWeapon();
            }

            ShockTime = 0;

            for (int i = PoisonList.Count - 1; i >= 0; i--)
            {
                if (PoisonList[i].PType != PoisonType.LRParalysis)
                {
                    continue;
                }

                PoisonList.RemoveAt(i);
                OperateTime = 0;
            }

            if (Master != null && Master != attacker)
            {
                if (Envir.Time > Master.BrownTime && Master.PKPoints < 200)
                {
                    attacker.BrownTime = Envir.Time + Settings.Minute;
                }
            }

            if (EXPOwner == null || EXPOwner.Dead)
            {
                EXPOwner = GetAttacker(attacker);
            }

            if (EXPOwner == attacker)
            {
                EXPOwnerTime = Envir.Time + EXPOwnerDelay;
            }

            Broadcast(new S.ObjectStruck {
                ObjectID = ObjectID, AttackerID = attacker.ObjectID, Direction = Direction, Location = CurrentLocation
            });
            attacker.GatherElement();
            ChangeHP(-1);

            return(1);
        }
Exemple #24
0
 public override bool IsAttackTarget(HumanObject attacker)
 {
     throw new NotSupportedException();
 }
Exemple #25
0
 public abstract int Attacked(HumanObject attacker, int damage, DefenceType type   = DefenceType.ACAgility, bool damageWeapon = true);
Exemple #26
0
 public abstract bool IsFriendlyTarget(HumanObject ally);
Exemple #27
0
 public override bool IsFriendlyTarget(HumanObject ally)
 {
     throw new NotSupportedException();
 }
Exemple #28
0
 public override void SendHealth(HumanObject player)
 {
     throw new NotSupportedException();
 }
Exemple #29
0
 public override bool IsAttackTarget(HumanObject attacker)
 {
     return(Visible && base.IsAttackTarget(attacker));
 }
Exemple #30
0
 public virtual void Remove(HumanObject player)
 {
     player.Enqueue(new S.ObjectRemove {
         ObjectID = ObjectID
     });
 }