コード例 #1
0
        public void Die()
        {
            HP = 0;

            if (!DropState)
            {
                DropState = true;
                new RandomDrop(this);
                //:TODO mindroplevel && maxdroplevel
            }

            Moving            = false;
            boundryLT         = null;
            boundryRB         = null;
            AttackingSequence = null;
            Target            = null;
            deathTriggered    = true;

            if (spawnplace != null)
            {
                spawnplace.CurrentMobs--;
            }

            nextUpdate = Program.CurrentTime.AddSeconds(3);
        }
コード例 #2
0
        public override void AttackSkillAoE(ushort skillid, uint x, uint y)
        {
            base.AttackSkillAoE(skillid, x, y); // lol

            if (AttackingSequence != null)
            {
                return;
            }
            AttackingSequence = new AttackSequence(this, 0, InfoServer.Str, skillid, x, y);
        }
コード例 #3
0
        public override void AttackSkill(ushort skillid, MapObject victim)
        {
            base.AttackSkill(skillid, victim); // lol

            if (AttackingSequence != null)
            {
                return;
            }
            AttackingSequence = new AttackSequence(this, victim, 0, InfoServer.Str, skillid, true);
            Target            = victim;
        }
コード例 #4
0
        public override void Attack(MapObject victim)
        {
            base.Attack(victim); // lol

            if (AttackingSequence != null)
            {
                return;
            }
            AttackingSequence = new AttackSequence(this, victim, 0, InfoServer.Str, 1400);
            Target            = victim;
        }
コード例 #5
0
        public override void Update(DateTime date)
        {
            if (Position == null)
            {
                return;
            }

            if (IsDead)
            {
                if (!deathTriggered)
                {
                    Die();
                    return; // Wait till 3 seconds are over, then remove
                }

                if (nextUpdate <= date)
                {
                    Map.RemoveObject(MapObjectID);
                    Position = null;
                    return;
                }

                return;
            }

            if (AttackingSequence != null && Target != null)
            {
                if (Vector2.Distance(Target.Position, Position) < 50)
                {
                    AttackingSequence.Update(date);
                    if (AttackingSequence.State == AttackSequence.AnimationState.Ended)
                    {
                        AttackingSequence = null;
                        Target            = null;
                    }
                }
                else
                {
                    nextUpdate = nextUpdate.AddDays(-1);
                }
            }

            if (nextUpdate > date)
            {
                return;
            }


            if (Target != null)
            {
                nextUpdate = Program.CurrentTime.AddSeconds(1);

                // Try to move to target's pos
                // Might glitch the f**k out. lol
                if (Target.Map != Map)
                {
                    Target = null; // Stop aggro-ing >:(
                }
                else
                {
                    if (Vector2.Distance(Target.Position, Position) < 800)
                    {
                        if (Map.Block.CanWalk(Target.Position.X, Target.Position.Y))
                        {
                            Move(Position.X, Position.Y, Target.Position.X, Target.Position.Y, false, false);
                        }
                    }
                    else
                    {
                        Target = null; // Stop aggro-ing >:(
                    }
                }
            }
            else
            {
                nextUpdate =
                    Program.CurrentTime.AddSeconds(Program.Randomizer.Next(10,
                                                                           60)); // Around 10 seconds to 1 minute before new movement is made

                // Move to random spot.
                var newpos = new Vector2(Position);
                var ok     = false;
                for (var i = 1; i <= 20; i++)
                {
                    // Generate new position, and check if it's in valid bounds, else recheck

                    newpos = Vector2.GetRandomSpotAround(Program.Randomizer, newpos, 60);
                    if (newpos.X > 0 && newpos.Y > 0 && Map.Block.CanWalk(newpos.X, newpos.Y) &&
                        PositionIsInBoundries(newpos))
                    {
                        ok = true;
                        break;
                    }

                    /*
                     * int t = Program.Randomizer.Next() % 11;
                     *
                     * if (t <= 2)
                     * {
                     *  // All +
                     *
                     *  newx += Program.Randomizer.Next(MinMovement, MaxMovement);
                     *  newy += Program.Randomizer.Next(MinMovement, MaxMovement);
                     * }
                     * else if (t <= 5)
                     * {
                     *  newx -= Program.Randomizer.Next(MinMovement, MaxMovement);
                     *  newy += Program.Randomizer.Next(MinMovement, MaxMovement);
                     * }
                     * else if (t <= 8)
                     * {
                     *  newx += Program.Randomizer.Next(MinMovement, MaxMovement);
                     *  newy -= Program.Randomizer.Next(MinMovement, MaxMovement);
                     * }
                     * else
                     * {
                     *  newx -= Program.Randomizer.Next(MinMovement, MaxMovement);
                     *  newy -= Program.Randomizer.Next(MinMovement, MaxMovement);
                     * }
                     * Vector2 test = newpos + new Vector2(newx, newy);
                     * if (Map.Block.CanWalk(test.X, test.Y) && PositionIsInBoundries(test))
                     * {
                     *  newpos = test;
                     *  break;
                     * }
                     */
                }

                if (ok)
                {
                    Move(Position.X, Position.Y, newpos.X, newpos.Y, false, false);
                }
            }
        }
コード例 #6
0
        public override void AttackSkillAoE(ushort skillid, uint x, uint y)
        {
            if (IsAttacking) return;

            Item weapon;
            this.Inventory.GetEquiptBySlot((byte)ItemSlot.Weapon, out weapon);
            uint dmgmin = (uint)GetExtraStr();
            uint dmgmax = (uint)(GetExtraStr() + (GetExtraStr() % 3));
            if (weapon != null)
            {
                dmgmin += weapon.ItemInfo.MinMelee;
                dmgmax += weapon.ItemInfo.MaxMelee;
            }

            attackingSequence = new AttackSequence(this, dmgmin, dmgmax, skillid, x, y);
        }
コード例 #7
0
 public void AttackStop()
 {
     if (IsAttacking)
     {
         attackingSequence = null;
     }
 }
コード例 #8
0
        public override void AttackSkill(ushort skillid, MapObject victim)
        {
            if (victim == null)
            {
                victim = SelectedObject;
            }

            if (IsAttacking || victim == null || !victim.IsAttackable) return;

            Item weapon;
            this.Inventory.GetEquiptBySlot((byte)ItemSlot.Weapon, out weapon);
            uint dmgmin = (uint)GetWeaponDamage(true);
            uint dmgmax = (uint)(GetWeaponDamage(true) + (GetWeaponDamage(true) % 3));
            if (weapon != null)
            {
                dmgmin += weapon.ItemInfo.MinMelee;
                dmgmax += weapon.ItemInfo.MaxMelee;
            }

            attackingSequence = new AttackSequence(this, victim, dmgmin, dmgmax, skillid, true);
        }
コード例 #9
0
        public override void Update(DateTime date)
        {
            if (attackingSequence != null)
            {
                attackingSequence.Update(date);
                if (attackingSequence.State == AttackSequence.AnimationState.Ended)
                {
                    attackingSequence = null;
                }
            }

            if (SelectedObject != null)
            {
                if (SelectedObject is Mob)
                {
                    if ((SelectedObject as Mob).IsDead) SelectedObject = null; // Stop the reference ffs
                }
            }

            if (State == PlayerState.Resting)
            {
                if (date >= NextHPRest)
                {
                    HealHP((MaxHP / 1000 * House.Info.HPRecovery));
                    //TODO: also show this to people who have me selected.
                    NextHPRest = date.AddMilliseconds(House.Info.HPTick);
                }
                if (date >= NextSPRest)
                {
                    HealSP((MaxSP / 1000 * House.Info.SPRecovery));
                    //TODO: also show this to people who have me selected.
                    NextSPRest = date.AddMilliseconds(House.Info.SPTick);
                }
            }
        }
コード例 #10
0
        public override void AttackSkillAoE(ushort skillid, uint x, uint y)
        {
            base.AttackSkillAoE(skillid, x, y); // lol

            if (AttackingSequence != null) return;
            AttackingSequence = new AttackSequence(this, 0, InfoServer.Str, skillid, x, y);
        }
コード例 #11
0
        public override void AttackSkill(ushort skillid, MapObject victim)
        {
            base.AttackSkill(skillid, victim); // lol

            if (AttackingSequence != null) return;
            AttackingSequence = new AttackSequence(this, victim, 0, InfoServer.Str, skillid, true);
            Target = victim;
        }
コード例 #12
0
        public override void Attack(MapObject victim)
        {
            base.Attack(victim); // lol

            if (AttackingSequence != null) return;
            AttackingSequence = new AttackSequence(this, victim, 0, InfoServer.Str, 1400);
            Target = victim;
        }