Esempio n. 1
0
 // This applies to chasing creatures.
 public ParamsMoveChase()
 {
     this.rules.Add(new LabeledParam("axis", "Movement Axis", new string[3] {
         "Both", "Vertical", "Horizontal"
     }, (byte)FlightChaseAxis.Both));
     this.rules.Add(new PercentParam("speed", "Movement Speed", 10, 200, 10, 100, FInt.Create(2)));
     this.rules.Add(new IntParam("chase", "Chase Range", 0, 40, 1, 0, " tile(s)"));
     this.rules.Add(new IntParam("flee", "Flee Range", 0, 40, 1, 0, " tile(s)"));
     this.rules.Add(new IntParam("stall", "Stall Range", 0, 40, 1, 0, " tile(s)"));
     this.rules.Add(new LabeledParam("returns", "Returns to Start", new string[2] {
         "Returns", "Doesn't Return"
     }, (byte)0));
     this.rules.Add(new FrameParam("retDelay", "Delay for Returning", 0, 300, 15, 120, " frames"));
     this.rules.Add(new IntParam("clusterId", "Act As Cluster ID", 0, 10, 1, 0, " (0 to ignore)"));
 }
Esempio n. 2
0
        protected override void RunAction()
        {
            Touch touch = this.actor.physics.touch;

            // End charge when touching ground and action has expired.
            if (touch.toBottom && this.actionEnd < this.timer.Frame)
            {
                this.actor.physics.StopX();
                this.EndAction((byte)CommonState.MotionEnd);
                return;
            }

            // End action and prevent further speed activation if running into something:
            if (this.dirRight)
            {
                if (touch.toRight)
                {
                    this.actor.physics.StopX();
                    this.EndAction((byte)CommonState.Wait);
                    return;
                }
            }
            else
            {
                if (touch.toLeft)
                {
                    this.actor.physics.StopX();
                    this.EndAction((byte)CommonState.Wait);
                    return;
                }
            }

            // Charge
            this.actor.physics.velocity.X = this.dirRight ? FInt.Create(this.actionSpeed) : FInt.Create(-this.actionSpeed);
        }
Esempio n. 3
0
 public ParamsAttackBolt() : base()
 {
     this.rules.Remove(this.rules[2]);                                                              // Remove Gravity Influence
     this.rules.Add(new IntParam("count", "Number of Bolts", 1, 3, 1, 1));                          // Number of bolts that gets shot simultaneously (1 to 3)
     this.rules.Add(new PercentParam("spread", "Bolt Spread", 50, 200, 10, 100, FInt.Create(0.3))); // The % spread between each bolt.
 }
Esempio n. 4
0
 public ParamsAttackFireSpit() : base()
 {
     this.rules.Add(new IntParam("count", "Number of Fireballs", 1, 2, 1, 1));                                           // Number of bolts that gets shot simultaneously (1 to 3).
     this.rules.Add(new PercentParam("spread", "Fireball Spread", 50, 250, 10, 100, FInt.Create(0.3)));                  // The % spread between each bolt.
 }
Esempio n. 5
0
        public override void RunTick()
        {
            // While Slammer is Passive
            if (this.state == SlammerState.Passive)
            {
                if (this.viewHeight == 0)
                {
                    return;
                }

                // Check for Characters within Slammer's View. Being Slamming if one is found.
                int objectId = CollideRect.FindOneObjectTouchingArea(
                    this.actor.room.objects[(byte)LoadOrder.Character],
                    this.actor.posX + 8,
                    this.viewY,
                    (byte)TilemapEnum.TileWidth * 2 - 20,
                    this.viewHeight
                    );

                if (objectId > 0)
                {
                    this.state = SlammerState.Slamming;
                }
            }

            // While Slammer is Slamming
            else if (this.state == SlammerState.Slamming)
            {
                this.fallAccel += FInt.Create(0.12);
                if (this.fallAccel > 2)
                {
                    this.fallAccel = FInt.Create(2);
                }
                this.physics.velocity.Y += this.fallAccel;

                // If Slammer has completed its maximum journey.
                if (this.actor.posY >= this.endY)
                {
                    this.EndSlam(this.actor);
                    return;
                }
            }

            // While Slammer is Reset Delayed
            else if (this.state == SlammerState.ResetDelay)
            {
                if (this.resetFrame <= Systems.timer.Frame)
                {
                    this.state = SlammerState.Resetting;
                }
            }

            // While Slammer is Resetting
            else if (this.state == SlammerState.Resetting)
            {
                this.physics.velocity.Y -= FInt.Create(0.3);
                if (this.actor.posY <= this.startY)
                {
                    this.SlammerHasReset();
                }
            }
        }
Esempio n. 6
0
 public ParamsAttack()
 {
     this.rules.Add(new FrameParam("cycle", "Attack Frequency", 60, 300, 15, DefaultCycle, " frames"));                  // Frequency of the attack (in frames).
     this.rules.Add(new FrameParam("offset", "Timer Offset", 0, 300, 15, 0, " frames"));                                 // The offset of the frequency on the global time.
     this.rules.Add(new PercentParam("grav", "Gravity Influence", 0, 200, 10, 0, FInt.Create(0.5)));                     // The percent that gravity influences the projectile.
     this.rules.Add(new PercentParam("speed", "Attack Speed", 20, 200, 10, 100, FInt.Create(4)));                        // Velocity of the bolts (Y-axis).
 }
Esempio n. 7
0
        public override void Destroy(DirCardinal dir = DirCardinal.None, GameObject obj = null)
        {
            if (this.State == (byte)CommonState.Death)
            {
                return;
            }

            this.SetState((byte)CommonState.Death);
            this.physics.SetGravity(FInt.Create(0.7));
            this.endFrame = Systems.timer.Frame + 12;

            Physics physics = this.physics;

            if (dir == DirCardinal.Right || dir == DirCardinal.Left)
            {
                physics.velocity.Y = physics.velocity.Y < 0 ? physics.velocity.Y * FInt.Create(0.25) : FInt.Create(-3);
                physics.velocity.X = dir == DirCardinal.Right ? FInt.Create(-1) : FInt.Create(1);
            }
            else if (dir == DirCardinal.Down || dir == DirCardinal.Up)
            {
                physics.velocity.X = physics.velocity.X * FInt.Create(0.25);
                physics.velocity.Y = dir == DirCardinal.Down ? FInt.Create(-4) : FInt.Create(1);
            }
            else
            {
                physics.velocity.X = FInt.Create(0);
                physics.velocity.Y = FInt.Create(-3);
            }

            this.room.PlaySound(Systems.sounds.shellThud, 0.4f, this.posX + 16, this.posY + 16);
        }
Esempio n. 8
0
        public int intangible;                          // The frame (relative to timer.frame) until it is no longer intangible.

        public Item(RoomScene room, byte subType, FVector pos, Dictionary <string, short> paramList) : base(room, subType, pos, paramList)
        {
            // Physics
            this.physics = new Physics(this);
            this.physics.SetGravity(FInt.Create(0.5));
        }
Esempio n. 9
0
 public override void ActivatePlatform()
 {
     this.physics.SetGravity(FInt.Create(0.1));
 }
Esempio n. 10
0
        public void FireAttack(RoomScene room, short gridX, short gridY, short attX, short attY, float gravity)
        {
            ProjectileEnemy projectile = ProjectileEnemy.Create(room, (byte)ProjectileEnemySubType.Fire, FVector.Create(gridX * (byte)TilemapEnum.TileWidth + (byte)TilemapEnum.HalfWidth - 10, gridY * (byte)TilemapEnum.TileHeight + (byte)TilemapEnum.HalfHeight - 10), FVector.Create(attX, attY));

            projectile.physics.SetGravity(FInt.Create(gravity * 0.35));
        }
Esempio n. 11
0
        public override void RunAction(Character character)
        {
            // End the action after the designated number of frames has elapsed:
            if (this.HasTimeElapsed(character))
            {
                this.EndAction(character);
                return;
            }

            PlayerInput input   = character.input;
            Physics     physics = character.physics;

            // Horizontal Movement
            byte hoverSpeed = input.isDown(IKey.XButton) ? (byte)5 : (byte)3;

            // Horizontal Levitation Movement/Speed
            if (input.isDown(IKey.Right))
            {
                character.SetDirection(true);
                physics.velocity.X += hoverSpeed * FInt.Create(0.15);                 // HoverSpeed * 0.15
                if (physics.velocity.X > hoverSpeed)
                {
                    physics.velocity.X = FInt.Create(hoverSpeed);
                }
            }

            else if (input.isDown(IKey.Left))
            {
                character.SetDirection(false);
                physics.velocity.X -= hoverSpeed * FInt.Create(0.15);                 // HoverSpeed * 0.15
                if (physics.velocity.X < -hoverSpeed)
                {
                    physics.velocity.X = FInt.Create(-hoverSpeed);
                }
            }

            // Horizontal Deceleration
            else
            {
                physics.velocity.X = this.FlightDeceleration(physics.velocity.X, hoverSpeed * FInt.Create(0.1));
            }

            // Vertical Levitation
            if (input.isDown(IKey.Down) && character.status.actionBool1)
            {
                physics.velocity.Y += hoverSpeed * FInt.Create(0.15);                 // HoverSpeed * 0.15
                if (physics.velocity.Y > hoverSpeed)
                {
                    physics.velocity.Y = FInt.Create(hoverSpeed / 1.5);
                }
            }

            else if (input.isDown(IKey.Up) && character.status.actionBool1)
            {
                physics.velocity.Y -= hoverSpeed * FInt.Create(0.15);                 // HoverSpeed * 0.15
                if (physics.velocity.Y < -hoverSpeed)
                {
                    physics.velocity.Y = FInt.Create(-hoverSpeed);
                }
            }

            // Vertical Deceleration
            else
            {
                // Vertical Deceleration is faster than Horizontal.
                physics.velocity.Y = this.FlightDeceleration(physics.velocity.Y, hoverSpeed * FInt.Create(0.2));
            }
        }
Esempio n. 12
0
        public override void RunTick()
        {
            // If the actor doesn't have a track destination set, don't make any movements.
            if (this.nextTrack == null)
            {
                return;
            }

            // Get Last Track Position (if applicable)
            int posX, posY, duration;

            if (this.lastTrack is Track)
            {
                posX     = this.lastTrack.posX;
                posY     = this.lastTrack.posY;
                duration = this.lastTrack.duration;
            }
            else
            {
                posX     = this.startX;
                posY     = this.startY;
                duration = this.duration;
            }

            // Determine Lerp Position
            float weight = Math.Max((float)0, (float)(Systems.timer.Frame - this.lastArrivalFrame) / (float)duration);
            int   newX, newY;

            // If it has arrived at the next track position:
            if (weight >= 1)
            {
                newX = (int)Math.Round(Interpolation.Number(posX, this.nextTrack.posX, 1));
                newY = (int)Math.Round(Interpolation.Number(posY, this.nextTrack.posY, 1));

                // If the track indicates the the object should begin to fall:
                if (this.nextTrack.beginsFall)
                {
                    this.RunFallTick();
                    return;
                }

                this.physics.velocity.X = FInt.Create(newX - this.actor.posX);
                this.physics.velocity.Y = FInt.Create(newY - this.actor.posY);

                // Assign the next track destination:
                this.lastTrack        = this.nextTrack;
                this.lastArrivalFrame = Systems.timer.Frame + this.nextTrack.delay;
                this.nextTrack        = this.nextTrack.NextTrack;

                // If that was the last track, lose all motion and freeze in position.
                if (this.nextTrack == null)
                {
                    this.physics.RunPhysicsTick();
                    this.physics.velocity.X = FInt.Create(0);
                    this.physics.velocity.Y = FInt.Create(0);
                }

                return;
            }

            // Run Track Motion
            newX = (int)Math.Round(Interpolation.Number(posX, this.nextTrack.posX, weight));
            newY = (int)Math.Round(Interpolation.Number(posY, this.nextTrack.posY, weight));

            this.physics.velocity.X = FInt.Create(newX - this.actor.posX);
            this.physics.velocity.Y = FInt.Create(newY - this.actor.posY);
        }
Esempio n. 13
0
        public override void Launch(int posX, int posY, FInt velX, FInt velY)
        {
            var projectile = ProjectileBall.Create(this.character.room, this.projSubType, FVector.Create(posX, posY), FVector.Create(velX, velY));

            projectile.SetActorID(this.character);

            var projectile2 = ProjectileBall.Create(this.character.room, this.projSubType, FVector.Create(posX, posY), FVector.Create(velX * FInt.Create(1.4), velY * FInt.Create(1.2)));

            projectile2.SetActorID(this.character);
        }
Esempio n. 14
0
 public static FInt operator >>(FInt one, int Amount)
 {
     return(FInt.Create(one.RawValue >> Amount, false));
 }
Esempio n. 15
0
        public override void RunAction(Character character)
        {
            // End the action after the designated number of frames has elapsed:
            if (this.HasTimeElapsed(character))
            {
                this.EndAction(character);
                return;
            }

            CharacterStatus status = character.status;
            PlayerInput     input  = character.input;

            // Deactivate "JUMP" marker if the character has released the jump button.
            if (status.actionBool1 && !input.isDown(IKey.AButton))
            {
                status.actionBool1 = false;
            }

            // Deactivate "RUN" marker if the character has released the run button.
            if (status.actionBool2 && !input.isDown(IKey.XButton))
            {
                status.actionBool2 = false;
            }

            CharacterStats stats   = character.stats;
            Physics        physics = character.physics;

            // JUMP STRENGTH x0.6 (if not jumping), xSlowSpeed (if not running)
            FInt jumpStrength = stats.WallJumpYStrength * (status.actionBool1 ? (FInt)1 : FInt.Create(0.6)) * (status.actionBool2 ? (FInt)1 : stats.SlowSpeedMult);

            // Vertical Movement
            physics.velocity.Y = 0 - jumpStrength;

            // If the jump button has been released and the minimum duration has ended, end the jump:
            if (!status.actionBool1 && Systems.timer.Frame > character.status.actionEnds - status.actionNum1)
            {
                this.EndAction(character);
                return;
            }
        }
Esempio n. 16
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            // Only run this test for Characters.
            if (!(actor is Character))
            {
                return(false);
            }

            Character character = (Character)actor;

            if (character.status.action is FastMoveAction)
            {
                return(false);
            }

            var phys = character.physics;

            int velX = phys.velocity.X.RoundInt;
            int velY = phys.velocity.Y.RoundInt;

            // Default Speed Increase, if applicable:
            if (velX > 1)
            {
                phys.velocity.X += FInt.Create(1);
            }
            else if (velX < -1)
            {
                phys.velocity.X += FInt.Create(-1);
            }

            if (velY > 1)
            {
                phys.velocity.Y += FInt.Create(1);
            }
            else if (velY < -1)
            {
                phys.velocity.Y += FInt.Create(-1);
            }

            // Increase Character's Momentum
            if (Math.Abs(velX) > 8)
            {
                if (Math.Abs(velX) < 14)
                {
                    phys.velocity.X *= FInt.Create(1.3);
                }
            }
            else
            {
                phys.velocity.X *= FInt.Create(1.6);
            }

            if (velY < 0)
            {
                if (velY < -8)
                {
                    if (velY > -16)
                    {
                        phys.velocity.Y *= FInt.Create(1.8);
                    }
                }
                else
                {
                    phys.velocity.Y *= FInt.Create(2.2);
                }
            }
            else if (velY > 0)
            {
                if (velY < 8)
                {
                    phys.velocity.Y *= FInt.Create(1.3);
                }
            }

            ActionMap.FastMove.StartAction(character, 10);

            room.PlaySound(Systems.sounds.air, 1f, gridX * (byte)TilemapEnum.TileWidth, gridY * (byte)TilemapEnum.TileHeight);

            return(true);
        }
Esempio n. 17
0
        public static void CheatCodeStats()
        {
            string statIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(statCodes, statIns, "Assign stats for the character.");

            // If the stat instruction is a full word, then we can indicate that it's time to provide additional help text:
            if (statCodes.ContainsKey(statIns))
            {
                if (statCodes[statIns] is Action[])
                {
                    (statCodes[statIns] as Action[])[0].Invoke();
                    return;
                }

                ConsoleTrack.possibleTabs = "";
                ConsoleTrack.helpText     = statCodes[statIns].ToString();
            }

            if (ConsoleTrack.activate)
            {
                Character character = ConsoleTrack.character;

                // Reset All Stats
                if (statIns == "reset-all")
                {
                    character.stats.ResetCharacterStats();
                }

                // Gravity
                if (statIns == "gravity")
                {
                    character.stats.BaseGravity = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }

                // Abilities
                else if (statIns == "fast-cast")
                {
                    character.stats.CanFastCast = ConsoleTrack.GetArgAsBool();
                }
                else if (statIns == "shell-mastery")
                {
                    character.stats.ShellMastery = ConsoleTrack.GetArgAsBool();
                }
                else if (statIns == "safe-above")
                {
                    character.stats.SafeVsDamageAbove = ConsoleTrack.GetArgAsBool();
                }
                else if (statIns == "damage-above")
                {
                    character.stats.InflictDamageAbove = ConsoleTrack.GetArgAsBool();
                }

                // Wound Stats
                else if (statIns == "maxhealth")
                {
                    character.wounds.WoundMaximum = (byte)ConsoleTrack.GetArgAsInt();
                }
                else if (statIns == "maxarmor")
                {
                    character.wounds.WoundMaximum = (byte)ConsoleTrack.GetArgAsInt();
                }
            }
        }