private void ModifyHP(HealthHaver hp) { float startMax = hp.GetMaxHealth(); hp.SetHealthMaximum(startMax * 0.25f); hp.ForceSetCurrentHealth(startMax * 0.25f); }
private void OnKilledEnemy(PlayerController player, HealthHaver enemy) { if (gun && player && enemy && player.PlayerHasActiveSynergy("Fully Funded")) { if (player.CurrentGun.PickupObjectId == 476 && enemy.GetMaxHealth() >= 10) { //ETGModConsole.Log("Spawned bonus"); LootEngine.SpawnCurrency(enemy.specRigidbody.UnitCenter, 1, false); } } }
private void ModifyIncomingDamage(HealthHaver source, HealthHaver.ModifyDamageEventArgs args) { PlayableCharacters characterIdentity = Owner.characterIdentity; if (characterIdentity != PlayableCharacters.Robot) { if (source.Armor <= 0f) { if (args.ModifiedDamage >= source.GetCurrentHealth()) { if (source.GetMaxHealth() > 1f) { if (args.ModifiedDamage != 0) { if (source.IsVulnerable == true) { AkSoundEngine.PostEvent("Play_CHR_major_damage_01", base.gameObject); args.ModifiedDamage = 0f; StatModifier hpdown = new StatModifier(); hpdown.statToBoost = PlayerStats.StatType.Health; hpdown.amount = -1; hpdown.modifyType = StatModifier.ModifyMethod.ADDITIVE; Owner.ownerlessStatModifiers.Add(hpdown); Owner.stats.RecalculateStats(Owner, false, false); Owner.healthHaver.TriggerInvulnerabilityPeriod(); if (this.m_owner.PlayerHasActiveSynergy("Terrible Person")) { Owner.healthHaver.ApplyHealing(0.5f); } } } } } } } else { int bighead = UnityEngine.Random.Range(1, 8); if (bighead == 1) { args.ModifiedDamage = 0f; Owner.healthHaver.TriggerInvulnerabilityPeriod(); } } }
public void SpawnNewTurtle() { string guid = PickupObjectDatabase.GetById(645).GetComponent <MulticompanionItem>().CompanionGuid; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); Vector3 vector = player.transform.position; GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject, vector, Quaternion.identity); CompanionController orAddComponent = gameObject.GetOrAddComponent <CompanionController>(); this.activeTurtles.Add(gameObject); orAddComponent.Initialize(player); if (orAddComponent.specRigidbody) { PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(orAddComponent.specRigidbody, null, false); } HealthHaver helf = gameObject.GetComponent <HealthHaver>(); if (helf != null) { float helfNew = helf.GetMaxHealth() * 3f; helf.SetHealthMaximum(helfNew); helf.ForceSetCurrentHealth(helfNew); } }
private void ModifyDamage(HealthHaver player, HealthHaver.ModifyDamageEventArgs args) { if (player.gameActor is PlayerController) { PlayerController playerCont = player.gameActor as PlayerController; if (playerCont.characterIdentity == PlayableCharacters.Robot) { if (UnityEngine.Random.value <= 0.25f) { args.ModifiedDamage = 0; HandleRemoveHeart(); } } else { if (playerCont.NextHitWillKillPlayer(args.InitialDamage)) { if (player.GetCurrentHealth() > 0.5f) { args.ModifiedDamage = 0.5f; } else if ((player.GetCurrentHealth() == 0.5f && player.Armor == 0) || (player.GetCurrentHealth() == 0f && player.Armor == 1)) { if (player.GetMaxHealth() > 1) { args.ModifiedDamage = 0; HandleRemoveHeart(); } } } } if (playerCont.PlayerHasActiveSynergy("Oil Can What?") && UnityEngine.Random.value <= 0.1f) { args.ModifiedDamage = 0; } } }
private void OnDealtDamage(PlayerController player, float amount, bool fatal, HealthHaver target) { if (!fatal) { return; } xp += (int)target.GetMaxHealth(); if (xp >= xpToLevel) { int levels = xp / (int)xpToLevel; xp %= (int)xpToLevel; levelsToSpend += levels; m_guiController.SetPoints(levelsToSpend); if (!blinking) { blinking = true; StartCoroutine(LevelUpEffect(player)); var fx = Tools.sharedAuto1.LoadAsset <GameObject>("vfx_synergrace_bless"); player.PlayEffectOnActor(fx, new Vector3(-10 / 16f, 0, 0)); AkSoundEngine.PostEvent("Play_NPC_magic_blessing_01", player.gameObject); } } m_guiController.UpdateXP(xp / xpToLevel); }
public IEnumerator ResizeEnemy(AIActor target, Vector2 ScaleValue, bool onlyDoRescale = true, bool isBigEnemy = false, bool delayed = false) { if (target == null | ScaleValue == null) { yield break; } if (delayed) { yield return(new WaitForSeconds(0.8f)); } HealthHaver targetHealthHaver = target.GetComponent <HealthHaver>(); float knockBackValue = 2f; int cachedLayer = target.gameObject.layer; int cachedOutlineLayer = cachedLayer; target.gameObject.layer = LayerMask.NameToLayer("Unpixelated"); cachedOutlineLayer = SpriteOutlineManager.ChangeOutlineLayer(target.sprite, LayerMask.NameToLayer("Unpixelated")); // target.ClearPath(); if (!onlyDoRescale) { if (target.knockbackDoer) { if (isBigEnemy) { target.knockbackDoer.weight *= knockBackValue; } else { target.knockbackDoer.weight /= knockBackValue; } } if (!isBigEnemy && targetHealthHaver != null && !onlyDoRescale) { if (!targetHealthHaver.IsBoss && !ChaosLists.DontDieOnCollisionWhenTinyGUIDList.Contains(target.EnemyGuid)) { target.DiesOnCollison = true; target.EnemySwitchState = "Blobulin"; } target.CollisionDamage = 0f; target.CollisionDamageTypes = 0; target.PreventFallingInPitsEver = false; // target.CollisionKnockbackStrength = target.CollisionKnockbackStrength - 0.6f; target.PreventBlackPhantom = true; if (targetHealthHaver.IsBoss) { if (targetHealthHaver != null) { targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() / 1.5f, null, false); } // aiActor.BaseMovementSpeed *= 1.1f; // aiActor.MovementSpeed *= 1.1f; } else if (targetHealthHaver != null && !onlyDoRescale) { target.BaseMovementSpeed *= 1.15f; target.MovementSpeed *= 1.15f; if (targetHealthHaver != null) { targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() / 2f, null, false); } } target.OverrideDisplayName = ("Tiny " + target.GetActorName()); } else if (isBigEnemy && targetHealthHaver != null && !onlyDoRescale) { if (!target.IsFlying && !targetHealthHaver.IsBoss && !ChaosLists.OverrideFallIntoPitsList.Contains(target.EnemyGuid)) { target.PreventFallingInPitsEver = true; } if (targetHealthHaver.IsBoss) { targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() * 1.2f, null, false); // aiActor.BaseMovementSpeed *= 0.8f; // aiActor.MovementSpeed *= 0.8f; } else { target.BaseMovementSpeed /= 1.25f; target.MovementSpeed /= 1.25f; targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() * 1.5f, null, false); } target.OverrideDisplayName = ("Big " + target.GetActorName()); } } Vector2 startScale = target.EnemyScale; float elapsed = 0f; float ShrinkTime = 0.5f; while (elapsed < ShrinkTime) { elapsed += BraveTime.DeltaTime; target.EnemyScale = Vector2.Lerp(startScale, ScaleValue, elapsed / ShrinkTime); if (target.specRigidbody) { target.specRigidbody.UpdateCollidersOnScale = true; target.specRigidbody.RegenerateColliders = true; } yield return(null); } yield return(new WaitForSeconds(1.5f)); ChaosUtility.CorrectForWalls(target); /*if (target.CorpseObject != null) { * target.CorpseObject.transform.localScale = ScaleValue.ToVector3ZUp(1f); * int cachedCorpseLayer = target.CorpseObject.layer; * int cachedCorpseOutlineLayer = cachedCorpseLayer; * target.CorpseObject.layer = LayerMask.NameToLayer("CorpseUnpixelated"); * cachedCorpseOutlineLayer = SpriteOutlineManager.ChangeOutlineLayer(target.CorpseObject.GetComponentInChildren<tk2dBaseSprite>(), LayerMask.NameToLayer("CorpseUnpixelated")); * }*/ yield break; }
private void OnKilledEnemy(PlayerController player, HealthHaver enemy) { if (player.PlayerHasActiveSynergy("Fully Funded")) { if (player.CurrentGun.PickupObjectId == Creditor.CreditorID && UnityEngine.Random.value <= 0.25 && enemy.GetMaxHealth() >= 15) { LootEngine.SpawnCurrency(enemy.specRigidbody.UnitCenter, 1, true); } } }