예제 #1
0
        // Function from file: tiny_prick.dm
        public override bool can_sting(Mob user = null, Ent_Static target = null)
        {
            if (!base.can_sting(user, target))
            {
                return(false);
            }

            if (!(user.mind.changeling.chosen_sting != null))
            {
                user.WriteMsg("We haven't prepared our sting yet!");
            }

            if (!(target is Mob_Living_Carbon))
            {
                return(false);
            }

            if (!(user.loc is Tile))
            {
                return(false);
            }

            if (!Lang13.Bool(GlobalFuncs.AStar(user, target.loc, typeof(Tile).GetMethod("Distance"), user.mind.changeling.sting_range, null, null, null, null, null, false)))
            {
                return(false);
            }

            if (Lang13.Bool(((dynamic)target).mind) && ((dynamic)target).mind.changeling != null)
            {
                this.sting_feedback(user, target);
                this.take_chemical_cost(user.mind.changeling);
                return(false);
            }
            return(true);
        }
예제 #2
0
        // Function from file: parrot.dm
        public Ent_Dynamic search_for_item(  )
        {
            Ent_Dynamic item = null;
            Ent_Dynamic AM   = null;
            Ent_Dynamic I    = null;
            Ent_Dynamic C    = null;


            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInView(null, this), typeof(Ent_Dynamic)))
            {
                AM = _a;


                if (this.parrot_perch != null && AM.loc == this.parrot_perch.loc || AM.loc == this)
                {
                    continue;
                }

                if (AM is Obj_Item)
                {
                    I = AM;

                    if (Convert.ToDouble(((dynamic)I).w_class) < 2)
                    {
                        item = I;
                    }
                }
                else if (AM is Mob_Living_Carbon)
                {
                    C = AM;

                    if (Lang13.Bool(((dynamic)C).l_hand) && Convert.ToDouble(((dynamic)C).l_hand.w_class) <= 2 || Lang13.Bool(((dynamic)C).r_hand) && Convert.ToDouble(((dynamic)C).r_hand.w_class) <= 2)
                    {
                        item = C;
                    }
                }

                if (item != null)
                {
                    if (!Lang13.Bool(GlobalFuncs.AStar(this, GlobalFuncs.get_turf(item), typeof(Tile).GetMethod("Distance_cardinal"))))
                    {
                        item = null;
                        continue;
                    }
                    return(item);
                }
            }
            return(null);
        }
예제 #3
0
파일: Disease.cs 프로젝트: Somnium13/SS13
        // Function from file: _disease.dm
        public void spread(dynamic source = null, int?force_spread = null)
        {
            force_spread = force_spread ?? 0;

            int?spread_range    = null;
            Mob_Living_Carbon C = null;


            if (((this.spread_flags & 1) != 0 || (this.spread_flags & 2) != 0 || (this.spread_flags & 4) != 0) && !Lang13.Bool(force_spread))
            {
                return;
            }

            if (Lang13.Bool(this.affected_mob))
            {
                if (Lang13.Bool(((Reagents)this.affected_mob.reagents).has_reagent("spaceacillin")) || this.affected_mob.satiety > 0 && Rand13.PercentChance(((int)(this.affected_mob.satiety / 10))))
                {
                    return;
                }
            }
            spread_range = 1;

            if (Lang13.Bool(force_spread))
            {
                spread_range = force_spread;
            }

            if ((this.spread_flags & 64) != 0)
            {
                spread_range++;
            }

            if (!Lang13.Bool(source))
            {
                if (Lang13.Bool(this.affected_mob))
                {
                    source = this.affected_mob;
                }
                else
                {
                    return;
                }
            }

            if (source.loc is Tile)
            {
                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInViewExcludeThis(source, spread_range), typeof(Mob_Living_Carbon)))
                {
                    C = _a;


                    if (C.loc is Tile)
                    {
                        if (Lang13.Bool(GlobalFuncs.AStar(source, C.loc, typeof(Tile).GetMethod("Distance"), spread_range, null, null, ((this.spread_flags & 64) != 0 ? typeof(Tile).GetMethod("reachableAdjacentAtmosTurfs") : typeof(Tile).GetMethod("reachableAdjacentTurfs")))))
                        {
                            C.ContractDisease(this);
                        }
                    }
                }
            }
            return;
        }