Exemplo n.º 1
0
        public void FireGun(FireModes fm)
        {
            if (isFiring)
            {
                return;
            }
            isFiring = true;

            HP_Stats.StartBothCooldown();

            float finalDegreeDirectionLocal = HP_DirectionHandler.finalDegreeDirection;

            if (airStrikeActive)
            {
                StartCoroutine(FireFlare());
                return;
            }

            if (fm == FireModes.Single)
            {
                //slowWalk = ((PlayerData.instance.equippedCharm_37 && PlayerData.instance.equippedCharm_32) || !PlayerData.instance.equippedCharm_37);
                HeroController.instance.WALK_SPEED = HP_Stats.walkSpeed;
                StartCoroutine(SingleShot());
            }
            if (fm == FireModes.Spread)
            {
                slowWalk = ((PlayerData.instance.equippedCharm_37 && PlayerData.instance.equippedCharm_32) || !PlayerData.instance.equippedCharm_37);
                HeroController.instance.WALK_SPEED = HP_Stats.walkSpeed;
                StartCoroutine(SpreadShot(5));
                StartCoroutine(KnockbackRecoil(3f, finalDegreeDirectionLocal));
                return;
            }

            //Firing below will push the player up
            float mult = (PlayerData.instance.equippedCharm_31) ? 2 : 1;

            if (finalDegreeDirectionLocal == 270)
            {
                StartCoroutine(KnockbackRecoil(1.75f * mult, 270));
            }
            else if (finalDegreeDirectionLocal < 350 && finalDegreeDirectionLocal > 190)
            {
                StartCoroutine(KnockbackRecoil(0.07f * mult, 270));
            }
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
        public void Update()
        {
            //TODO: Replace weapon handler to accomodate "isUsingGun" bool instead of checking what theyre using
            if (!(HP_WeaponHandler.currentGun.gunName == "Nail") && !isFiring && HeroController.instance.CanCast())
            {
                if (HP_DirectionHandler.pressingAttack && HP_Stats.canFire)
                {
                    if (HP_Stats.currentPrimaryAmmo > 0)
                    {
                        //HP_Stats.ReduceAmmunition();
                        HP_Stats.StartBothCooldown();
                        FireGun((PlayerData.instance.equippedCharm_11) ? FireModes.Spread : FireModes.Single);
                    }

                    /*else if (PlayerData.instance.MPCharge >= HP_Stats.fireSoulCost)
                     * {
                     *  HeroController.instance.TakeMPQuick(HP_Stats.fireSoulCost);
                     *  HP_Stats.StartBothCooldown();
                     *  FireGun((PlayerData.instance.equippedCharm_11)? FireModes.Spread : FireModes.Single );
                     * }
                     */
                    else if (clickTimer <= 0)
                    {
                        clickTimer = 3f;
                        PlaySoundsMisc("cantfire");
                    }
                }
            }
            else if (!isFiring)
            {
                HeroController.instance.WALK_SPEED = 2.5f;
            }

            //TODO: Slow down the player while firing MOVE TO HP STATS LATER
            if (slowWalk)
            {
                HeroController.instance.cState.inWalkZone = true;
            }
            else
            {
                HeroController.instance.cState.inWalkZone = false;
            }
        }
Exemplo n.º 4
0
        public void Update()
        {
            bool isUsingGun   = HP_WeaponHandler.currentGun.gunName != "Nail";
            bool dnailPressed = InputHandler.Instance.inputActions.dreamNail.WasPressed;
            bool soulReload   = (PlayerData.instance.MPCharge >= 0);

            if (isUsingGun && dnailPressed && soulReload)
            {
                Modding.Logger.Log("RELOADING");
                HeroController.instance.TakeMP(33);
                AudioSource audios = HP_Sprites.gunSpriteGO.GetComponent <AudioSource>();
                LoadAssets.sfxDictionary.TryGetValue("weapon_draw.wav", out AudioClip ac);
                audios.PlayOneShot(ac);
                HP_Stats.ReloadGun(10);
            }

            return;

            if (swapWeaponTimer > 0)
            {
                swapWeaponTimer -= Time.deltaTime * 30f;
            }
            else
            {
                tapUp = 0;
            }

            if (InputHandler.Instance.inputActions.down.WasPressed)
            {
                if (tapUp == 0)
                {
                    swapWeaponTimer = 5f;
                    tapUp           = 1;
                }
                else if (tapUp == 1)
                {
                    Modding.Logger.Log("RELOADING");
                    tapUp = 0;
                }
            }
        }
Exemplo n.º 5
0
        public static IEnumerator StartInfusion()
        {
            artifactActivatedEffect.SetActive(false);
            LoadAssets.sfxDictionary.TryGetValue("infusionsound.wav", out AudioClip ac);
            AudioSource aud = infusionSoundGO.GetComponent <AudioSource>();

            aud.PlayOneShot(ac);

            buff_duration = (PlayerData.instance.screamLevel > 1) ? 150f : 80f;

            //Charm 9 lifeblood core
            buff_duration += (PlayerData.instance.equippedCharm_9) ? 200f : 0;

            //Joni's Blessing

            /*
             * if (PlayerData.instance.equippedCharm_27)
             * {
             *  buff_duration = -40f;
             *  int mpCharge = PlayerData.instance.MPCharge;
             *  int grenadeAmount = (int)(mpCharge/15f);
             *
             *  HP_Stats.grenadeAmnt += grenadeAmount;
             *  HeroController.instance.TakeMP(mpCharge);
             * }
             */
            buffActive = true;

            HP_Stats.ReduceAmmunition();

            if (PlayerData.instance.equippedCharm_34)
            {
                buff_duration = -40f;
                HeroController.instance.AddHealth(4);
            }

            //To make sure the minimum buff duration is always at 30f
            buff_duration = (buff_duration < 30f) ? 30f : buff_duration;

            GameCameras.instance.cameraShakeFSM.SendEvent("BigShake");

            HP_UIHandler.UpdateDisplay();

            //Gives fancy effects to when you infuse yourself, should add a sound soon
            Instantiate(sharpFlash, HeroController.instance.transform).SetActive(true);
            Instantiate(focusBurstAnim, HeroController.instance.transform).SetActive(true);

            SpriteFlash knightFlash = HeroController.instance.GetAttr <SpriteFlash>("spriteFlash");

            knightFlash.flashBenchRest();

            GameObject artChargeEffect = Instantiate(HeroController.instance.artChargedEffect, HeroController.instance.transform.position, Quaternion.identity);

            artChargeEffect.SetActive(true);
            artChargeEffect.transform.SetParent(HeroController.instance.transform);
            Destroy(artChargeEffect, buff_duration / 10f);

            GameObject artChargeFlash = Instantiate(HeroController.instance.artChargedFlash, HeroController.instance.transform.position, Quaternion.identity);

            artChargeFlash.SetActive(true);
            artChargeFlash.transform.SetParent(HeroController.instance.transform);
            Destroy(artChargeFlash, 0.5f);

            GameObject dJumpFlash = Instantiate(HeroController.instance.dJumpFlashPrefab, HeroController.instance.transform.position, Quaternion.identity);

            dJumpFlash.SetActive(true);
            dJumpFlash.transform.SetParent(HeroController.instance.transform);
            Destroy(dJumpFlash, 0.5f);

            yield return(null);
        }