示例#1
0
        // Function from file: summonitem.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living L                  = null;
            ByTable    hand_items         = null;
            bool       butterfingers      = false;
            string     message            = null;
            Obj        item               = null;
            Ent_Static item_to_retrive    = null;
            int        infinite_recursion = 0;
            Ent_Static organ              = null;
            Ent_Static M                  = null;
            Ent_Static C                  = null;
            Ent_Static P                  = null;


            foreach (dynamic _b in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                L = _b;

                hand_items    = new ByTable(new object [] { L.get_active_hand(), L.get_inactive_hand() });
                butterfingers = false;
                message       = null;

                if (!(this.marked_item != null))
                {
                    message = "<span class='notice'>";

                    foreach (dynamic _a in Lang13.Enumerate(hand_items, typeof(Obj)))
                    {
                        item = _a;


                        if (Lang13.Bool(item.flags.Contains(128)))
                        {
                            continue;
                        }

                        if (Lang13.Bool(item.flags.Contains(2)))
                        {
                            message += "Though it feels redundant, ";
                        }
                        this.marked_item = item;
                        message         += "You mark " + item + " for recall.</span>";
                        this.name        = "Recall " + item;
                        break;
                    }

                    if (!(this.marked_item != null))
                    {
                        if (hand_items != null)
                        {
                            message = "<span class='caution'>You aren't holding anything that can be marked for recall.</span>";
                        }
                        else
                        {
                            message = "<span class='notice'>You must hold the desired item in your hands to mark it for recall.</span>";
                        }
                    }
                }
                else if (hand_items.Contains(this.marked_item != null && this.marked_item != null))
                {
                    message          = "<span class='notice'>You remove the mark on " + this.marked_item + " to use elsewhere.</span>";
                    this.name        = "Instant Summons";
                    this.marked_item = null;
                }
                else if (this.marked_item != null && Lang13.Bool(this.marked_item.gc_destroyed))
                {
                    message          = "<span class='warning'>You sense your marked item has been destroyed!</span>";
                    this.name        = "Instant Summons";
                    this.marked_item = null;
                }
                else
                {
                    item_to_retrive    = this.marked_item;
                    infinite_recursion = 0;

                    if (!(item_to_retrive.loc != null))
                    {
                        if (GlobalFuncs.isorgan(item_to_retrive))
                        {
                            organ = item_to_retrive;

                            if (Lang13.Bool(((dynamic)organ).owner))
                            {
                                GlobalFuncs.add_logs(L, ((dynamic)organ).owner, "magically removed " + organ.name + " from", null, "INTENT: " + String13.ToUpper(L.a_intent));
                                ((dynamic)organ).Remove(((dynamic)organ).owner);
                            }
                        }
                    }
                    else
                    {
                        while (!(item_to_retrive.loc is Tile) && infinite_recursion < 10)
                        {
                            if (item_to_retrive.loc is Mob)
                            {
                                M = item_to_retrive.loc;

                                if (M is Mob_Living_Silicon)
                                {
                                    M.loc.visible_message("<span class='warning'>" + M + " suddenly disappears!</span>");
                                    M.loc = L.loc;
                                    M.loc.visible_message("<span class='caution'>" + M + " suddenly appears!</span>");
                                    item_to_retrive = null;
                                    break;
                                }
                                ((Mob)M).unEquip(item_to_retrive);

                                if (M is Mob_Living_Carbon)
                                {
                                    C = M;

                                    if (Lang13.Bool(((dynamic)C).stomach_contents.Contains(Lang13.Bool(((dynamic)C).stomach_contents) && item_to_retrive != null)))
                                    {
                                        ((dynamic)C).stomach_contents -= item_to_retrive;
                                    }
                                }
                            }
                            else
                            {
                                if (item_to_retrive.loc is Obj_Machinery_PortableAtmospherics)
                                {
                                    P = item_to_retrive.loc;
                                    ((dynamic)P).disconnect();
                                    ((dynamic)P).update_icon();
                                }
                                item_to_retrive = item_to_retrive.loc;
                            }
                            infinite_recursion += 1;
                        }
                    }

                    if (!(item_to_retrive != null))
                    {
                        return(false);
                    }

                    if (item_to_retrive.loc != null)
                    {
                        item_to_retrive.loc.visible_message("<span class='warning'>The " + item_to_retrive.name + " suddenly disappears!</span>");
                    }

                    if (L.hand)
                    {
                        if (!L.equip_to_slot_if_possible(item_to_retrive, 4, false, true, true))
                        {
                            if (!L.equip_to_slot_if_possible(item_to_retrive, 5, false, true, true))
                            {
                                butterfingers = true;
                            }
                        }
                    }
                    else if (!L.equip_to_slot_if_possible(item_to_retrive, 5, false, true, true))
                    {
                        if (!L.equip_to_slot_if_possible(item_to_retrive, 4, false, true, true))
                        {
                            butterfingers = true;
                        }
                    }

                    if (butterfingers)
                    {
                        item_to_retrive.loc = L.loc;
                        item_to_retrive.loc.visible_message("<span class='caution'>The " + item_to_retrive.name + " suddenly appears!</span>");
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/SummonItems_generic.ogg", 50, 1);
                    }
                    else
                    {
                        item_to_retrive.loc.visible_message("<span class='caution'>The " + item_to_retrive.name + " suddenly appears in " + L + "'s hand!</span>");
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/SummonItems_generic.ogg", 50, 1);
                    }
                }

                if (Lang13.Bool(message))
                {
                    L.WriteMsg(message);
                }
            }
            return(false);
        }
        // Function from file: charge.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living L                   = null;
            ByTable    hand_items          = null;
            dynamic    charged_item        = null;
            bool       burnt_out           = false;
            dynamic    M                   = null;
            Obj_Effect_ProcHolder_Spell S  = null;
            Obj_Effect_ProcHolder_Spell S2 = null;
            Obj item = null;
            Obj I    = null;
            Obj I2   = null;
            Obj W    = null;
            Obj C    = null;
            Obj I3   = null;
            Obj C2   = null;


            foreach (dynamic _e in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                L = _e;

                hand_items   = new ByTable(new object [] { L.get_active_hand(), L.get_inactive_hand() });
                charged_item = null;
                burnt_out    = false;

                if (Lang13.Bool(L.pulling) && L.pulling is Mob_Living)
                {
                    M = L.pulling;

                    if (M.mob_spell_list.len != 0 || Lang13.Bool(M.mind) && M.mind.spell_list.len != 0)
                    {
                        foreach (dynamic _a in Lang13.Enumerate(M.mob_spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
                        {
                            S = _a;

                            S.charge_counter = S.charge_max;
                        }

                        if (Lang13.Bool(M.mind))
                        {
                            foreach (dynamic _b in Lang13.Enumerate(M.mind.spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
                            {
                                S2 = _b;

                                S2.charge_counter = S2.charge_max;
                            }
                        }
                        M.WriteMsg("<span class='notice'>you feel raw magic flowing through you, it feels good!</span>");
                    }
                    else
                    {
                        M.WriteMsg("<span class='notice'>you feel very strange for a moment, but then it passes.</span>");
                        burnt_out = true;
                    }
                    charged_item = M;
                    break;
                }

                foreach (dynamic _d in Lang13.Enumerate(hand_items, typeof(Obj)))
                {
                    item = _d;


                    if (item is Obj_Item_Weapon_Spellbook)
                    {
                        if (item is Obj_Item_Weapon_Spellbook_Oneuse)
                        {
                            I = item;

                            if (Rand13.PercentChance(80))
                            {
                                L.visible_message("<span class='warning'>" + I + " catches fire!</span>");
                                GlobalFuncs.qdel(I);
                            }
                            else
                            {
                                ((dynamic)I).used = 0;
                                charged_item      = I;
                                break;
                            }
                        }
                        else
                        {
                            L.WriteMsg("<span class='caution'>Glowing red letters appear on the front cover...</span>");
                            L.WriteMsg("<span class='warning'>" + Rand13.Pick(new object [] { "NICE TRY BUT NO!", "CLEVER BUT NOT CLEVER ENOUGH!", "SUCH FLAGRANT CHEESING IS WHY WE ACCEPTED YOUR APPLICATION!", "CUTE!", "YOU DIDN'T THINK IT'D BE THAT EASY, DID YOU?" }) + "</span>");
                            burnt_out = true;
                        }
                    }
                    else if (item is Obj_Item_Weapon_Gun_Magic)
                    {
                        I2 = item;

                        if (Rand13.PercentChance(80) && !Lang13.Bool(((dynamic)I2).can_charge))
                        {
                            ((dynamic)I2).max_charges--;
                        }

                        if (Convert.ToDouble(((dynamic)I2).max_charges) <= 0)
                        {
                            ((dynamic)I2).max_charges = 0;
                            burnt_out = true;
                        }
                        ((dynamic)I2).charges = ((dynamic)I2).max_charges;

                        if (item is Obj_Item_Weapon_Gun_Magic_Wand && Lang13.Bool(((dynamic)I2).max_charges) != false)
                        {
                            W            = item;
                            W.icon_state = Lang13.Initial(W, "icon_state");
                        }
                        charged_item = I2;
                        break;
                    }
                    else if (item is Obj_Item_Weapon_StockParts_Cell)
                    {
                        C = item;

                        if (Rand13.PercentChance(80))
                        {
                            ((dynamic)C).maxcharge -= 200;
                        }

                        if (Convert.ToDouble(((dynamic)C).maxcharge) <= 1)
                        {
                            ((dynamic)C).maxcharge = 1;
                            burnt_out = true;
                        }
                        ((dynamic)C).charge = ((dynamic)C).maxcharge;
                        charged_item        = C;
                        break;
                    }
                    else if (item.contents != null)
                    {
                        foreach (dynamic _c in Lang13.Enumerate(item.contents, typeof(Obj)))
                        {
                            I3 = _c;


                            if (I3 is Obj_Item_Weapon_StockParts_Cell)
                            {
                                C2 = I3;

                                if (Rand13.PercentChance(80))
                                {
                                    ((dynamic)C2).maxcharge -= 200;
                                }

                                if (Convert.ToDouble(((dynamic)C2).maxcharge) <= 1)
                                {
                                    ((dynamic)C2).maxcharge = 1;
                                    burnt_out = true;
                                }
                                ((dynamic)C2).charge = ((dynamic)C2).maxcharge;
                                item.update_icon();
                                charged_item = item;
                                break;
                            }
                        }
                    }
                }

                if (!Lang13.Bool(charged_item))
                {
                    L.WriteMsg("<span class='notice'>you feel magical power surging to your hands, but the feeling rapidly fades...</span>");
                }
                else if (burnt_out)
                {
                    L.WriteMsg("<span class='caution'>" + charged_item + " doesn't seem to be reacting to the spell...</span>");
                }
                else
                {
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/Charge.ogg", 50, 1);
                    L.WriteMsg("<span class='notice'>" + charged_item + " suddenly feels very warm!</span>");
                }
            }
            return(false);
        }