コード例 #1
0
    // Token: 0x060037F9 RID: 14329
    public static void ActivateBonusSkill()
    {
        if (!Characters.Sein || Characters.Sein.IsSuspended || ActiveBonus == 0)
        {
            return;
        }
        switch (ActiveBonus)
        {
        case 101:
            if (Characters.Sein.Energy.Current > 0f)
            {
                float amount = Characters.Sein.Energy.Current * 4f;
                Characters.Sein.Energy.SetCurrent(Characters.Sein.Mortality.Health.Amount / 4f);
                Characters.Sein.Mortality.Health.SetAmount(amount);
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 102:
            if (RandomizerBonusSkill.ActiveDrainSkills.Contains(ActiveBonus))
            {
                RandomizerBonusSkill.ActiveDrainSkills.Remove(ActiveBonus);
                Randomizer.printInfo(BonusSkillNames[ActiveBonus] + " off");
                Characters.Sein.PlatformBehaviour.Gravity.BaseSettings.GravityAngle = 0f;
                RandomizerBonusSkill.EnergyDrainRate -= 0.001f;
                return;
            }
            if (Characters.Sein.Energy.Current > 0f)
            {
                RandomizerBonusSkill.ActiveDrainSkills.Add(ActiveBonus);
                Randomizer.printInfo(BonusSkillNames[ActiveBonus] + " on");
                Characters.Sein.PlatformBehaviour.Gravity.BaseSettings.GravityAngle = 180f;
                RandomizerBonusSkill.EnergyDrainRate += 0.001f;
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 103:
            if (RandomizerBonusSkill.ActiveDrainSkills.Contains(ActiveBonus))
            {
                RandomizerBonusSkill.ActiveDrainSkills.Remove(ActiveBonus);
                Randomizer.printInfo(BonusSkillNames[ActiveBonus] + " off");
                Characters.Sein.PlatformBehaviour.LeftRightMovement.Settings.Ground.MaxSpeed = 11.6666f;
                Characters.Sein.PlatformBehaviour.LeftRightMovement.Settings.Air.MaxSpeed    = 11.6666f;
                RandomizerBonusSkill.EnergyDrainRate -= 0.001f;
                return;
            }
            if (Characters.Sein.Energy.Current > 0f)
            {
                RandomizerBonusSkill.ActiveDrainSkills.Add(ActiveBonus);
                Randomizer.printInfo(BonusSkillNames[ActiveBonus] + " on");
                Characters.Sein.PlatformBehaviour.LeftRightMovement.Settings.Ground.MaxSpeed = 40f;
                Characters.Sein.PlatformBehaviour.LeftRightMovement.Settings.Air.MaxSpeed    = 40f;
                RandomizerBonusSkill.EnergyDrainRate += 0.001f;
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 104:
            if (Characters.Sein.Abilities.Carry.IsCarrying || !Characters.Sein.Controller.CanMove || !Characters.Sein.Active || (LastAltR.x == 0f && LastAltR.y == 0f))
            {
                return;
            }
            if (Characters.Sein.Energy.Current >= 0.5f)
            {
                Characters.Sein.Energy.Spend(0.5f);
                Randomizer.WarpTo(LastAltR, 0);
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 105:
            if (Characters.Sein.Abilities.Carry.IsCarrying || !Characters.Sein.Controller.CanMove || !Characters.Sein.Active || (LastSoulLink.x == 0f && LastSoulLink.y == 0f))
            {
                return;
            }
            if (Characters.Sein.Energy.Current >= 0.5f)
            {
                Characters.Sein.Energy.Spend(0.5f);
                Randomizer.WarpTo(LastSoulLink, 0);
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 106:
            if (!Characters.Sein.SoulFlame.InsideCheckpointMarker)
            {
                Randomizer.printInfo("You can only Respec at a Soul Link!");
                return;
            }
            {
                int apToGain = RandomizerBonus.ResetAP();
                CharacterAbility[]      abilities      = Characters.Sein.PlayerAbilities.Abilities;
                List <CharacterAbility> actuallySkills = new List <CharacterAbility>()
                {
                    Characters.Sein.PlayerAbilities.WallJump,
                    Characters.Sein.PlayerAbilities.ChargeFlame,
                    Characters.Sein.PlayerAbilities.DoubleJump,
                    Characters.Sein.PlayerAbilities.Bash,
                    Characters.Sein.PlayerAbilities.Stomp,
                    Characters.Sein.PlayerAbilities.Climb,
                    Characters.Sein.PlayerAbilities.Glide,
                    Characters.Sein.PlayerAbilities.ChargeJump,
                    Characters.Sein.PlayerAbilities.Dash,
                    Characters.Sein.PlayerAbilities.Grenade,
                    Characters.Sein.PlayerAbilities.SpiritFlame
                };
                for (int i = 0; i < abilities.Length; i++)
                {
                    if (!actuallySkills.Contains(abilities[i]))
                    {
                        abilities[i].HasAbility = false;
                    }
                }
                Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
                Characters.Sein.Inventory.SkillPointsCollected += apToGain;
                Characters.Sein.Level.SkillPoints += apToGain;
            }
            return;

        case 107:
            if (LevelExplosionCooldown > 0)
            {
                return;
            }
            if (Characters.Sein.Energy.Current >= 1f)
            {
                Characters.Sein.Energy.Spend(1f);
                OldHealth = Characters.Sein.Mortality.Health.Amount;
                OldEnergy = Characters.Sein.Energy.Current;
                Characters.Sein.Level.AttemptInstantiateLevelUp();
                LevelExplosionCooldown = 15;
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        default:
            return;
        }
    }
コード例 #2
0
    public static void ActivateBonusSkill(int ab)
    {
        if (!Characters.Sein || Characters.Sein.IsSuspended || ab == 0 || RandomizerBonusSkill.get(ab) == 0)
        {
            return;
        }
        switch (ab)
        {
        case 101:
            if (Characters.Sein.Energy.Current > 0f)
            {
                float amount = Characters.Sein.Energy.Current * 4f;
                Characters.Sein.Energy.SetCurrent(Characters.Sein.Mortality.Health.Amount / 4f);
                Characters.Sein.Mortality.Health.SetAmount(amount);
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 102:
        case 103:
        case 109:
            if (IsActive(ab))
            {
                Deactivate(ab);
                BonusSkillText(BonusSkillNames[ab] + " off");
                RandomizerBonusSkill.EnergyDrainRate -= DrainRates[ab];
            }
            else if (Characters.Sein.Energy.Current > 5 * DrainRates[ab])
            {
                Activate(ab);
                BonusSkillText(BonusSkillNames[ab] + " on");
                RandomizerBonusSkill.EnergyDrainRate += DrainRates[ab];
            }
            else
            {
                UI.SeinUI.ShakeEnergyOrbBar();
                Characters.Sein.Energy.NotifyOutOfEnergy();
                return;
            }
            if (ab == 102)
            {
                if (IsActive(ab) || Characters.Sein.Abilities.Carry.IsCarrying)
                {
                    Characters.Sein.PlatformBehaviour.Gravity.BaseSettings.GravityAngle += 180f;
                }
                else
                {
                    Characters.Sein.PlatformBehaviour.Gravity.BaseSettings.GravityAngle = 0f;
                }
                Characters.Sein.PlatformBehaviour.LeftRightMovement.PlatformMovement.LocalSpeedX *= -1;
            }
            break;

        case 104:
            if (!CanWarpTo(LastAltR))
            {
                return;
            }
            if (Characters.Sein.Energy.Current >= 0.5f)
            {
                Characters.Sein.Energy.Spend(0.5f);
                Randomizer.WarpTo(LastAltR, 0);
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 105:
            if (!CanWarpTo(LastSoulLink))
            {
                return;
            }
            if (Characters.Sein.Energy.Current >= 0.5f)
            {
                Characters.Sein.Energy.Spend(0.5f);
                Randomizer.WarpTo(LastSoulLink, 0);
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 106:
            if (!Characters.Sein.SoulFlame.InsideCheckpointMarker)
            {
                BonusSkillText("You can only Respec on a Soul Link!");
                return;
            }
            {
                int apToGain = RandomizerBonus.ResetAP();
                if (apToGain == 0)
                {
                    BonusSkillText("No AP to refund");
                    return;
                }
                BonusSkillText("Respec successful. " + apToGain.ToString() + " AP refunded!");
                CharacterAbility[]      abilities      = Characters.Sein.PlayerAbilities.Abilities;
                List <CharacterAbility> actuallySkills = new List <CharacterAbility>()
                {
                    Characters.Sein.PlayerAbilities.WallJump,
                    Characters.Sein.PlayerAbilities.ChargeFlame,
                    Characters.Sein.PlayerAbilities.DoubleJump,
                    Characters.Sein.PlayerAbilities.Bash,
                    Characters.Sein.PlayerAbilities.Stomp,
                    Characters.Sein.PlayerAbilities.Climb,
                    Characters.Sein.PlayerAbilities.Glide,
                    Characters.Sein.PlayerAbilities.ChargeJump,
                    Characters.Sein.PlayerAbilities.Dash,
                    Characters.Sein.PlayerAbilities.Grenade,
                    Characters.Sein.PlayerAbilities.SpiritFlame
                };
                for (int i = 0; i < abilities.Length; i++)
                {
                    if (!actuallySkills.Contains(abilities[i]))
                    {
                        abilities[i].HasAbility = false;
                    }
                }
                Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
                Characters.Sein.Inventory.SkillPointsCollected += apToGain;
                Characters.Sein.Level.SkillPoints += apToGain;
            }
            return;

        case 107:
            if (LevelExplosionCooldown > 0)
            {
                return;
            }
            if (Characters.Sein.Energy.Current >= 1f)
            {
                Characters.Sein.Energy.Spend(1f);
                OldHealth = Characters.Sein.Mortality.Health.Amount;
                OldEnergy = Characters.Sein.Energy.Current;
                Characters.Sein.Level.AttemptInstantiateLevelUp();
                LevelExplosionCooldown = 15;
                return;
            }
            UI.SeinUI.ShakeEnergyOrbBar();
            Characters.Sein.Energy.NotifyOutOfEnergy();
            return;

        case 108:
            if (IsActive(ab))
            {
                Deactivate(ab);
                BonusSkillText("Movement Bonuses on");
            }
            else
            {
                Activate(ab);
                BonusSkillText("Movement Bonuses off");
            }
            return;

        case 110:
            if (IsActive(ab))
            {
                Deactivate(ab);
                BonusSkillText(BonusSkillNames[ab] + " off");
                RandomizerBonusSkill.EnergyDrainRate -= DrainRates[ab];
            }
            else if (Characters.Sein.Energy.Current > 1f)
            {
                Activate(ab);
                Characters.Sein.Energy.Spend(0.5f);
                BonusSkillText(BonusSkillNames[ab] + " on");
                RandomizerBonusSkill.EnergyDrainRate += DrainRates[ab];
            }
            else
            {
                UI.SeinUI.ShakeEnergyOrbBar();
                Characters.Sein.Energy.NotifyOutOfEnergy();
                return;
            }
            break;

        case 111:
            Characters.Sein.Mortality.DamageReciever.OnRecieveDamage(new Damage(9000f, new Vector2(0, 0), Characters.Sein.Position, DamageType.Lava, Characters.Sein.GameObject));
            break;

        case 112:
            if (CapturedEnemy == null)
            {
                BonusSkillNames[112] = "Pokeball (empty)";
                Characters.Sein.Abilities.SpiritFlameTargetting.UpdateClosestAttackables();
                foreach (ISpiritFlameAttackable target in Characters.Sein.Abilities.SpiritFlameTargetting.ClosestAttackables)
                {
                    string logMessage = target.GetType().ToString();
                    if (target is EntityTargetting)
                    {
                        var enemyTarget = target as EntityTargetting;
                        var entity      = enemyTarget.Entity;
                        if (entity is JumperEnemy)
                        {
                            CapturedName = "Fronkey";
                        }
                        else if (entity is FishEnemy)
                        {
                            CapturedName = "Fish";
                        }
                        else if (entity is SpitterEnemy)
                        {
                            CapturedName = "Frog";
                        }
                        else if (entity is KamikazeSootEnemy)
                        {
                            CapturedName = "Baneling";
                        }
                        else if (entity is DashOwlEnemy)
                        {
                            CapturedName = "Bird";
                        }
                        else
                        {
                            return;
                        }
                        CapturedEnemy = entity as Enemy;
                        Randomizer.LogError(CapturedEnemy.BoundingBox.ToString());
                        CapturedOffset = CapturedEnemy.PositionToPlayerPosition;
                        CapturedLeft   = Characters.Sein.FaceLeft;
                        CapturedEnemy.gameObject.SetActiveRecursively(false);
                        //Events.Scheduler.OnSceneRootDisabled.Remove(new Action<SceneRoot>(CapturedEnemy.OnSceneUnloaded));
                        BonusSkillNames[112] = "Pokeball (" + CapturedName + ")";
                    }
                }
            }
            else
            {
                if (CapturedLeft != Characters.Sein.FaceLeft)
                {
                    CapturedOffset.x *= -1;
                }
                CapturedEnemy.Position = Characters.Sein.Position + CapturedOffset;
                CapturedEnemy.gameObject.SetActiveRecursively(true);
                CapturedEnemy        = null;
                BonusSkillNames[112] = "Pokeball (empty)";
            }
            break;

        case 114:
            if (IsActive(ab))
            {
                Deactivate(ab);
                BonusSkillText("Ori");
            }
            else
            {
                Activate(ab);
                BonusSkillText("Naru");
            }
            return;

            break;

        case 1587:
            if (!Characters.Sein.Controller.CanMove || !Characters.Sein.Active)
            {
                return;
            }
            Randomizer.WarpTo(new Vector3(-2478, -593, 0), 0);
            GameController.Instance.RemoveGameplayObjects();
            RandomizerStatsManager.Active = false;
            RandomizerCreditsManager.Initialize();
            break;

        case 113:
            if (IsActive(ab))
            {
                Deactivate(ab);
                BonusSkillText("Bash/Stomp Damage on");
            }
            else
            {
                Activate(ab);
                BonusSkillText("Bash/Stomp Damage off");
            }
            break;

        default:
            return;
        }
    }