Пример #1
0
        public IEnumerator SpreadShot(int pellets)
        {
            slowWalkDisableTimer = 15f;
            GameCameras.instance.cameraShakeFSM.SendEvent("SmallShake");
            HP_Sprites.StartGunAnims();
            HP_Sprites.StartFlash();
            HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);
            PlayGunSounds("Shotgun");

            float direction = HP_DirectionHandler.finalDegreeDirection;

            for (int i = 0; i < pellets; i++)
            {
                yield return(new WaitForEndOfFrame());

                GameObject         bullet = HP_Prefabs.SpawnBullet(direction);
                HP_BulletBehaviour hpbb   = bullet.GetComponent <HP_BulletBehaviour>();
                hpbb.bulletDegreeDirection += UnityEngine.Random.Range(-20, 20);
                hpbb.pierce = PlayerData.instance.equippedCharm_13;
                bullet.transform.localScale = new Vector3(0.3f, 0.3f, 0.1f);

                Destroy(bullet, HP_Stats.bulletRange);
            }

            yield return(new WaitForSeconds(0.05f));

            isFiring = false;
        }
Пример #2
0
        //For steel rains that tracks targets
        public static IEnumerator StartSteelRain(GameObject enemyGO, int totalShells)
        {
            HP_UIHandler.UpdateDisplay();
            //Modding.Logger.Log("SPELL CONTROL STEEL RAIN TRACK");
            Transform targetCoordinates = enemyGO.transform;
            Vector3   enemyPos          = targetCoordinates.position;


            for (int shells = 0; shells < totalShells; shells++)
            {
                yield return(new WaitForSeconds(0.45f));

                if ((enemyGO != null) || (targetCoordinates != null))
                {
                    enemyPos = targetCoordinates.position;
                }

                GameObject         shell = Instantiate(HP_Prefabs.bulletPrefab, enemyPos + new Vector3(Range(-5, 5), Range(25, 50), -0.1f), new Quaternion(0, 0, 0, 0));
                HP_BulletBehaviour hpbb  = shell.GetComponent <HP_BulletBehaviour>();
                hpbb.isFireSupportBullet = true;
                hpbb.ignoreCollisions    = true;
                hpbb.targetDestination   = enemyPos + new Vector3(0, Range(2, 8), -0.1f);
                shell.SetActive(true);

                yield return(new WaitForSeconds(0.5f));
            }
        }
Пример #3
0
        //========================================FIRE SUPPORT SPAWN METHODS====================================

        //Regular steel rain (non tracking)
        public static IEnumerator StartSteelRainNoTrack(Vector3 targetCoordinates, int totalShells)
        {
            HP_UIHandler.UpdateDisplay();
            Modding.Logger.Log("SPELL CONTROL STEEL RAIN NO TRACKING");
            for (int shells = 0; shells < totalShells; shells++)
            {
                yield return(new WaitForSeconds(0.45f));

                GameObject         shell = Instantiate(HP_Prefabs.bulletPrefab, targetCoordinates + new Vector3(Range(-5, 5), Range(25, 50), -0.1f), new Quaternion(0, 0, 0, 0));
                HP_BulletBehaviour hpbb  = shell.GetComponent <HP_BulletBehaviour>();
                hpbb.isFireSupportBullet = true;
                hpbb.ignoreCollisions    = true;
                hpbb.targetDestination   = targetCoordinates + new Vector3(0, Range(2, 8), -0.1f);
                shell.SetActive(true);
                yield return(new WaitForSeconds(0.5f));
            }
        }
Пример #4
0
        //Intercepts HealthManager's Hit method and allows me to override it with my own calculation
        public void HealthManager_Hit_Hook(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance)
        {
            //Modding.Logger.Log(self.gameObject.name + " " + hitInstance.Source.name);
            //Alternative hit damages from other sources like weaver or explosions
            Modding.Logger.Log(self.name);

            if (hitInstance.Source.name.Contains("Gas"))
            {
                //Explosion damage
                hitInstance.DamageDealt = 15 + (PlayerData.instance.nailSmithUpgrades * 5);
                orig(self, hitInstance);
                return;
            }
            else if (hitInstance.Source.name.Contains("Damager"))
            {
                //Glowing Womblings
                HeroController.instance.AddMPCharge(15);
                orig(self, hitInstance);
                return;
            }
            if (!hitInstance.Source.name.Contains("bullet"))
            {
                //Nail Damage TODO: Change this because this apparently affects environmental damage that are supposed to be OHKO
                hitInstance.DamageDealt = 3 + PlayerData.instance.nailSmithUpgrades * 3;
                orig(self, hitInstance);
                return;
            }

            HP_BulletBehaviour hpbb = hitInstance.Source.GetComponent <HP_BulletBehaviour>();
            Vector3            bulletOriginPosition = hitInstance.Source.GetComponent <HP_BulletBehaviour>().bulletOriginPosition;

            //==============Soul Gain Amount============
            int soulGainAmt = HP_Stats.CalculateSoulGain();

            //==============Damage=================
            int damage = HP_Stats.CalculateDamage(bulletOriginPosition, self.transform.position);

            DamageEnemies.HitEnemy(self, damage, HP_BulletBehaviour.bulletHitInstance, soulGainAmt);
            Modding.Logger.Log("DamageCalculator, damage dealt is " + damage + " against " + self.name);

            //==============Blood Splatter Effect=================
            //int cardinalDirection = DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(self.transform));
            //if (!self.IsInvincible) StartCoroutine(SplatterBlood(self.gameObject, 1, cardinalDirection * 90));
        }
Пример #5
0
        IEnumerator SpawnTyphoon(Vector3 spawnPos, float explosionAmount)
        {
            Modding.Logger.Log("Spawning Typhoon");
            float degreeTotal = 0;
            float addedDegree = 180 / (explosionAmount + 1);

            for (; explosionAmount > 0; explosionAmount--)
            {
                yield return(new WaitForEndOfFrame());

                degreeTotal += addedDegree;
                GameObject         typhoon_ball = Instantiate(HP_Prefabs.bulletPrefab, spawnPos, new Quaternion(0, 0, 0, 0));
                HP_BulletBehaviour hpbb         = typhoon_ball.GetComponent <HP_BulletBehaviour>();
                hpbb.bulletDegreeDirection = degreeTotal;
                hpbb.specialAttrib         = "DungExplosionSmall";
                typhoon_ball.SetActive(true);

                //Destroy(typhoon_ball, Range(0.115f, 0.315f));
                Destroy(typhoon_ball, Range(0.115f, 0.315f));
            }
            yield return(null);
        }
Пример #6
0
        public IEnumerator SingleShot()
        {
            HP_HeatHandler.IncreaseHeat(HP_Stats.heatPerShot);
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            GameObject         bullet = HP_Prefabs.SpawnBullet(HP_DirectionHandler.finalDegreeDirection);
            HP_BulletBehaviour hpbb   = bullet.GetComponent <HP_BulletBehaviour>();

            hpbb.fm = FireModes.Single;

            //Charm 14 Steady Body
            hpbb.noDeviation = (PlayerData.instance.equippedCharm_14 && HeroController.instance.cState.onGround) ? true : false;
            //Charm 13 Mark of Pride gives perfect accuracy and pierce
            hpbb.perfectAccuracy = (PlayerData.instance.equippedCharm_13 && (HP_HeatHandler.currentHeat < 10)) ? true : false;
            hpbb.pierce          = PlayerData.instance.equippedCharm_13;

            //set the origin position of where the bullet was spawned
            hpbb.bulletOriginPosition = bullet.transform.position;

            Destroy(bullet, HP_Stats.bulletRange + 3f);

            HP_Sprites.StartGunAnims();
            HP_Sprites.StartFlash();
            HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);

            slowWalkDisableTimer = 10f;

            string weaponType = PlayerData.instance.equippedCharm_13 ? "sniper" : "rifle";

            PlayGunSounds("sniper");
            if (weaponType == "sniper")
            {
                bullet.transform.localScale = new Vector3(1.8f, 1.8f, 0.1f);
            }

            yield return(new WaitForSeconds(0.02f));

            isFiring = false;
        }
Пример #7
0
        public IEnumerator FireFlare()
        {
            airStrikeActive              = false;
            HP_Stats.currentPrimaryAmmo -= 1;
            HP_SpellControl.artifactActivatedEffect.SetActive(false);

            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            GameObject bullet = HP_Prefabs.SpawnBullet(HP_DirectionHandler.finalDegreeDirection);

            PlayGunSounds("flare");

            HP_BulletBehaviour bullet_behaviour = bullet.GetComponent <HP_BulletBehaviour>();

            bullet_behaviour.flareRound = true;

            HP_Sprites.StartGunAnims();
            HP_Sprites.StartFlash();
            HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);

            yield return(new WaitForSeconds(0.04f));

            isFiring = false;
        }
Пример #8
0
        public void SpawnFireball()
        {
            int soulCost = (PlayerData.instance.equippedCharm_33) ? 33 : 50;

            if (HP_WeaponHandler.currentGun.gunName == "Nail" || PlayerData.instance.fireballLevel == 0 || PlayerData.instance.MPCharge < soulCost)
            {
                HeroController.instance.spellControl.SetState("Inactive");
                return;
            }
            HeroController.instance.TakeMP(soulCost);
            HeroController.instance.spellControl.SetState("Spell End");

            float directionMultiplier = (HeroController.instance.cState.facingRight) ? 1f : -1f;
            float wallClimbMultiplier = (HeroController.instance.cState.wallSliding) ? -1f : 1f;

            directionMultiplier *= wallClimbMultiplier;
            GameObject bullet = HP_Prefabs.SpawnBullet(HP_DirectionHandler.finalDegreeDirection);

            bullet.SetActive(true);
            HP_BulletBehaviour hpbb = bullet.GetComponent <HP_BulletBehaviour>();

            hpbb.perfectAccuracy = true;
            bullet.GetComponent <BoxCollider2D>().size *= 1.5f;
            hpbb.bulletDegreeDirection = HP_DirectionHandler.finalDegreeDirection;
            hpbb.specialAttrib         = "Explosion";
            hpbb.bulletSpeedMult       = 2;

            HP_Prefabs.projectileSprites.TryGetValue("specialbullet.png", out Sprite specialBulletTexture);
            bullet.GetComponent <SpriteRenderer>().sprite = specialBulletTexture;

            //HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");

            PlayAudio("firerocket", true);

            HP_Sprites.StartGunAnims();
        }