Example #1
0
        // Function from file: revenant.dm
        public override int check_completion(  )
        {
            Mob_Living_SimpleAnimal_Revenant R = null;
            int essence_stolen = 0;


            if (!(this.owner.current is Mob_Living_SimpleAnimal_Revenant))
            {
                return(0);
            }
            R = this.owner.current;

            if (!(R != null) || R.stat == 2)
            {
                return(0);
            }
            essence_stolen = R.essence_accumulated;

            if (essence_stolen < this.targetAmount)
            {
                return(0);
            }
            return(1);
        }
Example #2
0
        // Function from file: revenant_spawn_event.dm
        public bool get_revenant(bool?end_if_fail = null)
        {
            end_if_fail = end_if_fail ?? false;

            int                 deadMobs            = 0;
            dynamic             M                   = null;
            ByTable             candidates          = null;
            dynamic             C                   = null;
            Mind                player_mind         = null;
            ByTable             spawn_locs          = null;
            Obj_Effect_Landmark L                   = null;
            Obj_Effect_Landmark L2                  = null;
            Mob_Living_SimpleAnimal_Revenant revvie = null;

            deadMobs = 0;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.dead_mob_list))
            {
                M = _a;

                deadMobs++;
            }

            if (deadMobs < 10)
            {
                GlobalFuncs.message_admins("Random event attempted to spawn a revenant, but there were only " + deadMobs + "/" + 10 + " dead mobs.");
                return(false);
            }
            this.key_of_revenant = null;

            if (!Lang13.Bool(this.key_of_revenant))
            {
                candidates = GlobalFuncs.get_candidates("revenant");

                if (!(candidates.len != 0))
                {
                    if (end_if_fail == true)
                    {
                        return(false);
                    }
                    this.find_revenant(); return(false);
                }
                C = Rand13.PickFromTable(candidates);
                this.key_of_revenant = C.key;
            }

            if (!Lang13.Bool(this.key_of_revenant))
            {
                if (end_if_fail == true)
                {
                    return(false);
                }
                this.find_revenant(); return(false);
            }
            player_mind        = new Mind(this.key_of_revenant);
            player_mind.active = true;
            spawn_locs         = new ByTable();

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


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

            if (!(spawn_locs != null))
            {
                foreach (dynamic _e in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark)))
                {
                    L2 = _e;


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

            if (!(spawn_locs != null))
            {
                spawn_locs.Add(GlobalFuncs.get_turf(player_mind.current));
            }

            if (!(spawn_locs != null))
            {
                this.find_revenant(); return(false);
            }
            revvie = new Mob_Living_SimpleAnimal_Revenant(Rand13.PickFromTable(spawn_locs));
            player_mind.transfer_to(revvie);
            player_mind.assigned_role = "revenant";
            player_mind.special_role  = "Revenant";
            GlobalVars.ticker.mode.traitors.Or(player_mind);
            GlobalFuncs.message_admins("" + this.key_of_revenant + " has been made into a revenant by an event.");
            GlobalFuncs.log_game("" + this.key_of_revenant + " was spawned as a revenant by an event.");
            return(true);
        }
Example #3
0
        // Function from file: revenant.dm
        public bool reform(  )
        {
            string key_of_revenant             = null;
            Mob_Living_SimpleAnimal_Revenant R = null;
            dynamic M           = null;
            ByTable candidates  = null;
            dynamic C           = null;
            Mind    player_mind = null;


            if (Lang13.Bool(this.gc_destroyed) || !(this != null) || this.inert)
            {
                return(false);
            }
            GlobalFuncs.message_admins("Revenant ectoplasm was left undestroyed for 1 minute and is reforming into a new revenant.");
            this.loc = GlobalFuncs.get_turf(this);
            R        = new Mob_Living_SimpleAnimal_Revenant(GlobalFuncs.get_turf(this));

            if (this.client_to_revive != null)
            {
                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.dead_mob_list))
                {
                    M = _a;


                    if (M.client == this.client_to_revive)
                    {
                        R.client        = this.client_to_revive;
                        key_of_revenant = this.client_to_revive.key;
                    }
                }
            }

            if (!Lang13.Bool(key_of_revenant))
            {
                GlobalFuncs.message_admins("The new revenant's old client either could not be found or is in a new, living mob - grabbing a random candidate instead...");
                candidates = GlobalFuncs.get_candidates("revenant");

                if (!(candidates.len != 0))
                {
                    GlobalFuncs.qdel(R);
                    GlobalFuncs.message_admins("No candidates were found for the new revenant. Oh well!");
                    this.inert = true;
                    this.visible_message("<span class='revenwarning'>" + this + " settles down and seems lifeless.</span>");
                    return(false);
                }
                C = Rand13.PickFromTable(candidates);
                key_of_revenant = C.key;

                if (!Lang13.Bool(key_of_revenant))
                {
                    GlobalFuncs.qdel(R);
                    GlobalFuncs.message_admins("No ckey was found for the new revenant. Oh well!");
                    this.inert = true;
                    this.visible_message("<span class='revenwarning'>" + this + " settles down and seems lifeless.</span>");
                    return(false);
                }
            }
            player_mind        = new Mind(key_of_revenant);
            player_mind.active = true;
            player_mind.transfer_to(R);
            player_mind.assigned_role = "revenant";
            player_mind.special_role  = "Revenant";
            GlobalVars.ticker.mode.traitors.Or(player_mind);
            GlobalFuncs.message_admins("" + key_of_revenant + " has been " + (this.client_to_revive != null ? "re" : "") + "made into a revenant by reforming ectoplasm.");
            GlobalFuncs.log_game("" + key_of_revenant + " was " + (this.client_to_revive != null ? "re" : "") + "made as a revenant by reforming ectoplasm.");
            this.visible_message("<span class='revenboldnotice'>" + this + " suddenly rises into the air before fading away.</span>");
            GlobalFuncs.qdel(this);

            if (this != null)
            {
                this.inert = true;
            }
            return(true);
        }