// Function from file: double_agents.dm
        public override void forge_traitor_objectives(Mind traitor = null)
        {
            dynamic               target_mind       = null;
            Objective_Destroy     destroy_objective = null;
            Objective_Assassinate kill_objective    = null;
            Objective_Survive     survive_objective = null;
            Objective_Escape      escape_objective  = null;


            if (this.target_list.len != 0 && Lang13.Bool(this.target_list[traitor]))
            {
                target_mind = this.target_list[traitor];

                if (target_mind.current is Mob_Living_Silicon)
                {
                    destroy_objective        = new Objective_Destroy();
                    destroy_objective.owner  = traitor;
                    destroy_objective.target = target_mind;
                    destroy_objective.update_explanation_text();
                    traitor.objectives.Add(destroy_objective);
                }
                else
                {
                    kill_objective        = new Objective_Assassinate();
                    kill_objective.owner  = traitor;
                    kill_objective.target = target_mind;
                    kill_objective.update_explanation_text();
                    traitor.objectives.Add(kill_objective);
                }

                if (traitor.current is Mob_Living_Silicon)
                {
                    survive_objective       = new Objective_Survive();
                    survive_objective.owner = traitor;
                    traitor.objectives.Add(survive_objective);
                }
                else
                {
                    escape_objective       = new Objective_Escape();
                    escape_objective.owner = traitor;
                    traitor.objectives.Add(escape_objective);
                }
            }
            else
            {
                base.forge_traitor_objectives(traitor);
            }
            return;
        }
Example #2
0
        // Function from file: ninja_event.dm
        public override bool start(  )
        {
            ByTable             spawn_locs           = null;
            Obj_Effect_Landmark L                    = null;
            ByTable             candidates           = null;
            dynamic             C                    = null;
            Mind                    Mind             = null;
            ByTable                 possible_targets = null;
            Mind                    M                = null;
            ByTable                 objectives       = null;
            Objective_Download      O                = null;
            Objective_Steal_Special O2               = null;
            int?    selected              = null;
            Mind    M2                    = null;
            dynamic is_bad_guy            = null;
            Objective_Assassinate O3      = null;
            Objective_Protect     O4      = null;
            int?              selected2   = null;
            dynamic           M3          = null;
            dynamic           is_bad_guy2 = null;
            Objective_Debrain O5          = null;
            Objective_Capture O6          = null;
            Objective_Survive O7          = null;
            dynamic           N           = null;


            if (!Lang13.Bool(this.spawn_loc))
            {
                spawn_locs = new ByTable();

                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark)))
                {
                    L = _b;


                    if (L.loc is Tile)
                    {
                        switch ((string)(L.name))
                        {
                        case "ninjaspawn":
                        case "carpspawn":
                            spawn_locs.Add(L.loc);
                            break;
                        }
                    }
                }

                if (!(spawn_locs.len != 0))
                {
                    this.kill(); return(false);
                }
                this.spawn_loc = Rand13.PickFromTable(spawn_locs);
            }

            if (!Lang13.Bool(this.spawn_loc))
            {
                this.kill(); return(false);
            }

            if (!Lang13.Bool(this.key))
            {
                candidates = GlobalFuncs.get_candidates("space ninja");

                if (!(candidates.len != 0))
                {
                    this.kill(); return(false);
                }
                C        = Rand13.PickFromTable(candidates);
                this.key = C.key;
            }

            if (!Lang13.Bool(this.key))
            {
                this.kill(); return(false);
            }
            Mind             = GlobalFuncs.create_ninja_mind(this.key);
            Mind.active      = true;
            possible_targets = new ByTable();

            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.ticker.minds, typeof(Mind)))
            {
                M = _c;


                if (Lang13.Bool(M.current) && Convert.ToInt32(M.current.stat) != 2)
                {
                    if (M.current is Mob_Living_Carbon_Human)
                    {
                        if (Lang13.Bool(M.special_role))
                        {
                            possible_targets[M] = 0;
                        }
                        else if (GlobalVars.command_positions.Contains(M.assigned_role))
                        {
                            possible_targets[M] = 1;
                        }
                    }
                }
            }
            objectives = new ByTable(new object [] { 1, 2, 3, 4 });

            while (Mind.objectives.len < 6)
            {
                dynamic _d = GlobalFuncs.pick_n_take(objectives);                   // Was a switch-case, sorry for the mess.
                if (_d == 1)
                {
                    O       = new Objective_Download();
                    O.owner = Mind;
                    O.gen_amount_goal();
                    Mind.objectives.Add(O);
                }
                else if (_d == 2)
                {
                    O2       = new Objective_Steal_Special();
                    O2.owner = Mind;
                    Mind.objectives.Add(O2);
                }
                else if (_d == 3)
                {
                    if (!(possible_targets.len != 0))
                    {
                        continue;
                    }
                    selected   = Rand13.Int(1, possible_targets.len);
                    M2         = possible_targets[selected];
                    is_bad_guy = possible_targets[M2];
                    possible_targets.Cut(selected, (selected ?? 0) + 1);

                    if (Lang13.Bool(is_bad_guy ^ this.helping_station))
                    {
                        O3                  = new Objective_Assassinate();
                        O3.owner            = Mind;
                        O3.target           = M2;
                        O3.explanation_text = new Txt("Slay ").the(M2.current.real_name).item().str(", the ").item(M2.assigned_role).str(".").ToString();
                        Mind.objectives.Add(O3);
                    }
                    else
                    {
                        O4                  = new Objective_Protect();
                        O4.owner            = Mind;
                        O4.target           = M2;
                        O4.explanation_text = new Txt("Protect ").the(M2.current.real_name).item().str(", the ").item(M2.assigned_role).str(", from harm.").ToString();
                        Mind.objectives.Add(O4);
                    }
                }
                else if (_d == 4)
                {
                    if (!(possible_targets.len != 0))
                    {
                        continue;
                    }
                    selected2   = Rand13.Int(1, possible_targets.len);
                    M3          = possible_targets[selected2];
                    is_bad_guy2 = possible_targets[M3];
                    possible_targets.Cut(selected2, (selected2 ?? 0) + 1);

                    if (Lang13.Bool(is_bad_guy2 ^ this.helping_station))
                    {
                        O5                  = new Objective_Debrain();
                        O5.owner            = Mind;
                        O5.target           = M3;
                        O5.explanation_text = "Steal the brain of " + M3.current.real_name + ".";
                        Mind.objectives.Add(O5);
                    }
                    else
                    {
                        O6       = new Objective_Capture();
                        O6.owner = Mind;
                        O6.gen_amount_goal();
                        Mind.objectives.Add(O6);
                    }
                }
                else
                {
                    break;
                }
            }
            O7       = new Objective_Survive();
            O7.owner = Mind;
            Mind.objectives.Add(O7);
            Mind.store_memory("I am an elite mercenary assassin of the mighty Spider Clan. A <font color='red'><B>SPACE NINJA</B></font>!");
            Mind.store_memory("Suprise is my weapon. Shadows are my armor. Without them, I am nothing. (//initialize your suit by right clicking on it, to use abilities like stealth)!");
            Mind.store_memory("Officially, " + (this.helping_station != 0 ? "Nanotrasen" : "The Syndicate") + " are my employer.");
            this.Ninja = GlobalFuncs.create_space_ninja(this.spawn_loc);
            Mind.transfer_to(this.Ninja);

            if (this.Ninja.wear_suit is Obj_Item_Clothing_Suit_Space_SpaceNinja)
            {
                N = this.Ninja.wear_suit;
                ((Obj_Item_Clothing_Suit_Space_SpaceNinja)N).randomize_param();
            }
            this.Ninja.v_internal = this.Ninja.s_store;
            this.Ninja.update_internals_hud_icon(true);

            if (this.Ninja.mind != Mind)
            {
                throw new Exception("Ninja created with incorrect mind");
                return(false);
            }
            this.Ninja.WriteMsg(new Sound("sound/effects/ninja_greeting.ogg"));
            this.success_spawn = true;
            return(false);
        }
Example #3
0
        // Function from file: artefact.dm
        public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null)
        {
            bool    faction_check = false;
            dynamic F             = null;
            Objective_Hijackclone hijack_objective = null;
            Objective_Survive     new_objective    = null;
            ByTable candidates           = null;
            dynamic C                    = null;
            Obj_Item_Weapon_Multisword M = null;


            if (user.mind.special_role == "apprentice")
            {
                user.WriteMsg("<span class='warning'>You know better than to touch your teacher's stuff.</span>");
                return(null);
            }

            if (this.cooldown < Game13.time)
            {
                faction_check = false;

                foreach (dynamic _a in Lang13.Enumerate(this.faction))
                {
                    F = _a;


                    if (Lang13.Bool(user.faction.Contains(F)))
                    {
                        faction_check = true;
                        break;
                    }
                }

                if (!faction_check)
                {
                    this.faction  = new ByTable(new object [] { "" + user.real_name });
                    this.assigned = "" + user.real_name;
                    user.faction  = new ByTable(new object [] { "" + user.real_name });
                    user.WriteMsg("You bind the sword to yourself. You can now use it to summon help.");

                    if (!Lang13.Bool(Task13.User.mind.special_role))
                    {
                        if (Rand13.PercentChance(30))
                        {
                            user.WriteMsg("<span class='warning'><B>With your new found power you could easily conquer the station!</B></span>");
                            hijack_objective       = new Objective_Hijackclone();
                            hijack_objective.owner = Task13.User.mind;
                            Task13.User.mind.objectives.Add(hijack_objective);
                            hijack_objective.explanation_text = "Ensure only " + Task13.User.real_name + " and their copies are on the shuttle!";
                            Task13.User.WriteMsg("<B>Objective #" + 1 + "</B>: " + hijack_objective.explanation_text);
                            GlobalVars.ticker.mode.traitors.Add(Task13.User.mind);
                            Task13.User.mind.special_role = "" + Task13.User.real_name + " Prime";
                            this.evil = GlobalVars.TRUE;
                        }
                        else
                        {
                            user.WriteMsg("<span class='warning'><B>With your new found power you could easily defend the station!</B></span>");
                            new_objective                  = new Objective_Survive();
                            new_objective.owner            = Task13.User.mind;
                            new_objective.explanation_text = "Survive, and help defend the innocent from the mobs of multiverse clones.";
                            Task13.User.WriteMsg("<B>Objective #" + 1 + "</B>: " + new_objective.explanation_text);
                            Task13.User.mind.objectives.Add(new_objective);
                            GlobalVars.ticker.mode.traitors.Add(Task13.User.mind);
                            Task13.User.mind.special_role = "" + Task13.User.real_name + " Prime";
                            this.evil = GlobalVars.FALSE;
                        }
                    }
                }
                else
                {
                    candidates = GlobalFuncs.get_candidates("wizard");

                    if (candidates.len != 0)
                    {
                        C = Rand13.PickFromTable(candidates);
                        this.spawn_copy(C, GlobalFuncs.get_turf(user.loc));
                        user.WriteMsg("<span class='warning'><B>The sword flashes, and you find yourself face to face with...you!</B></span>");
                        this.cooldown = Game13.time + 400;

                        foreach (dynamic _b in Lang13.Enumerate(GlobalVars.multiverse, typeof(Obj_Item_Weapon_Multisword)))
                        {
                            M = _b;


                            if (M.assigned == this.assigned)
                            {
                                M.cooldown = this.cooldown;
                            }
                        }
                    }
                    else
                    {
                        user.WriteMsg("You fail to summon any copies of yourself. Perhaps you should try again in a bit.");
                    }
                }
            }
            else
            {
                user.WriteMsg("<span class='warning'><B>" + this + " is recharging! Keep in mind it shares a cooldown with the swords wielded by your copies.</span>");
            }
            return(null);
        }