private void StartingAttackQueue() { FollowerAttackName attackFromPool = attackManager.GetAttackOfType(FollowerAttackPool.Aura); var followerAttackStats = attackManager.GetAttackStats(attackFromPool); float AuraDuration = fighter.GetEffectElapsedTime(followerAttackStats.EffectID.ToString(), true); if (AuraDuration == 0) { atkQueue.Enqueue(attackFromPool); } else { float recastTimer = followerAttackStats.RecastTimer - AuraDuration; skillRecastRoutines[attackFromPool] = StartCoroutine(SkillRecast(attackFromPool, recastTimer)); } attackFromPool = attackManager.GetAttackOfType(FollowerAttackPool.Buff); atkQueue.Enqueue(attackFromPool); attackFromPool = attackManager.GetAttackOfType(FollowerAttackPool.Debuff); atkQueue.Enqueue(attackFromPool); if (playerHealth.GetPercentage() < regenThreshold) { attackFromPool = attackManager.GetAttackOfType(FollowerAttackPool.HealOverTime); atkQueue.Enqueue(attackFromPool); } }
private IEnumerator SkillRecast(FollowerAttackName attackName, float timeToWait) { yield return(new WaitForSeconds(timeToWait)); // Run proficiency check for optimal timing, otherwise call for recheck after X seconds combatLog.SendMessageToChat("Queuing up " + attackManager.GetAttackStats(attackName).Name); atkQueue.Enqueue(attackName); skillRecastRoutines.Remove(attackName); }
public KeyValuePair <FollowerAttackName, int> GetAttackCost(FollowerAttackPool movePool) { if (lookupTable[characterClass].ContainsKey(movePool)) { FollowerAttackName attackName = lookupTable[characterClass][movePool]; return(new KeyValuePair <FollowerAttackName, int>(attackName, statList[attackName].Cost)); } return(new KeyValuePair <FollowerAttackName, int>(FollowerAttackName.None, int.MaxValue)); }
public void OnPlayerDebuff(string debuffID) { if (attackManager.HasAttackInPool(FollowerAttackPool.Cleanse)) { FollowerAttackName cleanseAttack = attackManager.GetAttackOfType(FollowerAttackPool.Cleanse); if (!IsAttackQueued(cleanseAttack)) { combatLog.SendMessageToChat("Queuing up a cleanse!"); debuffCleanseQueue.Enqueue(debuffID); atkQueue.Enqueue(cleanseAttack); } } }
private bool IsOnCooldown(FollowerAttackName attack) { if (skillCooldown.ContainsKey(attack)) { FollowerAttackStats attackStats = attackManager.GetAttackStats(attack); float cooldown = attackStats.Cooldown * (1 - fighter.GetStat(Stat.CooldownReduction) / 100); if (skillCooldown[currentAttack] + cooldown >= Time.time) { return(true); } } return(false); }
public FollowerAttackStats GetAttackStat(FollowerAttackName attackName) { BuildLookup(); return(lookupTable[attackName]); }
public Sprite GetSprite(FollowerAttackName attackName) { BuildLookup(); return(lookupTable[attackName]); }
private bool IsAttackQueued(FollowerAttackName followerAttackName) { return(skillRecastRoutines.ContainsKey(followerAttackName) || atkQueue.Contains(followerAttackName)); }
private bool AttackInQueue() { isFromQueue = false; KeyValuePair <FollowerAttackName, int> attackAndCost; // Check player HP threshold over attack queue float hp = playerHealth.GetPercentage(); float mana = playerMana.GetAttributeValue(); if (hp <= healThreshold) { FollowerAttackPool[] healSkills = new FollowerAttackPool[2] { FollowerAttackPool.HealBig, FollowerAttackPool.HealSmall }; foreach (var heal in healSkills) { attackAndCost = attackManager.GetAttackCost(heal); if (!IsOnCooldown(attackAndCost.Key) && attackAndCost.Value <= mana) { currentAttack = attackAndCost.Key; resourceTypes = new IAttribute[1]; resourceTypes[0] = playerHealth as IAttribute; return(true); } } } // Check player mana if (playerMana.GetPercentage() <= manaThreshold && attackManager.HasAttackInPool(FollowerAttackPool.ManaGain)) { attackAndCost = attackManager.GetAttackCost(FollowerAttackPool.ManaGain); if (!IsOnCooldown(attackAndCost.Key)) { currentAttack = attackAndCost.Key; resourceTypes = new IAttribute[2]; resourceTypes[0] = playerMana as IAttribute; resourceTypes[1] = selfMana as IAttribute; return(true); } } // Check for lower priority heal over time threshold if (hp < regenThreshold) { attackAndCost = attackManager.GetAttackCost(FollowerAttackPool.HealOverTime); if (!IsOnCooldown(attackAndCost.Key) && !IsAttackQueued(attackAndCost.Key)) { atkQueue.Enqueue(attackAndCost.Key); } } if (atkQueue.Count > 0) { currentAttack = atkQueue.Peek(); if (!IsOnCooldown(currentAttack)) { isFromQueue = true; return(true); } Debug.Log("Attack in queue is on cooldown? " + currentAttack); } return(false); }
public FollowerAttackStats GetAttackStats(FollowerAttackName attackName) { return(statList[attackName]); }