Ejemplo n.º 1
0
        public void DoBash(object o)
        {
            var script = o as SAttackerJolt;
            var a      = script.GetObjectList()[0] as MAction;

            foreach (var hit in a.Data.Hits)
            {
                var tgt = hit.Data.Target.Current as CChar;
                if (FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Push))
                {
                    var tgtTile = hit.Data.Source.Tile.Model.GetPushTile(tgt.Tile.Model);
                    if (tgtTile != null)
                    {
                        var data = new EvTileMoveData();
                        data.Char = tgt;
                        data.Cost = 0;
                        data.DoAttackOfOpportunity = false;
                        data.StamCost = 0;
                        data.Source   = tgt.Tile;
                        data.Target   = tgtTile.Controller;
                        var e = new EvTileMove(data);
                        e.AddCallback(hit.CallbackHandler);
                        e.TryProcess();
                    }
                    else
                    {
                        hit.CallbackHandler(null);
                    }
                }
                else
                {
                    hit.CallbackHandler(null);
                }
            }
        }
Ejemplo n.º 2
0
        public void DoScatter(object o)
        {
            var hit = o as MHit;
            var tgt = hit.Data.Target.Current as CChar;

            if (tgt != null &&
                FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Push) &&
                !FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Dodge) &&
                !FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Parry))
            {
                CTile randomController = null;
                var   tgtTile          = hit.Data.Source.Tile.Model.GetPushTile(tgt.Tile.Model);
                if (tgtTile == null)
                {
                    randomController = hit.Data.Source.Tile.GetNearestEmptyTile();
                }
                if (randomController != null)
                {
                    tgtTile = randomController.Model;
                }
                if (tgtTile != null)
                {
                    var data = new EvTileMoveData();
                    data.Char = tgt;
                    data.Cost = 0;
                    data.DoAttackOfOpportunity = false;
                    data.StamCost = 0;
                    data.Source   = tgt.Tile;
                    data.Target   = tgtTile.Controller;
                    var e = new EvTileMove(data);
                    e.AddCallback(hit.CallbackHandler);
                    e.TryProcess();
                }
            }
        }
Ejemplo n.º 3
0
        private void DoSpearWall(object o)
        {
            var hit = o as MHit;
            var tgt = hit.Data.Target.Current as CChar;

            if (tgt != null)
            {
                var tgtTile = hit.Data.Source.Tile.Model.GetPushTile(tgt.Tile.Model);
                if (tgtTile != null && tgtTile.GetCurrentOccupant() == null)
                {
                    var data = new EvTileMoveData();
                    data.Char = tgt;
                    data.Cost = 0;
                    data.DoAttackOfOpportunity = false;
                    data.StamCost = 0;
                    data.Source   = tgt.Tile;
                    data.Target   = tgtTile.Controller;
                    var bob = data.Char.GameHandle.GetComponent <SBob>();
                    if (bob != null)
                    {
                        bob.Reset();
                    }
                    var e = new EvTileMove(data);
                    e.AddCallback(this.AddBob);
                    e.TryProcess();
                    this.TryUndoSpearwall(null);
                }
                else
                {
                    var controller = hit.Data.Source.Tile;
                    var random     = controller.GetNearestEmptyTile();
                    if (random != null)
                    {
                        var data = new EvTileMoveData();
                        data.Char     = tgt;
                        data.Cost     = 0;
                        data.StamCost = 0;
                        data.Source   = tgt.Tile;
                        data.Target   = random;
                        var bob = data.Char.GameHandle.GetComponent <SBob>();
                        if (bob != null)
                        {
                            bob.Reset();
                        }
                        var e = new EvTileMove(data);
                        e.AddCallback(this.AddBob);
                        e.TryProcess();
                        this.TryUndoSpearwall(null);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void HandleTarget(MAction a)
        {
            var tgt  = a.Data.Target.Current as CChar;
            var data = new EvTileMoveData();

            data.Char = tgt;
            data.Cost = 0;
            data.DoAttackOfOpportunity = false;
            data.Source = tgt.Tile;
            data.Target = a.Data.Source.Tile;
            var e = new EvTileMove(data);

            VCharUtil.Instance.AssignPlusLayer(tgt);
            e.AddCallback(this.TargetCallback);
            e.TryProcess();
        }
Ejemplo n.º 5
0
        private void HandleSource(MAction a)
        {
            var data = new EvTileMoveData();

            data.Char = a.Data.Source;
            data.Cost = 0;
            data.DoAttackOfOpportunity = false;
            data.Source = a.Data.Source.Tile;
            data.Target = a.Data.Target;
            var e = new EvTileMove(data);

            e.AddCallback(this.SourceCallback);
            foreach (var hit in a.Data.Hits)
            {
                e.AddCallback(hit.CallbackHandler);
            }
            e.TryProcess();
            var bob = a.Data.Source.GameHandle.GetComponent <SBob>();

            if (bob != null)
            {
                GameObject.Destroy(bob);
            }
        }
Ejemplo n.º 6
0
        private void ProcessMove(MAction action)
        {
            var tgt  = action.Data.Target.Current as CChar;
            var tile = tgt.Tile.GetRandomNearbyEmptyTile(1);

            if (tile == null)
            {
                tile = tgt.Tile.GetNearestEmptyTile();
            }
            var data = new EvTileMoveData();

            data.Char   = action.Data.Source;
            data.Cost   = 0;
            data.Source = action.Data.Source.Tile;
            data.Target = tile;
            var e = new EvTileMove(data);

            e.AddCallback(this.SourceCallback);
            foreach (var hit in action.Data.Hits)
            {
                e.AddCallback(hit.CallbackHandler);
            }
            e.TryProcess();
        }