Пример #1
0
        // Function from file: armor.dm
        public override bool hit_reaction(Mob_Living_Carbon owner = null, string attack_text = null, int?final_block_chance = null, dynamic damage = null, int?attack_type = null)
        {
            Mob_Living_Carbon H      = null;
            ByTable           turfs  = null;
            dynamic           T      = null;
            dynamic           picked = null;


            if (!this.active)
            {
                return(false);
            }

            if (Rand13.PercentChance(this.hit_reaction_chance))
            {
                H = owner;
                owner.visible_message("<span class='danger'>The reactive teleport system flings " + H + " clear of " + attack_text + "!</span>");
                turfs = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(H, this.tele_range)))
                {
                    T = _a;


                    if (T.density)
                    {
                        continue;
                    }

                    if (Convert.ToDouble(T.x) > Game13.map_size_x - this.tele_range || Convert.ToDouble(T.x) < this.tele_range)
                    {
                        continue;
                    }

                    if (Convert.ToDouble(T.y) > Game13.map_size_y - this.tele_range || Convert.ToDouble(T.y) < this.tele_range)
                    {
                        continue;
                    }
                    turfs.Add(T);
                }

                if (!(turfs.len != 0))
                {
                    turfs.Add(Rand13.PickFromTable(Map13.FetchInRangeExcludeThis(H, this.tele_range).Contains(typeof(Tile))));
                }
                picked = Rand13.PickFromTable(turfs);

                if (!(picked is Tile))
                {
                    return(false);
                }
                H.forceMove(picked);
                H.rad_act(this.rad_amount);
                return(true);
            }
            return(false);
        }