Esempio n. 1
0
        private IEnumerator dealFireDamage()
        {
            while (cachedEnemyHM.hp > 0)
            {
                if (napalmStrength >= 1.0)
                {
                    //Modding.Logger.Log("Doing " + calculateNapalmDamage() + " napalm dmg to " + gameObject.name);
                    napalmStrength = napalmStrength * 0.95 - 1.0;
                    setNapalmParts();

                    if (!gng_bindings.hasSpellBinding())
                    {
                        cachedEnemyHM.hp -= calculateNapalmDamage();
                        if (cachedEnemyHM.hp <= 0)
                        {
                            cachedEnemyHM.Die(0f, AttackTypes.Generic, true);
                            DestroyImmediate(fireGenerator);
                        }
                    }
                }
                else
                {
                    fieryParticleRenderer.material.color = Color.clear;
                }

                yield return(new WaitForSeconds((float)Math.Pow(Math.E, -0.05 * napalmStrength) + 0.05f));
            }

            DestroyImmediate(fireGenerator);
        }
Esempio n. 2
0
    IEnumerator TimerFinished()
    {
        HealthManager healthManager = GetComponent <HealthManager>();

        healthManager.Die();
        yield return(new WaitForSeconds(secondDuration));
    }
Esempio n. 3
0
    private void OnCollisionEnter(Collision collision)
    {
        HealthManager healthManager = collision.gameObject.GetComponent <HealthManager>();

        if (healthManager == null)
        {
            return;
        }

        healthManager.Die();
    }
Esempio n. 4
0
        public bool trueTakeDamage(double trueDamage, int damageType, HitInstance ogHit, bool standardAttack)
        {
            if (trueImmortalityTimer > 0 && standardAttack)
            {
                Redwing.Knight.Log("Enemy immortal so no damage");
                return(false);
            }

            AttackTypes at;

            if (damageType < 8 && damageType > 0)
            {
                at = (AttackTypes)damageType;
            }
            else
            {
                at = AttackTypes.Spell;
            }

            bool invuln = connectedHM.IsBlockingByDirection((int)ogHit.Direction, at);

            if (invuln && !ogHit.IgnoreInvulnerable)
            {
                return(false);
            }
            Redwing.Knight.Log("Dealing " + trueDamage + " to enemy: " + gameObject.name + " via new health mgr");
            Redwing.Knight.Log("HP before dmg is " + trueHealth);
            Redwing.Knight.Log("trueImmortalityTimer is " + trueImmortalityTimer);
            trueHealth -= trueDamage;
            if (trueHealth <= 0)
            {
                connectedHM.Die(ogHit.Direction, at, true);
                return(true);
            }

            if (connectedHM.hp > (int)(trueHealth + 1.0) && damageTakenTimer < 0f)
            {
                ogHit.DamageDealt = (int)(connectedHM.hp - trueHealth);
                // Mutex locking.
                runningNewHMOH = true;
                connectedHM.Hit(ogHit);
                runningNewHMOH   = false;
                damageTakenTimer = 0.2f;
            }
            // In this special case the user actually healed the target.
            else if (connectedHM.hp < (int)(trueHealth))
            {
                connectedHM.hp = (int)trueHealth;
            }



            return(true);
        }
Esempio n. 5
0
        public static void EnemyDeathEvent(HealthManager hm, float deathDirection, bool playDeathFromBulletSound)
        {
            if (playDeathFromBulletSound)
            {
                AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.EnemyKillSFXGO);
            }

            hm.Die(deathDirection * 90, AttackTypes.Spell, true);
            HeroController.instance.AddMPCharge(Stats.instance.AddSoulOnEnemyKill());
            Stats.instance.IncreaseAdrenalineChargeEnergy();
            //GameManager.instance.FreezeMoment(1);
            //Log("Spawning Weavers");
            //GameObject weaverPrefab = HollowPointPrefabs.prefabDictionary["Weaverling"];
            //GameObject weaverClone = Instantiate(weaverPrefab, HeroController.instance.transform.position, Quaternion.identity);
            //Destroy(weaverClone, 10f);
        }
Esempio n. 6
0
 public override void OnPaint()
 {
     if (GUI.Button(new Rect(0, 32, Rect.width, 32), "获取玩家对象"))
     {
         WGameObjectList.gameObjects.Push(HeroController.instance.gameObject);
     }
     if (GUI.Button(new Rect(0, 64, Rect.width, 32), "速度+0.5"))
     {
         DebugScript.DebugTimeSpeed += 0.5f;
     }
     if (GUI.Button(new Rect(0, 96, Rect.width, 32), "速度-0.5"))
     {
         DebugScript.DebugTimeSpeed -= 0.5f;
     }
     if (GUI.Button(new Rect(0, 128, Rect.width, 32), "停止"))
     {
         DebugScript.DebugTimeSpeed = 0;
     }
     if (GUI.Button(new Rect(0, 160, Rect.width, 32), "正常速度"))
     {
         DebugScript.DebugTimeSpeed = 1;
     }
     if (GUI.Button(new Rect(0, 192, Rect.width, 32), "杀死所有敌人"))
     {
         GameObject[] gameObjects = UnityEngine.Object.FindObjectsOfType <GameObject>();
         foreach (var v in gameObjects)
         {
             HealthManager healthManager = v.GetComponent <HealthManager>();
             if (healthManager != null)
             {
                 healthManager.hp = 0;
                 healthManager.Hit(new HitInstance()
                 {
                     AttackType  = AttackTypes.Generic,
                     DamageDealt = 10000,
                     Source      = HeroController.instance.gameObject
                 });
                 healthManager.Die(0, AttackTypes.Generic, true);
             }
         }
     }
     if (GUI.Button(new Rect(0, 224, Rect.width, 32),
                    Physics2D.showColliderAABB ? "隐藏碰撞箱":"显示碰撞箱"))
     {
         Physics2D.showColliderAABB = !Physics2D.showColliderAABB;
     }
 }
Esempio n. 7
0
        // This function does damage to the enemy using the damage numbers given by the weapon type
        public static void HitEnemy(HealthManager targetHP, int expectedDamage, HitInstance hitInstance, int soulGain)
        {
            int realDamage = expectedDamage;

            //TODO: this specifics might add up later, Moss Charger is just one of the few except and there maybe many more
            int        cardinalDirection = DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(targetHP.transform));
            GameObject blockHitPrefab    = targetHP.GetAttr <GameObject>("blockHitPrefab");

            bool specialEnemy = (targetHP.name.Contains("Charger"));

            if (targetHP.IsBlockingByDirection(cardinalDirection, AttackTypes.Nail) && !specialEnemy || realDamage <= 0)
            {
                FSMUtility.SendEventToGameObject(targetHP.gameObject, "BLOCKED HIT", false);
                GameObject blockHit = blockHitPrefab.Spawn();
                blockHit.transform.position = targetHP.transform.position;
                blockHit.transform.Rotate(new Vector3(0, 0, 90 * cardinalDirection));
                return;
            }



            //bool specialEnemy = (targetHP.name.Contains("Moss Charger") || targetHP.name.Contains("Mushroom Brawler"));

            //if (targetHP.IsInvincible && !specialEnemy && !PlayerData.instance.equippedCharm_25)
            //{
            //    GameObject blockHit = blockHitPrefab.Spawn();
            //    blockHit.transform.position = targetHP.transform.position;
            //   return;
            //}

            if (targetHP.gameObject.name.Contains("Blocker"))
            {
                realDamage = realDamage * 4;
            }

            Recoil recoil = targetHP.gameObject.GetComponent <Recoil>();

            if (recoil != null && PlayerData.instance.equippedCharm_15)
            {
                recoil.RecoilByDirection(cardinalDirection, 0.8f);
            }

            if (realDamage <= 0)
            {
                return;
            }

            if (targetHP == null)
            {
                return;
            }

            /*
             * Play animations and such...
             * Mostly code copied from the healthmanager class itself.
             */

            //Modding.Logger.Log("Cardinal is " + cardinalDirection);
            FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false);
            GameObject sendHitGO = targetHP.GetAttr <GameObject>("sendHitGO");

            if (sendHitGO != null)
            {
                FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false);
            }

            GameObject HitPrefab    = targetHP.GetAttr <GameObject>("strikeNailPrefab");
            GameObject ImpactPrefab = targetHP.GetAttr <GameObject>("slashImpactPrefab");
            Vector3?   effectOrigin = targetHP.GetAttr <Vector3?>("effectOrigin");

            if (HitPrefab != null && effectOrigin != null)
            {
                HitPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f);
            }
            if (ImpactPrefab != null && effectOrigin != null)
            {
                ImpactPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f);
            }

            FSMUtility.SendEventToGameObject(targetHP.gameObject, "TOOK DAMAGE", false);
            FSMUtility.SendEventToGameObject(targetHP.gameObject, "TAKE DAMAGE", false);

            FSMUtility.SendEventToGameObject(hitInstance.Source, "HIT LANDED", false);
            FSMUtility.SendEventToGameObject(hitInstance.Source, "DEALT DAMAGE", false);


            // Actually do damage to target.
            try
            {
                //TODO: change this audio source
                //HeroController.instance.spellControl.gameObject.GetComponent<AudioSource>().PlayOneShot(LoadAssets.enemyHurtSFX[soundRandom.Next(0, 2)]);
                LoadAssets.sfxDictionary.TryGetValue("enemyhurt" + soundRandom.Next(1, 4) + ".wav", out AudioClip ac);
                HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(ac);
            }
            catch (Exception e)
            {
                Modding.Logger.Log("Enemy Hurt Exception Thrown " + e);
            }

            if (targetHP.damageOverride)
            {
                targetHP.hp -= 1;
            }
            else
            {
                targetHP.hp -= realDamage; // the actual damage
                HeroController.instance.AddMPCharge(soulGain);
            }

            // Trigger Kill animation
            if (targetHP.hp <= 0f)
            {
                LoadAssets.sfxDictionary.TryGetValue("enemydead" + soundRandom.Next(1, 4) + ".wav", out AudioClip ac);
                HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(ac);
                targetHP.Die(cardinalDirection * 90, AttackTypes.Spell, true);
                HeroController.instance.AddMPCharge(3);
                return;
            }


            bool?  hasAlternateHitAnimation = targetHP.GetAttr <bool?>("hasAlternateHitAnimation");
            string alternateHitAnimation    = targetHP.GetAttr <string>("alternateHitAnimation");

            if (hasAlternateHitAnimation != null && (bool)hasAlternateHitAnimation && targetHP.GetComponent <tk2dSpriteAnimator>() && alternateHitAnimation != null)
            {
                targetHP.GetComponent <tk2dSpriteAnimator>().Play(alternateHitAnimation);
            }


            PlayMakerFSM stunControlFSM = targetHP.gameObject.GetComponents <PlayMakerFSM>().FirstOrDefault(component =>
                                                                                                            component.FsmName == "Stun Control" || component.FsmName == "Stun");

            if (stunControlFSM != null)
            {
                //stunControlFSM.SendEvent("STUN DAMAGE");
            }

            /*
             * Uncomment below for a sick looking enter the gungeon style freeze frame or for camera shake.
             */
            //GameManager.instance.FreezeMoment(1);
            //GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            SpriteFlash f = targetHP.gameObject.GetComponent <SpriteFlash>();

            if (f != null)
            {
                f.flashInfected();
            }
        }
Esempio n. 8
0
        // This function does damage to the enemy using the damage numbers given by the weapon type
        public static void HitEnemy(HealthManager targetHP, int damageDealt, HitInstance hitInstance, int soulGain, BulletBehaviour hpbb)
        {
            //TODO: this specifics might add up later, Moss Charger is just one of the few except and there maybe many more
            if (targetHP == null)
            {
                return;
            }

            int        cardinalDirection = DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(targetHP.transform));
            GameObject blockHitPrefab    = targetHP.GetAttr <GameObject>("blockHitPrefab");

            bool specialEnemy = (targetHP.name.Contains("Charger"));

            if (targetHP.IsBlockingByDirection(cardinalDirection, AttackTypes.Nail) && !specialEnemy || damageDealt <= 0)
            {
                FSMUtility.SendEventToGameObject(targetHP.gameObject, "BLOCKED HIT", false);
                GameObject blockHit = blockHitPrefab.Spawn();
                blockHit.transform.position = targetHP.transform.position;
                blockHit.transform.Rotate(new Vector3(0, 0, 90 * cardinalDirection));
                return;
            }

            if (damageDealt <= 0)
            {
                return;
            }
            //bool specialEnemy = (targetHP.name.Contains("Moss Charger") || targetHP.name.Contains("Mushroom Brawler"));

            /*
             * if (targetHP.IsInvincible && !specialEnemy && !PlayerData.instance.equippedCharm_25)
             * {
             *  GameObject blockHit = blockHitPrefab.Spawn();
             *  blockHit.transform.position = targetHP.transform.position;
             * return;
             * }
             */

            if (targetHP.gameObject.name.Contains("Blocker")) //double damage baldurs
            {
                damageDealt = damageDealt * 4;
            }

            Recoil recoil = targetHP.gameObject.GetComponent <Recoil>();

            //if (recoil != null && PlayerData.instance.equippedCharm_15)
            if (recoil != null)
            {
                recoil.RecoilByDirection(cardinalDirection, 0.25f);
            }

            /*
             * Mostly code copied from the healthmanager class itself.
             */

            FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false);
            GameObject sendHitGO = targetHP.GetAttr <GameObject>("sendHitGO");

            if (sendHitGO != null)
            {
                FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false);
            }

            GameObject HitPrefab    = targetHP.GetAttr <GameObject>("strikeNailPrefab");
            GameObject ImpactPrefab = targetHP.GetAttr <GameObject>("slashImpactPrefab");
            Vector3?   effectOrigin = targetHP.GetAttr <Vector3?>("effectOrigin");

            if (HitPrefab != null && effectOrigin != null)
            {
                HitPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f);
            }
            if (ImpactPrefab != null && effectOrigin != null)
            {
                ImpactPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f);
            }

            SpriteFlash f = targetHP.gameObject.GetComponent <SpriteFlash>();

            if (f != null)
            {
                f.flashWhiteQuick();
            }

            //Log("SEVERITY: " + ds + " DAMAGE: " + damageDealt);

            FSMUtility.SendEventToGameObject(targetHP.gameObject, "TOOK DAMAGE", false);
            FSMUtility.SendEventToGameObject(targetHP.gameObject, "TAKE DAMAGE", false);

            FSMUtility.SendEventToGameObject(hitInstance.Source, "HIT LANDED", false);
            FSMUtility.SendEventToGameObject(hitInstance.Source, "DEALT DAMAGE", false);

            // Actually do damage to target.

            LoadAssets.sfxDictionary.TryGetValue("enemyhurt" + soundRandom.Next(1, 4) + ".wav", out AudioClip hurtSound);
            HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(hurtSound);

            if (targetHP.damageOverride)
            {
                targetHP.hp -= 1;
            }
            else
            {
                targetHP.hp -= damageDealt; // the actual damage

                //int sg = (ds.Equals(DamageSeverity.Minor)) ? 0 : soulGain;
                HeroController.instance.AddMPCharge(6);
                Stats.IncreaseAdrenalinePoints(damageDealt);
            }

            // Trigger Kill animation
            if (targetHP.hp <= 0f)
            {
                LoadAssets.sfxDictionary.TryGetValue("enemydead" + soundRandom.Next(1, 4) + ".wav", out AudioClip deadSound);
                HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(deadSound);
                targetHP.Die(cardinalDirection * 90, AttackTypes.Spell, true);
                HeroController.instance.AddMPCharge(4);
                GameManager.instance.FreezeMoment(1);
                return;
            }

            bool?  hasAlternateHitAnimation = targetHP.GetAttr <bool?>("hasAlternateHitAnimation");
            string alternateHitAnimation    = targetHP.GetAttr <string>("alternateHitAnimation");

            if (hasAlternateHitAnimation != null && (bool)hasAlternateHitAnimation && targetHP.GetComponent <tk2dSpriteAnimator>() && alternateHitAnimation != null)
            {
                targetHP.GetComponent <tk2dSpriteAnimator>().Play(alternateHitAnimation);
            }


            PlayMakerFSM stunControlFSM = targetHP.gameObject.GetComponents <PlayMakerFSM>().FirstOrDefault(component =>
                                                                                                            component.FsmName == "Stun Control" || component.FsmName == "Stun");

            if (stunControlFSM != null)
            {
                //stunControlFSM.SendEvent("STUN DAMAGE");
            }

            /*
             * Uncomment below for a sick looking enter the gungeon style freeze frame or for camera shake.
             */
        }
 public void Die()
 {
     _healthManager.Die();
 }
Esempio n. 10
0
    // Update is called once per frame
    private void FixedUpdate()
    {
        //Custom drag koska rigidbodyn drag on kakka
        Vector2 vel = m_body.velocity;

        vel.y *= 1.0f - DragY;
        vel.x *= 1.0f - DragX;

        if (!m_bOnLadder)
        {
            m_body.velocity = vel;
        }

        //Jos olen kuollut tai kohteeni on kuollut, lopeta
        if (m_myHealthManager.IsDead)
        {
            m_animator.SetBool("aim", false);
            m_animator.SetBool("shoot", false);
            m_animator.SetBool("run", false);

            return;
        }

        if (IsOnGround())
        {
            m_bJumping = false;
        }

        Vector2 vecAdditionVelocity = Vector2.zero;

        if (!m_bOnLadder)
        {
            if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
            {
                if (!m_animator.GetBool("aim"))
                {
                    vecAdditionVelocity.x = -Acceleration;
                }

                m_playerRenderer.flipX = true;
            }
            else if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D))
            {
                if (!m_animator.GetBool("aim"))
                {
                    vecAdditionVelocity.x = Acceleration;
                }

                m_playerRenderer.flipX = false;
            }

            if (Input.GetKey(KeyCode.Mouse0) || Input.GetKey(KeyCode.LeftControl))
            {
                m_animator.SetBool("aim", true);
                m_animator.SetBool("shoot", true);
            }
            else
            {
                m_animator.SetBool("shoot", m_animator.GetBool("aim") && Input.GetKey(KeyCode.Mouse0));
                m_animator.SetBool("aim", Input.GetKey(KeyCode.Mouse1));
            }
        }

        m_animator.SetBool("run", Mathf.Abs(vecAdditionVelocity.x) > 0.0);

        if (m_bOnLadder)
        {
            if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
            {
                Vector2 newPos = m_body.transform.position;
                newPos.y += 10.0f * Time.fixedDeltaTime;

                m_body.MovePosition(newPos);
            }

            if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
            {
                Vector2 newPos = m_body.transform.position;
                newPos.y -= 10.0f * Time.fixedDeltaTime;

                m_body.MovePosition(newPos);
            }

            if (!TouchingLadder || Input.GetKey(KeyCode.Space))
            {
                DismountLadder();
            }
        }

        if (!DidJustJump() && IsOnGround() && Input.GetKey(KeyCode.Space))
        {
            vecAdditionVelocity.y = m_body.velocity.y + Jump;
            m_bJumping            = true;
        }

        //Tippui ulos levelistä
        if (transform.position.y < -5f)
        {
            m_myHealthManager.Die(gameObject);
        }

        if (!m_bOnLadder)
        {
            FinalCollisionCheck(vecAdditionVelocity);
        }
    }
Esempio n. 11
0
        public static void applyHitInstance(GameObject target, int expectedDamage, GameObject source, float flameGain)
        {
            int realDamage = expectedDamage;

            double multiplier = 1;

            if (PlayerData.instance.GetBool("equippedCharm_25"))
            {
                multiplier *= 1.5;
            }
            if (PlayerData.instance.GetBool("equippedCharm_6") && PlayerData.instance.GetInt("health") == 1)
            {
                multiplier *= 1.75f;
            }

            if (gng_bindings.hasNailBinding())
            {
                multiplier *= 0.3;
            }

            realDamage = (int)Math.Round(realDamage * multiplier);

            if (realDamage <= 0)
            {
                return;
            }

            HealthManager targetHP = getHealthManagerRecursive(target);

            if (targetHP == null)
            {
                return;
            }

            if (GameManager.instance.GetComponent <rebalanced_hooks>() != null)
            {
                GameManager.instance.GetComponent <rebalanced_hooks>().flamePower += flameGain;
            }

            //Modding.Logger.Log("[Redwing] Doing " + realDamage + " damage with attack name " + source.name);

            targetHP.hp -= realDamage;

            if (targetHP.hp <= 0f)
            {
                targetHP.Die(0f, AttackTypes.Nail, true);
                return;
            }

            FSMUtility.SendEventToGameObject(targetHP.gameObject, "BLOCKED HIT", false);

            FSMUtility.SendEventToGameObject(source, "HIT LANDED", false);
            if ((Object)targetHP.gameObject.GetComponent <DontClinkGates>() != (Object)null)
            {
                return;
            }

            FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false);
            GameManager.instance.FreezeMoment(1);
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");

            napalm memes = targetHP.gameObject.GetOrAddComponent <napalm>();

            memes.addNapalm(realDamage * (0.10), Color.green);

            /*
             * targetHP.Hit(new HitInstance
             * {
             *  Source = source,
             *  AttackType = damageType,
             *  CircleDirection = false,
             *  DamageDealt = realDamage,
             *  Direction = 0f,
             *  IgnoreInvulnerable = true,
             *  MagnitudeMultiplier = 1f,
             *  MoveAngle = 0f,
             *  MoveDirection = false,
             *  Multiplier = 1f,
             *  SpecialType = SpecialTypes.None,
             *  IsExtraDamage = false
             * });*/
        }
Esempio n. 12
0
        private void Update()
        {
            if (playerDieTimeout > 0 && didDie)
            {
                playerDieTimeout--;
                if (playerDieTimeout != 0)
                {
                    return;
                }
                StartCoroutine(infinite_globals.playerDies(damageDone));
                didDie = false;
            }

            if (!runningIG)
            {
                return;
            }

            // Infinite code.
            if (hm.hp != defaultHealth)
            {
                damageDone += (defaultHealth - hm.hp);
                hm.hp       = defaultHealth;

                HeroController.instance.geoCounter.geoTextMesh.text = "" + damageDone;
                HeroController.instance.geoCounter.UpdateGeo(); // idek if this does something
            }

            if (memeBullshitHealthManager.hp != defaultHealth)
            {
                damageDone += (defaultHealth - memeBullshitHealthManager.hp);
                memeBullshitHealthManager.hp = defaultHealth;

                HeroController.instance.geoCounter.geoTextMesh.text = "" + damageDone;
                HeroController.instance.geoCounter.UpdateGeo(); // idek if this does something
            }

            if (PlayerData.instance.health <= 0)
            {
                didDie           = true;
                runningIG        = false;
                playerDieTimeout = 300;

                grimmAnim.GetClipByName("Tele In").fps       = teleinFPS;
                grimmAnim.GetClipByName("Tele Out").fps      = teleoutFPS;
                grimmAnim.GetClipByName("Uppercut End").fps  = uppercutendFPS;
                grimmAnim.GetClipByName("Slash Recover").fps = slashrecoverFPS;
                grimmAnim.GetClipByName("Evade End").fps     = evadeendFPS;
                grimmAnim.GetClipByName("Spike Up").fps      = spikesFPS;

                infinite_tent.damageDone = damageDone;

                infinite_globals.log("Cleaned up NGG fight.");
            }

            // This is some incredibly sketchy code. Basically it waits a little before spawning grimmchild
            // But not just any grimmchild, a random copied grimmchild from the last level.
            // Not exactly elegant but it works.
            if (grimmchildFrameCounter > 0)
            {
                grimmchildFrameCounter--;

                if (grimmchildFrameCounter == 0)
                {
                    if (PlayerData.instance.GetBoolInternal("equippedCharm_40"))
                    {
                        infinite_globals.log("Spawning grimmchild in grimm arena.");
                        PlayMakerFSM gcControl = FSMUtility.LocateFSM(infinite_tent.grimmchild, "Control");
                        infinite_tent.grimmchild.SetActive(true);
                        FsmState starting = gcControl.getState("Pause");
                        starting.removeActionsOfType <BoolTest>();
                        starting.clearTransitions();
                        starting.addTransition("FINISHED", "Spawn");
                        starting.addTransition("AWOKEN", "Spawn");
                    }
                }
            }
            if (infinite_globals.hardmode)
            {
                return;
            }
            doNextPhase();


            if (damageDone >= 3200 && infinite_globals.nggDies)
            {
                runningIG = false;
                hm.hp     = -100;
                hm.Die(0f, AttackTypes.Generic, true);
                runningIG        = false;
                playerDieTimeout = 300;

                grimmAnim.GetClipByName("Tele In").fps       = teleinFPS;
                grimmAnim.GetClipByName("Tele Out").fps      = teleoutFPS;
                grimmAnim.GetClipByName("Uppercut End").fps  = uppercutendFPS;
                grimmAnim.GetClipByName("Slash Recover").fps = slashrecoverFPS;
                grimmAnim.GetClipByName("Evade End").fps     = evadeendFPS;
                grimmAnim.GetClipByName("Spike Up").fps      = spikesFPS;

                infinite_tent.damageDone = 3200;

                infinite_globals.log("Cleaned up NGG fight.");
                Destroy(memeBullshitGrimm);

                //StartCoroutine(killPlayer());
            }
        }
Esempio n. 13
0
 public void KillPlayer()
 {
     StartCoroutine(playerHealth.Die());
 }
Esempio n. 14
0
        // This function does damage to the enemy using the damage numbers given by the weapon type
        public static void hitEnemy(HealthManager targetHP, int expectedDamage, HitInstance hitInstance, int soulGain)
        {
            int realDamage = expectedDamage;

            // TODO: Add possible optional damage multiplier information below.

            /*
             * double multiplier = 1;
             * if (PlayerData.instance.GetBool("equippedCharm_25"))
             * {
             *  multiplier *= 1.5;
             * }
             * if (PlayerData.instance.GetBool("equippedCharm_6") && PlayerData.instance.GetInt("health") == 1)
             * {
             *  multiplier *= 1.75f;
             * }
             *
             * if (gng_bindings.hasNailBinding())
             * {
             *  multiplier *= 0.3;
             * }
             * realDamage = (int) Math.Round(realDamage * multiplier);
             *
             */

            if (realDamage <= 0)
            {
                return;
            }

            if (targetHP == null)
            {
                return;
            }


            /*
             * Play animations and such...
             * Mostly code copied from the healthmanager class itself.
             */

            int cardinalDirection =
                DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(targetHP.transform));

            FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false);


            GameObject sendHitGO = targetHP.GetAttr <GameObject>("sendHitGO");

            if (sendHitGO != null)
            {
                Log("Wow I did reflection correctly");
                FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false);
            }

            GameObject fireballHitPrefab = targetHP.GetAttr <GameObject>("fireballHitPrefab");
            Vector3?   effectOrigin      = targetHP.GetAttr <Vector3?>("effectOrigin");

            if (fireballHitPrefab != null && effectOrigin != null)
            {
                Log("Wow I did reflection correctly x2");
                fireballHitPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f);
            }


            FSMUtility.SendEventToGameObject(targetHP.gameObject, "TOOK DAMAGE", false);

            if ((UnityEngine.Object)targetHP.GetComponent <Recoil>() != (UnityEngine.Object)null)
            {
                targetHP.GetComponent <Recoil>().RecoilByDirection(cardinalDirection, hitInstance.MagnitudeMultiplier);
            }

            FSMUtility.SendEventToGameObject(hitInstance.Source, "HIT LANDED", false);
            FSMUtility.SendEventToGameObject(hitInstance.Source, "DEALT DAMAGE", false);



            // Actually do damage to target.
            if (targetHP.damageOverride)
            {
                targetHP.hp -= 1;
            }
            else
            {
                targetHP.hp -= realDamage;
                HeroController.instance.AddMPCharge(soulGain);
            }

            // Trigger Kill animation
            if (targetHP.hp <= 0f)
            {
                targetHP.Die(0f, AttackTypes.Nail, true);
                return;
            }

            bool?  hasAlternateHitAnimation = targetHP.GetAttr <bool?>("hasAlternateHitAnimation");
            string alternateHitAnimation    = targetHP.GetAttr <string>("alternateHitAnimation");

            if (hasAlternateHitAnimation != null && (bool)hasAlternateHitAnimation && targetHP.GetComponent <tk2dSpriteAnimator>() && alternateHitAnimation != null)
            {
                Log("Wow I did reflection correctly x3");
                targetHP.GetComponent <tk2dSpriteAnimator>().Play(alternateHitAnimation);
            }

            PlayMakerFSM stunControlFSM = targetHP.gameObject.GetComponents <PlayMakerFSM>().FirstOrDefault(component =>
                                                                                                            component.FsmName == "Stun Control" || component.FsmName == "Stun");

            if (stunControlFSM != null)
            {
                stunControlFSM.SendEvent("STUN DAMAGE");
            }

            /*
             * Uncomment below for a sick looking enter the gungeon style freeze frame or for camera shake.
             */

            //GameManager.instance.FreezeMoment(1);
            //GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
        }