Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string Attack(string[] args)
- {
- var atackerName = args[0];
- var receiverName = args[1];
- Character atacker = null;
- Character receiver = null;
- if (IsCharacterOnTheParty(atackerName) || IsCharacterOnTheParty(receiverName))
- {
- atacker = GetCharacter(atackerName);
- receiver = GetCharacter(receiverName);
- IAttackable atackingCharacter = null;
- if (CanTheCharacterAtack(atacker, atackingCharacter))
- {
- atackingCharacter.Attack(receiver);
- }
- }
- }
- private bool CanTheCharacterAtack(Character atacker, IAttackable atackingCharacter)
- {
- if (!(atacker is IAttackable attCharacter))
- {
- throw new ArgumentException(string.Format(OutputMessages.AtackerCannotAtack, atacker.Name));
- }
- atackingCharacter = attCharacter;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement