private void Awake() { statList = new Dictionary <FollowerAttackName, FollowerAttackStats>(); lookupTable = new Dictionary <CharacterClass, Dictionary <FollowerAttackPool, FollowerAttackName> >(); CharacterClass[] healingClasses = new CharacterClass[2] { CharacterClass.Priest, CharacterClass.WitchDoctor }; foreach (CharacterClass healingClass in healingClasses) { var classMoveList = new Dictionary <FollowerAttackPool, FollowerAttackName>(); FollowerAttackStats attackStats = new FollowerAttackStats(); foreach (FollowerAttackName attack in Enum.GetValues(typeof(FollowerAttackName))) { attackStats = attackDB.GetAttackStat(attack); if (attackStats.HealingClass != healingClass) { continue; } statList[attack] = attackStats; classMoveList[attackStats.movePool] = attack; } lookupTable[healingClass] = classMoveList; } characterClass = GetComponent <BaseStats>().GetClass(); }
private void CheckEffectActivation(bool isHit) { if (isEffectOnHit == isHit) { FollowerAttackStats attackStats = attackManager.GetAttackStats(currentAttack); EffectTarget atkFXTarget = attackStats.EffectTarget; if (atkFXTarget == EffectTarget.None) { if (attackStats.movePool == FollowerAttackPool.Cleanse) { fighter.ClearEffect(debuffCleanseQueue.Dequeue()); } else { foreach (var resource in resourceTypes) { float recoveryAmount = attackStats.Power / 100 * resource.GetMaxAttributeValue(); // healAmount *= baseStats.GetStat(Stat.Spirit) / 100; resource.GainAttribute(recoveryAmount); } } return; } string atkFXid = attackStats.EffectID.ToString(); switch (atkFXTarget) { case EffectTarget.Enemy: fighter.PassEffectEnemy(atkFXid); break; case EffectTarget.Self: fighter.PassEffectSelf(atkFXid); break; case EffectTarget.Player: fighter.PassEffectPlayer(atkFXid); break; case EffectTarget.Party: fighter.PassEffectParty(atkFXid); break; default: Debug.Log("Effect has no target!"); break; } } }
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); }
private void DecideNextAction() { if (timeSinceLastAttack >= timeBetweenAttacks) { // actionModifier should probably affect this... float foodValue = fullness.DigestFood(digestSpeed); // TODO: figure out base mana recovery when stomach is empty float manaAmount = Mathf.Max(1, foodValue * manaConversion); selfMana.GainAttribute(manaAmount); timeSinceLastAttack = 0; string chatMessage = null; float fullPercent = fullness.GetPercentage(); // Check for hunger and whether inventory has consumable if (fullPercent <= starveValue && consumableIndex.Count > 0) { chatMessage = GetItemToEat(); } else if (AttackInQueue()) { FollowerAttackStats attackStats = attackManager.GetAttackStats(currentAttack); // Check if have mana to cover attack cost if (attackStats.Cost < selfMana.GetAttributeValue()) { attackSpeed = 100 / fighter.GetStat(Stat.AttackSpeed); timeToAct = attackStats.CastTime * attackSpeed; actionModifier = attackStats.ActionModifier; selfMana.UseMana(attackStats.Cost); timeSinceActionStart = 0; isAttackActive = true; isEffectOnHit = attackStats.ApplyEffect == ApplyEffectOn.OnHit; Sprite sprite = followerAttackIconDB.GetSprite(currentAttack); SpawnHitTimer(sprite); CheckEffectActivation(false); if (isFromQueue) { atkQueue.Dequeue(); } if (attackStats.isRecastSkill) { float recastTime = attackStats.RecastTimer + timeToAct; skillRecastRoutines[currentAttack] = StartCoroutine(SkillRecast(currentAttack, recastTime)); } chatMessage = "Casting " + attackStats.Name; } else { // Message out of mana, extra check for hunger chatMessage = "I'm OOMing!"; actionModifier = 2f; if (fullPercent <= hungerValue && consumableIndex.Count > 0) { chatMessage = GetItemToEat(); } } } // check if under soft cap for hunger else if (fullPercent <= hungerValue && consumableIndex.Count > 0) { chatMessage = GetItemToEat(); } else { chatMessage = "Nothing to do?"; actionModifier = 2f; } combatLog.SendMessageToChat(chatMessage); } }
private void Awake() { attackStats = attackDB.GetAttackStat(atkName); }