public void HealGroup(MinionSlotType slotType, float fAmount) { float fTotalMultiplier = 0.0f; for (int i = 0; i < slotType.GetNumSlots(); i++) { Minion minion = minions [(int)slotType.GetFirst() + i]; fTotalMultiplier += (1.0f + minion.GetBuff(Stat.HEAL_MULTIPLIER)); } fTotalMultiplier /= slotType.GetNumSlots(); float fAmountToHeal = Mathf.Clamp(fAmount * fTotalMultiplier, 0.0f, afGroupMaxHealths [(int)slotType] - afGroupHealths [(int)slotType]); afGroupHealths [(int)slotType] += fAmountToHeal; Core.IncrementStat("HEALTH_HEALED", Mathf.FloorToInt(fAmountToHeal)); }
public void SetComparisonType(MinionSlotType slotType) { if (currentRoster == null) { Debug.Assert(false, "Trying to edit null roster!"); return; } for (int i = 0; i < slotType.GetNumSlots(); i++) { comparisonBlocks [i].gameObject.SetActive(true); comparisonBlocks [i].SetMinion(currentRoster.minions [(int)(slotType.GetFirst()) + i].template, (MinionSlot)((int)(slotType.GetFirst()) + i)); } for (int i = slotType.GetNumSlots(); i < 3; i++) { comparisonBlocks [i].gameObject.SetActive(false); } currentlyComparing = slotType; }
public void AddComboToGroup(MinionSlotType slotType, int iAmount) { for (int i = 0; i < slotType.GetNumSlots(); i++) { Minion minion = minions [(int)slotType.GetFirst() + i]; if (minion != null && (minion.template.canCombo || minion.template.bDeathtoll)) { for (int j = 0; j < iAmount; j++) { minion.template.IncrementCombo(Core.GetLevel().playerActors [(int)slotType.GetFirst() + i]); } } } }
public void RecalculateHealths(MinionSlotType slotType) { afGroupMaxHealths [(int)slotType] = 0.0f; for (int j = 0; j < slotType.GetNumSlots(); j++) { MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + j); if (minions [(int)slot] != null) { afGroupMaxHealths [(int)slotType] += minions [(int)slot].fMaxHealthPostBuffs; } } afGroupHealths [(int)slotType] = afGroupMaxHealths [(int)slotType]; }
public bool IsAnyoneAlive(MinionSlotType slotType) { if (Core.GetLevel() == null) { return(false); } bool bAnyoneAlive = false; for (int i = 0; i < slotType.GetNumSlots(); i++) { Actor_Player player = Core.GetLevel().playerActors [(int)slotType.GetFirst() + i]; //Debug.Assert(player == null || player.minion != null); if (player != null && player.minion != null && player.minion.fCurrentHealth > 0.0f) { bAnyoneAlive = true; } } return(bAnyoneAlive); }
private void KillGroup(MinionSlotType slotType) { foreach (Actor_Player actor in Core.GetLevel().playerActors) { actor.minion.template.TriggerBuff(slotType == MinionSlotType.MELEE ? BuffTrigger.PLAYER_MELEE_DIED : BuffTrigger.PLAYER_RANGED_DIED, null); } List <Resurrection> resList = Core.GetLevel().singleUseResurrections; for (int i = 0; i < resList.Count; i++) { Resurrection res = resList [i]; if (res.slotToRes == slotType) { resList.RemoveAt(i); Core.GetAudioManager().PlayResSFX(res.resSound); // Do achievements Core.TriggerAchievement("BACK_FROM_THE_DEAD"); Core.IncrementStat("NUM_RESURRECTIONS", 2); if (bHasThreeResurrectsAvailable) { bool bLastResUsed = true; foreach (Resurrection check in resList) { if (check.slotToRes == slotType) { bLastResUsed = false; } } if (bLastResUsed) { Core.TriggerAchievement("AND_HERE_TO_STAY"); } } for (int j = 0; j < slotType.GetNumSlots(); j++) { MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + j); minions [(int)slot].fMaxHealthPreBuffs *= res.fMaxHealthModifier; minions [(int)slot].fMaxHealthPostBuffs *= res.fMaxHealthModifier; minions [(int)slot].isZombified = true; // Play PFX PFX_DebuffIcon pfx = Instantiate <PFX_DebuffIcon>(res.resPFX); pfx.transform.SetParent(Core.GetLevel().playerActors [(int)slot].transform); pfx.transform.localPosition = new Vector3(0.0f, 0.0f, -0.25f); pfx.Init(true); } RecalculateHealths(slotType); return; } } for (int i = 0; i < slotType.GetNumSlots(); i++) { MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + i); KillMinion(slot); } Core.GetLevel().PlayerLost(); }
private float Attack(Actor_Enemy attacker, Damage damage, float fMod, MinionSlotType slotType, MinionSlot slot) { float fTotalDealt = 0.0f; float fDamage = damage.fAmount * fMod; if (fDamage > 0.0f) { float fTotalMultiplierFromMinions = 0.0f; for (int i = 0; i < slotType.GetNumSlots(); i++) { Minion minion = minions [(int)slotType.GetFirst() + i]; if (minion != null) { float fBuffModifier = minion.GetBuff(Stats.GetStatForDamageMultiplier(damage.GetElement())); fBuffModifier += minion.GetBuff(Stat.DAMAGE_MULTIPLIER); fBuffModifier += minion.GetBuff(slotType == MinionSlotType.MELEE ? Stat.DAMAGE_MULTIPLIER_MELEE : Stat.DAMAGE_MULTIPLIER_RANGED); fBuffModifier += minion.GetBuff(Stat.DAMAGE_MULTIPLIER_PER_COMBO) * minion.iCombo; fTotalMultiplierFromMinions += (1.0f + fBuffModifier) * Elements.GetDamageMultiplier(damage.GetElement(), minion.template.element); } else { fTotalMultiplierFromMinions += 1.0f; } } float fAverageMinionMultiplier = fTotalMultiplierFromMinions / slotType.GetNumSlots(); fDamage *= fAverageMinionMultiplier; fDamage *= (1.0f + Mathf.Clamp(damage.fRadius, 0.0f, 5.0f)); if (attacker != null && attacker.minion.template.canCombo) { fDamage *= 3.0f; } float fDamageToDeal = Mathf.Min(afGroupHealths [(int)slotType], fDamage); if (fDamageToDeal > 0.0f) { float fParametricHealthPreDamage = afGroupHealths[(int)slotType] / afGroupMaxHealths[(int)slotType]; afGroupHealths [(int)slotType] -= fDamageToDeal; float fParametricHealthPostDamage = afGroupHealths[(int)slotType] / afGroupMaxHealths[(int)slotType]; if (!bHasTriggeredVolatileYet && fParametricHealthPreDamage > 0.25f && fParametricHealthPostDamage <= 0.25f) { bHasTriggeredVolatileYet = true; for (int i = 0; i < slotType.GetNumSlots(); i++) { if (minions [(int)slotType.GetFirst() + i].template.bVolatile) { // TODO: Play PFX // Play sound Core.GetLevel().KillAllEnemies(); } } } // Do damage numbers Actor_Player actorHit = null; if (slot == MinionSlot.NUM_MINION_SLOTS) { actorHit = Core.GetLevel().playerActors [(int)slotType.GetFirst() + Random.Range(0, slotType.GetNumSlots())]; } else { actorHit = Core.GetLevel().playerActors [(int)slot]; } if (actorHit != null) { int iDamage = Mathf.FloorToInt(fDamage); actorHit.MakeDamageNumbers(iDamage, Core.GetMinionTemplateManager().playerDamage); } if (afGroupHealths [(int)slotType] <= 0.0f) { KillGroup(slotType); } fDamage -= fDamageToDeal; fTotalDealt += fDamageToDeal; Core.GetLevel().bHasSomeDamageBeenTaken = true; } } return(fTotalDealt); }