public void spellDam(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance) { if (hitInstance.AttackType == AttackTypes.Spell && hitInstance.Source.name.StartsWith("bullet")) { Log("Bullet impact with name " + hitInstance.Source.name); BulletBehavior b = fireball.GetComponent <BulletBehavior>(); if (!b.enemyHit()) { return; } if (self.IsBlockingByDirection( DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(self.transform)), hitInstance.AttackType)) { orig(self, hitInstance); return; } hitEnemy(self, b.bulletType.Damage, hitInstance, b.bulletType.SoulGain); } else { orig(self, hitInstance); } }
private void HealthManagerOnHit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitinstance) { // Mutex lock checking. if (newhealth.runningNewHMOH) { orig(self, hitinstance); return; } newhealth nh = self.gameObject.GetComponent <newhealth>(); if (nh == null) { Redwing.Knight.Log("ERROR: No new healthmanager found on enemy with health manager " + self.gameObject.name); Redwing.Knight.Log("Please report to the mod author. Also adding one now..."); self.gameObject.GetOrAddComponent <newhealth>(); orig(self, hitinstance); return; } bool b = nh.trueTakeDamage(((double)hitinstance.DamageDealt) * hitinstance.Multiplier, (int)hitinstance.AttackType, hitinstance, true); if (b) // make enemy immune { nh.trueImmortalityTimer = 0.2f; } else if (nh.trueImmortalityTimer <= 0f) // enemy blocked and wasn't immune { nh.trueImmortalityTimer = 0.15f; } if (nh.trueHealth <= 0) { enemyHealths.Remove(nh); } }
private void HealthManager_Hit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance) { if (self.name.Contains("zomb") && !isHit) { isHit = true; StartCoroutine(OnHit()); } orig(self, hitInstance); }
private static void HealthManager_Hit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance) { if (self is HealthManagerProxy) { var proxy = (HealthManagerProxy)self; proxy.weaverHealth.Hit(Misc.ConvertHitInstance(hitInstance)); } else { orig(self, hitInstance); } }
private void HealthManagerOnHit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitinstance) { if (isBerserk) { hitinstance.DamageDealt = 10; } else { return; } orig(self, hitinstance); }
//Intercepts HealthManager's Hit method and allows me to override it with my own calculation public void HealthManager_HitHook(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance) { //Alternative hit damages from other sources like weaver or explosions string srcName = hitInstance.Source.name; Log("[DamageOverride] Source Name is " + srcName); if (srcName.Contains("Gas")) { //Explosion damage hitInstance.DamageDealt = 15 + (PlayerData.instance.nailSmithUpgrades * 5); orig(self, hitInstance); return; } else if (srcName.Contains("Damager")) { //Glowing Womblings HeroController.instance.AddMPCharge(15); orig(self, hitInstance); return; } else if (srcName.Contains("Slash")) { Log("Player is slashing!"); hitInstance.DamageDealt = 2 + (PlayerData.instance.nailSmithUpgrades * 2); orig(self, hitInstance); return; } else if (!srcName.Contains("bullet")) { orig(self, hitInstance); return; } BulletBehaviour hpbb = hitInstance.Source.GetComponent <BulletBehaviour>(); Vector3 bulletOriginPosition = hitInstance.Source.GetComponent <BulletBehaviour>().bulletOriginPosition; int cardinalDirection = DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(self.transform)); int damage = Stats.CalculateDamage(bulletOriginPosition, self.transform.position, hpbb); int soulGainAmt = Stats.CalculateSoulGain(); //Log("DamageCalculator, damage dealt is " + damage + " against " + self.name); StartCoroutine(SplatterBlood(self.gameObject, 1, cardinalDirection * 90)); HealthManagerOverride.HitEnemy(self, damage, BulletBehaviour.bulletDummyHitInstance, soulGainAmt, hpbb); }
//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)); }
private void OnHit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitinstance) { if (self.name.Contains("Shade")) { if (!_attacking) { _attacking = true; //float offset = FaceHero(); Vector2 tmp = _target.transform.position; Vector2 pos = new Vector2(tmp.x + side * 8.5f, tmp.y); Teleport(pos, 20f); } _hitShade = true; if (_life < 0) { _control.SetState("Killed"); } _life--; hitinstance.Multiplier = 0; } orig(self, hitinstance); }
//Intercepts HealthManager's Hit method and allows me to override it with my own calculation public void HealthManager_HitHook(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance) { //Alternative hit damages from other sources like weaver or explosions string srcName = hitInstance.Source.name; if (srcName.Contains("Gas")) { //Explosion damage hitInstance.DamageDealt = 3 + (PlayerData.instance.nailSmithUpgrades * 5); orig(self, hitInstance); return; } if (srcName.Contains("Dung")) { //Explosion damage Log("Dung damage!"); orig(self, hitInstance); return; } else if (srcName.Contains("Damager")) { //Glowing Womblings //HeroController.instance.AddMPCharge(15); orig(self, hitInstance); return; } else if (srcName.Contains("Great Slash") || srcName.Contains("Dash Slash")) { Log("Player is nail art... ing?"); orig(self, hitInstance); return; } else if (srcName.Contains("Slash")) { Log("Player is slashing!"); hitInstance.DamageDealt = 3 + (PlayerData.instance.nailSmithUpgrades * 3); orig(self, hitInstance); return; } else if (!srcName.Contains("bullet")) { orig(self, hitInstance); return; } BulletBehaviour hpbb = hitInstance.Source.GetComponent <BulletBehaviour>(); Vector3 bulletOriginPosition = hitInstance.Source.GetComponent <BulletBehaviour>().bulletOriginPosition; int cardinalDirection = DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(self.transform)); int damage = hpbb.bulletDamage + (PlayerData.instance.nailSmithUpgrades * hpbb.bulletDamageScale); int soulGainAmt = Stats.SoulGainPerHit(); //StartCoroutine(SplatterBlood(self.gameObject.transform.position, 1, cardinalDirection * 90)); if (hpbb.appliesDamageOvertime) { EnemyDamageOvertime edo = self.gameObject.GetComponent <EnemyDamageOvertime>(); if (edo == null) { self.gameObject.AddComponent <EnemyDamageOvertime>(); } else { edo.IncreaseStack(); } } DamageEnemyOverride(self, damage, BulletBehaviour.bulletDummyHitInstance, soulGainAmt, hpbb); }