コード例 #1
0
        // Function from file: mutations.dm
        public override void on_life(Mob_Living owner = null)
        {
            int x_offset_old = 0;
            int y_offset_old = 0;
            int x_offset     = 0;
            int y_offset     = 0;


            if (Rand13.PercentChance(10) && owner.paralysis <= 1)
            {
                owner.Stun(10);

                dynamic _a = Rand13.Int(1, 3);                   // Was a switch-case, sorry for the mess.
                if (2 <= _a && _a <= 3)
                {
                    owner.say("" + (Rand13.PercentChance(50) ? ";" : "") + Rand13.Pick(new object [] { "SHIT", "PISS", "F**K", "C**T", "C********R", "M**********R", "T**S" }));
                }
                else if (_a == 1)
                {
                    owner.emote("twitch");
                }
                x_offset_old = owner.pixel_x;
                y_offset_old = owner.pixel_y;
                x_offset     = owner.pixel_x + Rand13.Int(-2, 2);
                y_offset     = owner.pixel_y + Rand13.Int(-1, 1);
                Icon13.Animate(new ByTable().Set(1, owner).Set("pixel_x", x_offset).Set("pixel_y", y_offset).Set("time", 1));
                Icon13.Animate(new ByTable().Set(1, owner).Set("pixel_x", x_offset_old).Set("pixel_y", y_offset_old).Set("time", 1));
            }
            return;
        }
コード例 #2
0
        // Function from file: runes.dm
        public override void invoke(dynamic user = null)
        {
            dynamic    T = null;
            ByTable    possible_targets = null;
            Mob_Living M               = null;
            dynamic    offering        = null;
            dynamic    N               = null;
            int        cultists_nearby = 0;
            Mob_Living M2              = null;


            if (this.rune_in_use)
            {
                return;
            }
            this.rune_in_use = true;
            T = GlobalFuncs.get_turf(this);
            possible_targets = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Mob_Living)))
            {
                M = _a;


                if (!GlobalFuncs.iscultist(M))
                {
                    possible_targets.Add(M);
                }
            }
            offering = null;

            if (possible_targets.len > 1)
            {
                offering = Interface13.Input(user, "Choose an offering to sacrifice.", "Unholy Tribute", null, possible_targets, InputType.Null | InputType.Any);

                if (!this.Adjacent(user) || !(this != null) || Lang13.Bool(GlobalFuncs.qdeleted(this)) || ((Mob)user).incapacitated())
                {
                    return;
                }
            }
            else if (possible_targets.len != 0)
            {
                offering = possible_targets[possible_targets.len];
            }

            if (!Lang13.Bool(offering))
            {
                this.rune_in_use = false;
                return;
            }
            N = ((Mob)offering).null_rod_check();

            if (Lang13.Bool(N))
            {
                user.WriteMsg("<span class='warning'>Something is blocking the Geometer's magic!</span>");
                GlobalFuncs.log_game(new Txt("Sacrifice rune failed - target has ").a(N).item().str("!").ToString());
                this.fail_invoke();
                this.rune_in_use = false;
                return;
            }

            if ((offering is Mob_Living_Carbon_Human || offering is Mob_Living_Silicon_Robot) && Convert.ToInt32(offering.stat) != 2)
            {
                cultists_nearby = 1;

                foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInRange(this, 1), typeof(Mob_Living)))
                {
                    M2 = _b;


                    if (GlobalFuncs.iscultist(M2) && M2 != user)
                    {
                        cultists_nearby++;
                        M2.say(this.invocation);
                    }
                }

                if (cultists_nearby < 2)
                {
                    user.WriteMsg("<span class='cultitalic'>" + offering + " is too greatly linked to the world! You need more acolytes!</span>");
                    this.fail_invoke();
                    GlobalFuncs.log_game("Sacrifice rune failed - not enough acolytes and target is living");
                    this.rune_in_use = false;
                    return;
                }
            }
            this.visible_message("<span class='warning'>" + this + " pulses blood red!</span>");
            this.color = "#7e1717";
            Task13.Schedule(5, (Task13.Closure)(() => {
                this.color = Lang13.Initial(this, "color");
                return;
            }));
            this.sac(offering);
            return;
        }
コード例 #3
0
        // Function from file: runes.dm
        public bool can_invoke(dynamic user = null)
        {
            int        cultists_in_range = 0;
            Mob_Living L = null;
            Mob_Living H = null;


            if (!this.structure_check(this.req_pylons, this.req_forges, this.req_archives, this.req_altars))
            {
                return(false);
            }

            if (!Lang13.Bool(this.keyword) && this.req_keyword)
            {
                return(false);
            }

            if (this.req_cultists <= 1)
            {
                if (Lang13.Bool(this.invocation))
                {
                    ((Ent_Dynamic)user).say(this.invocation);
                }
                return(true);
            }
            else
            {
                cultists_in_range = 0;

                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(this, 1), typeof(Mob_Living)))
                {
                    L = _a;


                    if (GlobalFuncs.iscultist(L))
                    {
                        H = L;

                        if (!(H is Mob_Living_Carbon_Human))
                        {
                            if (L is Mob_Living_SimpleAnimal_Hostile_Construct)
                            {
                                if (Lang13.Bool(this.invocation))
                                {
                                    L.say(this.invocation);
                                }
                                cultists_in_range++;
                            }
                            continue;
                        }

                        if (L.stat != 0 || Lang13.Bool(H.disabilities & 2) || Lang13.Bool(((dynamic)H).silent))
                        {
                            continue;
                        }

                        if (Lang13.Bool(this.invocation))
                        {
                            L.say(this.invocation);
                        }
                        cultists_in_range++;
                    }
                }

                if (cultists_in_range >= this.req_cultists)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }