Exemplo n.º 1
0
    public void FireAt(Transform target)
    {
        float time = Time.time;

        if (time < _lastfire + FireCooldown)
        {
            return;
        }
        _lastfire = time;
        var bullets = GameObject.Find("bullets");

        Bullets = new BulletMan(bullets.transform);
        var pos = new Vector3(transform.position.x, transform.position.y, transform.position.z);

        Bullets.Spawn(pos + transform.up * 0.1f, transform.rotation, 3f, target);
    }
Exemplo n.º 2
0
        private void EnemyModRandomizer(AIActor targetActor)
        {
            // Finding too many issues being caused with Bosses to allow shader modifications on them.
            if (targetActor.healthHaver != null && targetActor.healthHaver.IsBoss)
            {
                return;
            }

            bool hasAltSkin = false;
            bool hasShader  = false;

            if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.PHOBOSGEON)
            {
                if (targetActor.EnemyGuid == "ba928393c8ed47819c2c5f593100a5bc")
                {
                    ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: ChaosPrefabs.StoneCubeCollection_West);
                }
            }

            if (ChaosConsole.isHardMode | ChaosConsole.isUltraMode)
            {
                if (ChaosLists.PreventBeingJammedOverrideList.Contains(targetActor.EnemyGuid))
                {
                    targetActor.PreventBlackPhantom = true;
                }
                if (ChaosLists.PreventDeathOnBossKillList.Contains(targetActor.EnemyGuid))
                {
                    targetActor.PreventAutoKillOnBossDeath = true;
                }
                if (targetActor.EnemyGuid == "eeb33c3a5a8e4eaaaaf39a743e8767bc")
                {
                    targetActor.AlwaysShowOffscreenArrow = true;
                }

                if ((targetActor.EnemyGuid == "128db2f0781141bcb505d8f00f9e4d47" | targetActor.EnemyGuid == "b54d89f9e802455cbb2b8a96a31e8259") && UnityEngine.Random.value < 0.3f)
                {
                    if (RedShotGunMan.BootlegRedShotGunManCollection == null)
                    {
                        RedShotGunMan.Init();
                    }
                    targetActor.optionalPalette             = null;
                    targetActor.procedurallyOutlined        = false;
                    targetActor.sprite.OverrideMaterialMode = tk2dBaseSprite.SpriteMaterialOverrideMode.NONE;
                    targetActor.sprite.renderer.material.SetTexture("_PaletteTex", null);
                    FieldInfo field = typeof(AIActor).GetField("m_isPaletteSwapped", BindingFlags.Instance | BindingFlags.NonPublic);
                    field.SetValue(targetActor, false);
                    if (targetActor.EnemyGuid == "128db2f0781141bcb505d8f00f9e4d47")
                    {
                        ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: RedShotGunMan.BootlegRedShotGunManCollection);
                    }
                    else
                    {
                        ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: BlueShotGunMan.BootlegBlueShotGunManCollection);
                    }
                    targetActor.OverrideDisplayName = ("Bootleg " + targetActor.GetActorName());
                    targetActor.ActorName          += "ALT";
                    hasAltSkin = true;
                    return;
                }
                if ((targetActor.EnemyGuid == "01972dee89fc4404a5c408d50007dad5" | targetActor.EnemyGuid == "db35531e66ce41cbb81d507a34366dfe") && UnityEngine.Random.value < 0.3f)
                {
                    float Selector = UnityEngine.Random.Range(0, 3);
                    if (Selector < 1)
                    {
                        if (BulletMan.BootlegBulletManCollection == null)
                        {
                            BulletMan.Init(targetActor);
                        }
                        ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: ChaosPrefabs.BulletManMonochromeCollection, overrideShader: ShaderCache.Acquire("tk2d/BlendVertexColorUnlitTilted"));
                        targetActor.OverrideDisplayName = ("1-Bit " + targetActor.GetActorName());
                        targetActor.ActorName          += "ALT";
                        hasAltSkin = true;
                        return;
                    }
                    else if (Selector >= 1)
                    {
                        ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: ChaosPrefabs.BulletManUpsideDownCollection);
                        targetActor.OverrideDisplayName = ("Bizarro " + targetActor.GetActorName());
                        targetActor.ActorName          += "ALT";
                        hasAltSkin = true;
                        return;
                    }
                    else if (Selector >= 2)
                    {
                        ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: BulletMan.BootlegBulletManCollection, overrideShader: ShaderCache.Acquire("tk2d/BlendVertexColorUnlitTilted"));
                        targetActor.OverrideDisplayName = ("Bootleg " + targetActor.GetActorName());
                        targetActor.ActorName          += "ALT";
                        hasAltSkin = true;
                        return;
                    }
                    return;
                }
                if (targetActor.EnemyGuid == "88b6b6a93d4b4234a67844ef4728382c" && UnityEngine.Random.value < 0.32f)
                {
                    if (BulletManBandana.BootlegBulletManBandanaCollection == null)
                    {
                        BulletManBandana.Init(targetActor);
                    }
                    ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: BulletManBandana.BootlegBulletManBandanaCollection, overrideShader: ShaderCache.Acquire("tk2d/BlendVertexColorUnlitTilted"));
                    targetActor.OverrideDisplayName = ("Bootleg " + targetActor.GetActorName());
                    targetActor.ActorName          += "ALT";
                    hasAltSkin = true;
                    return;
                }
                if (targetActor.EnemyGuid == "14ea47ff46b54bb4a98f91ffcffb656d" && BraveUtility.RandomBool())
                {
                    if (RatGrenade.RatGrenadeCollection == null)
                    {
                        RatGrenade.Init(targetActor);
                    }
                    ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: RatGrenade.RatGrenadeCollection);
                    targetActor.healthHaver.gameObject.AddComponent <ChaosExplodeOnDeath>();
                    ExplodeOnDeath RatExplodeComponent = targetActor.healthHaver.gameObject.GetComponent <ExplodeOnDeath>();
                    RatExplodeComponent.explosionData            = EnemyDatabase.GetOrLoadByGuid("b4666cb6ef4f4b038ba8924fd8adf38f").gameObject.GetComponent <ExplodeOnDeath>().explosionData;
                    RatExplodeComponent.deathType                = OnDeathBehavior.DeathType.Death;
                    RatExplodeComponent.triggerName              = string.Empty;
                    RatExplodeComponent.immuneToIBombApp         = false;
                    RatExplodeComponent.LinearChainExplosion     = false;
                    RatExplodeComponent.LinearChainExplosionData = EnemyDatabase.GetOrLoadByGuid("b4666cb6ef4f4b038ba8924fd8adf38f").gameObject.GetComponent <ExplodeOnDeath>().LinearChainExplosionData;
                    targetActor.CorpseObject = null;
                    hasAltSkin = true;
                    return;
                }

                if (targetActor.EnemyGuid == "2feb50a6a40f4f50982e89fd276f6f15" && BraveUtility.RandomBool())
                {
                    if (Bullat.BootlegBullatCollection == null)
                    {
                        Bullat.Init(targetActor);
                    }
                    ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: Bullat.BootlegBullatCollection);
                    AIActor TinyBlobulord = EnemyDatabase.GetOrLoadByGuid("d1c9781fdac54d9e8498ed89210a0238");
                    targetActor.behaviorSpeculator.OtherBehaviors    = TinyBlobulord.behaviorSpeculator.OtherBehaviors;
                    targetActor.behaviorSpeculator.TargetBehaviors   = TinyBlobulord.behaviorSpeculator.TargetBehaviors;
                    targetActor.behaviorSpeculator.OverrideBehaviors = TinyBlobulord.behaviorSpeculator.OverrideBehaviors;
                    targetActor.behaviorSpeculator.AttackBehaviors   = TinyBlobulord.behaviorSpeculator.AttackBehaviors;
                    targetActor.behaviorSpeculator.MovementBehaviors = TinyBlobulord.behaviorSpeculator.MovementBehaviors;
                    targetActor.DiesOnCollison       = true;
                    targetActor.procedurallyOutlined = false;
                    targetActor.OverrideDisplayName  = ("Bootleg " + targetActor.GetActorName());
                    hasAltSkin = true;
                    return;
                }

                if (!hasAltSkin && targetActor.EnemyGuid != "5e0af7f7d9de4755a68d2fd3bbc15df4")
                {
                    if (UnityEngine.Random.value <= 0.2f && !targetActor.IsBlackPhantom)
                    {
                        ChaosShaders.Instance.BecomeHologram(targetActor, BraveUtility.RandomBool());
                        hasShader = true;
                        return;
                    }
                    else if (UnityEngine.Random.value <= 0.16f && !targetActor.IsBlackPhantom)
                    {
                        ChaosShaders.Instance.ApplySpaceShader(targetActor.sprite);
                        hasShader = true;
                        return;
                    }
                    else if (UnityEngine.Random.value <= 0.15f && !targetActor.IsBlackPhantom)
                    {
                        ChaosShaders.Instance.BecomeRainbow(targetActor);
                        hasShader = true;
                        return;
                    }
                    else if (UnityEngine.Random.value <= 0.1f && !targetActor.IsBlackPhantom)
                    {
                        ChaosShaders.Instance.BecomeCosmicHorror(targetActor.sprite);
                        hasShader = true;
                        return;
                    }
                    else if (UnityEngine.Random.value <= 0.065f && !targetActor.IsBlackPhantom)
                    {
                        ChaosShaders.Instance.BecomeGalaxy(targetActor.sprite);
                        hasShader = true;
                        return;
                    }
                }
            }

            if (!hasAltSkin && !hasShader && ChaosConsole.GlitchEnemies && targetActor.EnemyGuid != "5e0af7f7d9de4755a68d2fd3bbc15df4" && !targetActor.IsBlackPhantom && UnityEngine.Random.value <= ChaosConsole.GlitchRandomActors)
            {
                float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.06f);
                float RandomDispFloat           = UnityEngine.Random.Range(0.1f, 0.16f);
                float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.1f, 0.4f);
                float RandomColorProbFloat      = UnityEngine.Random.Range(0.05f, 0.2f);
                float RnadomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.25f);

                if (!targetActor.sprite.usesOverrideMaterial && !ChaosLists.DontGlitchMeList.Contains(targetActor.EnemyGuid))
                {
                    ChaosShaders.Instance.BecomeGlitched(targetActor, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RnadomColorIntensityFloat);
                    if (!targetActor.healthHaver.IsBoss && !ChaosLists.blobsAndCritters.Contains(targetActor.EnemyGuid) && targetActor.GetComponent <ChaosSpawnGlitchObjectOnDeath>() == null)
                    {
                        if (UnityEngine.Random.value <= 0.25)
                        {
                            targetActor.gameObject.AddComponent <ChaosSpawnGlitchObjectOnDeath>();
                        }
                    }
                    ChaosGlitchedEnemies.GlitchExistingEnemy(targetActor);
                    if (!ChaosConsole.randomEnemySizeEnabled)
                    {
                        if (targetActor.healthHaver != null)
                        {
                            if (!targetActor.healthHaver.IsBoss)
                            {
                                targetActor.healthHaver.SetHealthMaximum(targetActor.healthHaver.GetMaxHealth() / 1.5f, null, false);
                            }
                            else
                            {
                                targetActor.healthHaver.SetHealthMaximum(targetActor.healthHaver.GetMaxHealth() / 1.25f, null, false);
                            }
                        }
                    }
                    if (UnityEngine.Random.value <= 0.1f && targetActor.EnemyGuid != "4d37ce3d666b4ddda8039929225b7ede" && targetActor.EnemyGuid != "19b420dec96d4e9ea4aebc3398c0ba7a" && targetActor.GetComponent <ExplodeOnDeath>() == null && targetActor.GetComponent <ChaosSpawnGlitchObjectOnDeath>() == null && targetActor.GetComponent <ChaosSpawnGlitchEnemyOnDeath>() == null)
                    {
                        try { targetActor.gameObject.AddComponent <ChaosExplodeOnDeath>(); } catch (Exception) { }
                    }
                }
                return;
            }
        }