Exemple #1
0
        // 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;
        }