Пример #1
0
 public void ClearMagic()
 {
     NextMagic = null;
     NextMagicDirection = 0;
     NextMagicLocation = Point.Empty;
     NextMagicObject = null;
 }
Пример #2
0
        public void AddObject(MapObject ob)
        {
            if (CellObjects == null) CellObjects = new List<MapObject>();

            CellObjects.Insert(0, ob);
            Sort();
        }
Пример #3
0
        public void RemoveObject(MapObject ob)
        {
            CellObjects.Remove(ob);

            if (CellObjects.Count == 0) CellObjects = null;
            else Sort();
        }
Пример #4
0
 public BuffEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, BuffType buffType)
     : base(library, baseIndex, count, duration, owner, 0)
 {
     Repeat = true;
     Blend = blend;
     BuffType = buffType;
     Light = -1;
 }
Пример #5
0
        public Effect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, long starttime = 0)
        {
            Library = library;
            BaseIndex = baseIndex;
            Count = count == 0 ? 1 : count;
            Duration = duration;
            Start = starttime == 0 ? CMain.Time : starttime;

            NextFrame = Start + (Duration / Count) * (CurrentFrame + 1);
            Owner = owner;
            Source = Owner.CurrentLocation;
        }
Пример #6
0
 public DelayedExplosionEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, int Stage, long until)
     : base(library, baseIndex, count, duration, owner)
 {
     Repeat = (Stage == 2) ? false : true;
     Blend = blend;
     stage = Stage;
     effectlist.Add(this);
     if (stage == 1)
         SoundManager.PlaySound(20000 + 125 * 10);
     if (stage == 2)
         SoundManager.PlaySound(20000 + 125 * 10 + 5);
 }
Пример #7
0
        public virtual void FrameProcess()
        {
            if (Frames == null)
            {
                return;
            }

            switch (CurrentAction)
            {
            case MirAction.Standing:
                if (Main.Timer.ElapsedMilliseconds >= NextMotion)
                {
                    if (ActionList.Count >= 2)
                    {
                        Frame++;
                    }

                    NextMotion += CurrentFrame.Interval;
                    CanDoAction = true;

                    if (++Frame >= CurrentFrame.Count)
                    {
                        Frame = 0;
                    }
                }
                break;

            case MirAction.Walking:
                if (Main.CanMove)
                {
                    if (this == MapObject.User)
                    {
                        if ((User.CurrentBagWeight > User.MaxBagWeight ||
                             User.CurrentBodyWeight > User.MaxBodyWeight) && OverWeightRun)
                        {
                            OverWeightRun = false;
                            return;
                        }
                        else
                        {
                            OverWeightRun = true;
                        }

                        if (Frame == 1 || Frame == 4)
                        {
                            PlayStepSound();
                        }

                        if (Frame == CurrentFrame.Count - 1 && Main.NextMoveTime > Main.Time)
                        {
                            break;
                        }
                    }

                    if (ActionList.Count >= 2)
                    {
                        Frame++;
                    }


                    if (++Frame >= CurrentFrame.Count)
                    {
                        if (FreezeFrame)
                        {
                            Frame--;
                            CanDoAction = true;
                            FreezeFrame = false;
                        }
                        else
                        {
                            DoAction(MirAction.Standing);
                        }
                    }
                }
                break;

            case MirAction.Running:
                if (Main.CanMove)
                {
                    if (this == MapObject.User)
                    {
                        if ((User.CurrentBagWeight > User.MaxBagWeight ||
                             User.CurrentBodyWeight > User.MaxBodyWeight) && OverWeightRun)
                        {
                            OverWeightRun = false;
                            return;
                        }
                        else
                        {
                            OverWeightRun = true;
                        }

                        if (Frame == 1 || Frame == 4)
                        {
                            PlayStepSound();
                        }

                        if (Frame == CurrentFrame.Count - 1 && Main.NextMoveTime > Main.Time)
                        {
                            break;
                        }
                    }

                    if (ActionList.Count >= 2)
                    {
                        Frame++;
                    }

                    if (++Frame >= CurrentFrame.Count)
                    {
                        if (FreezeFrame)
                        {
                            Frame--;
                            CanDoAction = true;
                            FreezeFrame = false;
                        }
                        else
                        {
                            DoAction(MirAction.Standing);
                        }
                    }
                }
                break;

            case MirAction.Stance:
                if (Main.Timer.ElapsedMilliseconds >= NextMotion)
                {
                    if (ActionList.Count >= 2)
                    {
                        Frame++;
                    }

                    NextMotion += CurrentFrame.Interval;
                    CanDoAction = true;

                    if (++Frame >= CurrentFrame.Count)
                    {
                        DoAction(MirAction.Standing);
                    }
                }
                break;

            case MirAction.Attack1:
            case MirAction.Attack2:
            case MirAction.Attack3:
                if (Main.Timer.ElapsedMilliseconds >= NextMotion)
                {
                    if (Frame == 1)
                    {
                        PlayAttackSound();
                    }

                    if (ActionList.Count >= 2)
                    {
                        Frame++;
                    }

                    NextMotion += CurrentFrame.Interval;

                    if (++Frame >= CurrentFrame.Count)
                    {
                        DoAction(MirAction.Stance);
                        CanDoAction = true;
                    }
                }
                break;

            case MirAction.Harvest:
                if (Main.Timer.ElapsedMilliseconds >= NextMotion)
                {
                    if (ActionList.Count >= 2)
                    {
                        Frame++;
                    }

                    NextMotion += CurrentFrame.Interval;

                    if (++Frame >= CurrentFrame.Count)
                    {
                        DoAction(MirAction.Standing);
                        CanDoAction = true;
                    }
                }
                break;

            case MirAction.Struck:
                if (Main.Timer.ElapsedMilliseconds >= NextMotion)
                {
                    if (Frame == 0)
                    {
                        if (this == MapObject.User)
                        {
                            Main.AllowRun      = false;
                            Main.StruckRunTime = Main.Time + 2000;
                        }

                        MapObject Temp = MapLayer.ObjectList.FirstOrDefault(O => O.ObjectID == AttackerID);
                        PlayStruckSound(Temp == null ? -1 : Temp.WeaponShape);
                    }

                    if (Frame == 1)
                    {
                        PlayFlinchSound();
                    }

                    NextMotion += CurrentFrame.Interval;

                    if (++Frame >= CurrentFrame.Count)
                    {
                        DoAction(MirAction.Stance);
                        CanDoAction = true;
                    }
                }
                break;

            case MirAction.Die:
                if (this == MapObject.User)
                {
                    Main.AllowRun = false;
                }

                if (Main.Timer.ElapsedMilliseconds >= NextMotion)
                {
                    if (Frame == 0)
                    {
                        PlayDieSound();
                    }

                    NextMotion += CurrentFrame.Interval;

                    if (++Frame >= CurrentFrame.Count)
                    {
                        DoAction(MirAction.Dead);
                    }
                }
                break;

            case MirAction.Dead:
                //no idea
                break;

            case MirAction.Skeleton:

                break;
            }
            if (Dead && ActionList.Count > 0)
            {
                QueuedAction Q = ActionList.Dequeue();
                if (Q.Action == MirAction.Skeleton)
                {
                    DoAction(Q.Action);
                }
            }
            if (CanDoAction && (ActionList.Count > 0 || Struck))
            {
                if (Struck)
                {
                    DoAction(MirAction.Struck);
                    Struck = false;
                }
                else if ((ActionList.Peek().Action != MirAction.Walking && ActionList.Peek().Action != MirAction.Running) || Main.CanMove)
                {
                    QueuedAction Q = ActionList.Dequeue();
                    if (Q.Action == MirAction.Walking || Q.Action == MirAction.Running)
                    {
                        Direction = Functions.DirectionFromPoint(Location, Q.Location);
                        if (Location != Q.Location)
                        {
                            DoAction(Q.Action);
                            Location = Functions.PointMove(Location, Direction, Q.Action == MirAction.Walking ? 1 : 2);
                        }
                    }
                    else
                    {
                        if (Q.Action != MirAction.Die && Q.Action != MirAction.Dead && Q.Action != MirAction.Skeleton)
                        {
                            Direction = Q.Direction;
                        }
                        DoAction(Q.Action);
                    }
                }
            }

            ImageIndex = CurrentFrame.Start + (CurrentFrame.OffSet * (byte)Direction) + Frame + BaseIndex;
        }
Пример #8
0
        bool loopit = false; //soundloop

        public ElementsEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, int elementType, int killtime, bool loopon = false)
            : base(library, baseIndex, count, duration, owner)
        {
            Repeat = true;
            Blend  = blend;
            myType = elementType;
            killAt = killtime;
            //
            loopit = loopon;
            StopSounds();
            StartSound();
        }
Пример #9
0
 public void SortObject(MapObject ob)
 {
     M2CellInfo[ob.MapLocation.X, ob.MapLocation.Y].Sort();
 }
Пример #10
0
 public void AddObject(MapObject ob)
 {
     M2CellInfo[ob.MapLocation.X, ob.MapLocation.Y].AddObject(ob);
 }
Пример #11
0
 public void RemoveObject(MapObject ob)
 {
     M2CellInfo[ob.MapLocation.X, ob.MapLocation.Y].RemoveObject(ob);
 }
Пример #12
0
 public SpecialEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, bool drawBehind, uint type)
     : base(library, baseIndex, count, duration, owner, 0, drawBehind)
 {
     Blend = blend;
     DrawBehind = drawBehind;
     EffectType = type;
     Light = -1;
 }
Пример #13
0
        bool loopit = false;//soundloop

        public ElementsEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, int elementType, int killtime, bool loopon = false)
            : base(library, baseIndex, count, duration, owner)
        {
            Repeat = true;
            Blend = blend;
            myType = elementType;
            killAt = killtime;
            //
            loopit = loopon;
            StopSounds();
            StartSound();
        }
Пример #14
0
 public InterruptionEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, long starttime = 0)
     : base(library, baseIndex, count, duration, owner)
 {
     Repeat = true;
     Blend = blend;
     effectlist.Add(this);
 }
Пример #15
0
 public Missile(MLibrary library, int baseIndex, int count, int duration, MapObject owner, Point target, bool direction16 = true)
     : base(library, baseIndex, count, duration, owner)
 {
     Missiles.Add(this);
     Source = Owner.CurrentLocation;
     Destination = target;
     Direction = direction16 ? MapControl.Direction16(Source, Destination) : (int)Functions.DirectionFromPoint(Source, Destination);
 }
Пример #16
0
        public void Remove()
        {
            if (MouseObject == this) MouseObject = null;
            if (TargetObject == this) TargetObject = null;
            if (MagicObject == this) MagicObject = null;

            if (this == User.NextMagicObject)
                User.ClearMagic();

            MapControl.Objects.Remove(this);
            GameScene.Scene.MapControl.RemoveObject(this);

            if (ObjectID != GameScene.NPCID) return;

            GameScene.NPCID = 0;
            GameScene.Scene.NPCDialog.Hide();
        }
Пример #17
0
 public InterruptionEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, long starttime = 0)
     : base(library, baseIndex, count, duration, owner)
 {
     Repeat = true;
     Blend  = blend;
     effectlist.Add(this);
 }
Пример #18
0
 public DelayedExplosionEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, int Stage, long until)
     : base(library, baseIndex, count, duration, owner)
 {
     Repeat = (Stage == 2) ? false : true;
     Blend  = blend;
     stage  = Stage;
     effectlist.Add(this);
     if (stage == 1)
     {
         SoundManager.PlaySound(20000 + 125 * 10);
     }
     if (stage == 2)
     {
         SoundManager.PlaySound(20000 + 125 * 10 + 5);
     }
 }
Пример #19
0
 public LightEffect(int duration, MapObject owner, long starttime = 0, int lightDistance = 6, Color? lightColour = null)
     : base(null, 0, 0, duration, owner, starttime)
 {
     Light = lightDistance;
     //LightColour = lightColour == null ? Color.White : (Color)lightColour;
 }
Пример #20
0
 public SpecialEffect(MLibrary library, int baseIndex, int count, int duration, MapObject owner, bool blend, bool drawBehind, uint type)
     : base(library, baseIndex, count, duration, owner, 0, drawBehind)
 {
     Blend      = blend;
     DrawBehind = drawBehind;
     EffectType = type;
     Light      = -1;
 }
Пример #21
0
 public LightEffect(int duration, MapObject owner, long starttime = 0, int lightDistance = 6, Color?lightColour = null)
     : base(null, 0, 0, duration, owner, starttime)
 {
     Light       = lightDistance;
     LightColour = lightColour == null ? Color.White : (Color)lightColour;
 }