Ejemplo n.º 1
0
        // Function from file: observer.dm
        public void ManualFollow(dynamic target = null)
        {
            Icon   I         = null;
            double?orbitsize = null;
            int?   rot_seg   = null;


            if (!(target is Ent_Dynamic))
            {
                return;
            }
            I          = new Icon(target.icon, target.icon_state, Lang13.DoubleNullable(target.dir));
            orbitsize  = (I.Width() + I.Height()) * 0.5;
            orbitsize -= (orbitsize ?? 0) / Game13.icon_size * Game13.icon_size * 0.25;

            if (this.orbiting != target)
            {
                this.WriteMsg("<span class='notice'>Now orbiting " + target + ".</span>");
            }

            dynamic _a = this.ghost_orbit;             // Was a switch-case, sorry for the mess.

            if (_a == "triangle")
            {
                rot_seg = 3;
            }
            else if (_a == "square")
            {
                rot_seg = 4;
            }
            else if (_a == "pentagon")
            {
                rot_seg = 5;
            }
            else if (_a == "hexagon")
            {
                rot_seg = 6;
            }
            else
            {
                rot_seg = 36;
            }
            this.orbit(target, orbitsize, GlobalVars.FALSE, 20, rot_seg);
            return;
        }
Ejemplo n.º 2
0
        // Function from file: energy_ball.dm
        public void handle_energy(  )
        {
            Obj_Singularity_EnergyBall EB = null;
            Icon    I                  = null;
            double? orbitsize          = null;
            dynamic Orchiectomy_target = null;


            if ((this.energy ?? 0) >= (this.energy_to_raise ?? 0))
            {
                this.energy_to_lower  = (this.energy_to_raise ?? 0) - 20;
                this.energy_to_raise += this.energy_to_raise ?? 0;
                GlobalFuncs.playsound(this.loc, "sound/magic/lightning_chargeup.ogg", 100, 1, 15);
                Task13.Schedule(100, (Task13.Closure)(() => {
                    if (!(this.loc != null))
                    {
                        return;
                    }
                    EB            = new Obj_Singularity_EnergyBall(this.loc);
                    EB.transform *= Rand13.Pick(new object [] { 0.3, 0.4, 0.5, 0.6, 061 });
                    I             = new Icon(this.icon, this.icon_state, this.dir);
                    orbitsize     = (I.Width() + I.Height()) * Convert.ToDouble(Rand13.Pick(new object [] { 0.4, 0.5, 0.6, 061, 0.8 }));
                    orbitsize    -= (orbitsize ?? 0) / Game13.icon_size * Game13.icon_size * 0.25;
                    EB.orbit(this, orbitsize, Lang13.IntNullable(Rand13.Pick(new object [] { GlobalVars.FALSE, GlobalVars.TRUE })), Rand13.Int(10, 25), Lang13.IntNullable(Rand13.Pick(new object [] { 3, 4, 5, 6, 36 })));
                    return;
                }));
            }
            else if ((this.energy ?? 0) < (this.energy_to_lower ?? 0) && this.orbiting_balls.len != 0)
            {
                this.energy_to_raise = (this.energy_to_raise ?? 0) * 0.5;
                this.energy_to_lower = (this.energy_to_raise ?? 0) * 0.5 - 20;
                Orchiectomy_target   = Rand13.PickFromTable(this.orbiting_balls);
                GlobalFuncs.qdel(Orchiectomy_target);
            }
            else if (this.orbiting_balls.len != 0)
            {
                this.energy -= this.orbiting_balls.len;
            }
            return;
        }