private string GetBattleStepDescription(BattleStep step) { string executorName = GetCharacterNameString(step.executor); string targetName = GetCharacterNameString(step.target); string attackName = $"<i>{step.attack.AttackName}</i>"; int damage = step.attack.Damage; bool attackMissed = step.missAttack; string description = $"{executorName} uses {attackName} on {targetName}."; if (attackMissed) { description += $"\n<color=#BBBBBB>It missed :(</color>"; } else { description += $"\nIt dealt {damage} damage."; if (damage > 1) { description += "\nIt is super effective!"; } } return(description); }
private void HandleBattleStep(BattleStep battleStep) { if (!battleStep.missAttack) { var healthReceivingDamage = GetCharacterHealth(battleStep.target); healthReceivingDamage.DoDamage(battleStep.attack.Damage); } audioSource.PlayOneShot(battleStep.attack.AttackAudio); }
public BattleStep NextBattleStep() { var attack = _nextPlayerToAttack.BattlesData.GetRandomAttack(); bool missAttack = Random.value > _nextPlayerToAttack.Statistics.HitChance; var battleStep = new BattleStep { executor = _nextPlayerToAttack, target = GetTargetCharacter(), attack = attack, missAttack = missAttack }; ToggleNextCharacterToAttack(); return(battleStep); }