/// <summary> /// Called on every fixed update, selects a target randomly and damages it. /// If atleast one dd is alive, select one at random, else select a tank. /// </summary> void FixedUpdate() { if (!Gamestate.gamestate.GetPaused()) { swingTimerCurrent += 0.02f; if (swingTimerCurrent >= swingTimer) { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs()); int numberTargets = targetDict.Count; if (numberTargets <= 0) //no dd is alive, load all raider { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders()); numberTargets = targetDict.Count; } if (target != null && targetDict.Count > 1 && targetDict.Contains(target)) { targetDict.Remove(target); } target = targetDict[Random.Range(0, targetDict.Count)]; target.Damage(dmg); dmg += multiplieer; swingTimerCurrent = 0f; } } }
IEnumerator ApplyDamage() { while (1 == 1) { yield return(new WaitForSeconds(tickLength)); raider.Damage(damagePerTick); damagePerTick += damageIncrease; } }
/// <summary> /// Called on every fixed update, i.e. 50 times a second. /// </summary> void FixedUpdate() { if (!Gamestate.gamestate.GetPaused()) { currentTargetTimer += 0.02f; currentSwingTimer += 0.02f; if (target == null || !target.IsAlive() || currentTargetTimer >= changeTargetTimer) //if we don't have a target, the target is dead or we are rdy for a targetchange, select a new target { ChangeTarget(); } if (currentSwingTimer >= swingTimer) //the attack timer is rdy { target.Damage(dmg); dmg += multiplier; currentSwingTimer = 0f; } } }
/// <summary> /// The rock attack routine. /// first select random dd's not hit last round /// if not enought targets are hit select random dd's not hit last round /// if still not enought targets are hit select random tanks /// if still not enought targets are hit, go ham and select random raiders until enought targets are hit /// </summary> private void AttackRock() { List <Raider> targetDict = null; int targetsLeft = numberTargetsRock; if (targetsLeft > 0) //only hit dds not hit in the last round { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs()); foreach (Raider raider in lastTargetDict) { if (targetDict.Contains(raider)) { targetDict.Remove(raider); } } lastTargetDict = new List <Raider>(); while (targetsLeft > 0 && targetDict.Count > 0) { Raider target = targetDict[Random.Range(0, targetDict.Count)]; targetDict.Remove(target); lastTargetDict.Add(target); target.Damage(dmgRock); targetsLeft--; } } if (targetsLeft > 0) //only hit dds not jet hit in this round { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs()); foreach (Raider raider in lastTargetDict) { if (targetDict.Contains(raider)) { targetDict.Remove(raider); } } while (targetsLeft > 0 && targetDict.Count > 0) { Raider target = targetDict[Random.Range(0, targetDict.Count)]; targetDict.Remove(target); lastTargetDict.Add(target); target.Damage(dmgRock); targetsLeft--; } } if (targetsLeft > 0) //hit tanks { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllTanks()); while (targetsLeft > 0 && targetDict.Count > 0) { Raider target = targetDict[Random.Range(0, targetDict.Count)]; targetDict.Remove(target); lastTargetDict.Add(target); target.Damage(dmgRock); targetsLeft--; } } while (targetsLeft > 0) //go wild, hit random raiders until enough are hit { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders()); while (targetsLeft > 0 && targetDict.Count > 0) { Raider target = targetDict[Random.Range(0, targetDict.Count)]; targetDict.Remove(target); target.Damage(dmgRock); targetsLeft--; } } }
/// <summary> /// Called on every fixet update. /// </summary> void FixedUpdate() { if (target == null || target != null && !target.IsAlive()) //Change target if has no target or target is dead { ChangeTarget(); } if (canAttack) //AutoAttack Damage { target.Damage(dmgAutoAttack); timer = StartCoroutine(Timer(swingTimerAutoAttack)); dmgAutoAttack += multiplierAutoAttack; } swingTimerCleaveCurrent += 0.02f; swingTimerFixateCurrent += 0.02f; if (swingTimerCleaveCurrent > swingTimerCleave - 2.05f && swingTimerCleaveCurrent < swingTimerCleave - 1.95f) { GetComponent <Boss>().SetEmoteText(" " + emoteText1); } else if (swingTimerFixateCurrent > swingTimerFixate - 2.05f && swingTimerFixateCurrent < swingTimerFixate - 1.95f) { GetComponent <Boss>().SetEmoteText(" " + emoteText2); } //cooldownoverlay cleave cooldownOverlayCleave.fillAmount = swingTimerCleaveCurrent / swingTimerCleave; //cooldownoverlay fixate cooldownOverlayFixate.fillAmount = swingTimerFixateCurrent / swingTimerFixate; if (swingTimerCleaveCurrent >= swingTimerCleave) //cleave { AttackCleave(); cleavesBetweenFixateRemaining--; swingTimerCleaveCurrent = 0f; if (cleavesBetweenFixateRemaining > 0) { swingTimerCleave = swingTimer; } else { swingTimerCleave = swingTimer * 2 + DELAYFIXATE * (hitsFixate - 1); } } if (swingTimerFixateCurrent >= swingTimerFixate) //fixate { StopAllCoroutines(); //stop autoattacks canAttack = false; AttackFixate(); countFixate++; swingTimerFixateCurrent = 0f; if (countFixate >= hitsFixate) { ChangeTarget(); timer = StartCoroutine(Timer(0.5f)); dmgFixateCurrent = dmgFixate; countFixate = 0; cleavesBetweenFixateRemaining = cleavesBetweenFixate; swingTimerFixate = swingTimer * (cleavesBetweenFixate + 1); swingTimerCleaveCurrent = swingTimer + DELAYFIXATE * (hitsFixate - 1); } else { swingTimerFixate = DELAYFIXATE; } } }
/// <summary> /// Called on every fixed update /// </summary> void FixedUpdate() { swingTimerCurrent += 0.02f; if (swingTimerCurrent > swingTimer - 2.05f && swingTimerCurrent < swingTimer - 1.95f) { GetComponent <Boss>().SetEmoteText(" " + emote); } cooldownOverlay.fillAmount = swingTimerCurrent / swingTimer; cooldownOverlay2.fillAmount = swingTimerCurrent / swingTimer; if (swingTimerCurrent >= swingTimer) { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDsSortedByHealth()); foreach (Raider raider in targetDict) { if (!raider.GetGameObject().GetComponent <StoneOne>() && !raider.GetGameObject().GetComponent <StoneTwo>()) { target = raider; } } if (target == null) { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaidersSortedByHealth()); foreach (Raider raider in targetDict) { if (!raider.GetGameObject().GetComponent <StoneOne>() && !raider.GetGameObject().GetComponent <StoneTwo>()) { target = raider; } } } if (target != null) { target.Damage(dmg1); target.GetGameObject().AddComponent <StoneOne>(); target = null; } targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDsSortedByHealth()); foreach (Raider raider in targetDict) { if (!raider.GetGameObject().GetComponent <StoneOne>() && !raider.GetGameObject().GetComponent <StoneTwo>()) { target = raider; } } if (target == null) { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaidersSortedByHealth()); foreach (Raider raider in targetDict) { if (!raider.GetGameObject().GetComponent <StoneOne>() && !raider.GetGameObject().GetComponent <StoneTwo>()) { target = raider; } } } if (target != null) { target.Damage(dmg2); target.GetGameObject().AddComponent <StoneTwo>(); target = null; } swingTimerCurrent = 0f; } }
/// <summary> /// Fire Phase logic. /// </summary> private void FirePhase() { fireDotTimerCurrent += 0.02f; rangeAttackTimerCurrent += 0.02f; cooldownOverlayDebuff.fillAmount = fireDotTimerCurrent / fireDotTimer; if (fireDotTimerCurrent >= fireDotTimer) //apply a new Fire Dot { fireDotTimerCurrent = 0f; List <Raider> targetDict = new List <Raider>(); foreach (Raider raider in new List <Raider>(RaiderDB.GetInstance().GetAllDDs())) { if (!raider.GetGameObject().GetComponent <AlakirFeuerDebuff>()) { targetDict.Add(raider); } } if (targetDict.Count == 0) { foreach (Raider raider in new List <Raider>(RaiderDB.GetInstance().GetAllRaiders())) { if (!raider.GetGameObject().GetComponent <AlakirFeuerDebuff>()) { targetDict.Add(raider); } } } if (targetDict.Count == 0) { targetDict = RaiderDB.GetInstance().GetAllRaiders(); } Raider fireTarget = targetDict[Random.Range(0, targetDict.Count)]; fireTarget.GetGameObject().AddComponent <AlakirFeuerDebuff>(); fireTarget = null; } else if (rangeAttackTimerCurrent >= rangeAttackTimer) //Range AutoAttack { rangeAttackTimerCurrent = 0f; List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs()); if (rangeTarget != null && targetDict.Count > 1 && targetDict.Contains(rangeTarget)) { targetDict.Remove(rangeTarget); } rangeTarget = targetDict[Random.Range(0, targetDict.Count)]; rangeTarget.Damage(rangeAttackDamage); } else if (timeInPhase > phaseduration - 2.05f && timeInPhase < phaseduration - 1.95f) //emote for air phase { GetComponent <Boss>().SetEmoteText(" " + emotePhaseOne); } else if (timeInPhase > phaseduration) //switch to air phase { List <Raider> targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders()); foreach (Raider target in targetDict) { target.GetGameObject().AddComponent <AlakirWasserDebuff>(); } BossModImagePhase.sprite = Resources.Load("Blizzard", typeof(Sprite)) as Sprite; BossModImageDebuff.sprite = Resources.Load("Luft", typeof(Sprite)) as Sprite; cooldownOverlayDebuff.enabled = false; fireDotTimerCurrent = 0f; phaseID = 2; timeInPhase = 0; } }