private IEnumerator EnemyAttack(int index, CharacterBase caster, CharacterBase target, AbilityScriptableObject ability) { HighlightTarget(target); yield return(new WaitForSeconds(1f)); var value = ability.GetValueRoll(); value = Mathf.CeilToInt(value * _damageController.GetMultiplier(caster.attackType, target.attackType)); target.DoDamage(value); memberElements[index].UpdateUI(); if (value > 0) { ability.ApplyEffectOnTarget(target); } yield return(new WaitForSeconds(2f)); if (!IsAlive(playerCharacters)) { StartCoroutine(ShowTurnTextCoroutine("Defeat", Color.red)); } }
private IEnumerator EnemyPassive(CharacterBase caster, CharacterBase target, AbilityScriptableObject ability, Action onPreCall) { onPreCall?.Invoke(); ability.ApplyEffectOnTarget(target); yield return(new WaitForSeconds(2f)); }
public void Poison(AbilityScriptableObject ability) { //TODO Going to need to consider having some sort of poison resist if (ability.AbilityType != AbilityType.Poison) { return; } poisonProfile = ability; poisonTime = poisonProfile.hitCount; DoDamage(poisonProfile.valueRange.x * 2, true); poisonProfile.ApplyEffectOnTarget(this); }
private void SelectTarget(AbilityScriptableObject ability, CharacterBase target) { int value = ability.GetValueRoll(); //TODO I should confirm the selection switch (ability.AbilityType) { case AbilityType.LightAttack: case AbilityType.HeavyAttack: value = Mathf.CeilToInt(value * _damageController.GetMultiplier(playerCharacters[selectedCharacterIndex].attackType, target.attackType)); //Damage character, based on chance and on range target.DoDamage(value); if (value > 0) { ability.ApplyEffectOnTarget(target); } if (!IsAlive(enemyCharacters)) { //TODO Need a way of wrapping up match StartCoroutine(ShowTurnTextCoroutine("Victory", Color.green)); } break; case AbilityType.Stun: //Stuns Target target.Stun(1); ability.ApplyEffectOnTarget(target); break; case AbilityType.Heal: //Add health, based on range target.Heal(value); memberElements.Find(x => x.m_character == target).UpdateUI(); ability.ApplyEffectOnTarget(target); break; case AbilityType.Block: //Sets target to be blocking target.Block(); break; case AbilityType.Poison: target.Poison(ability); break; case AbilityType.AOE: foreach (var enemyCharacter in enemyCharacters) { enemyCharacter.DoDamage(ability.GetValueRoll()); ability.ApplyEffectOnTarget(enemyCharacter); } break; default: throw new ArgumentOutOfRangeException(); } playerCharacters[selectedCharacterIndex].EndTurn(); SetGameState(GAMESTATE.CHARACTER_SELECT); }