Created
October 20, 2019 16:40
-
-
Save zackproser/b3d311e98531a9393aea8bda998a6c51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add commences a new attack | |
| func (a *AttackManager) Add(atk *Attack) (*Attack, error) { | |
| valid, num := validateNumber(atk.Target) | |
| if valid == false { | |
| return nil, errors.New("Invalid attack target:" + atk.Target) | |
| } | |
| running, attack := a.attackRunning(num) | |
| if running == true { | |
| return nil, errors.New("Attack already running on " + attack.Target + " count: ") | |
| } | |
| atk.Target = num | |
| atk.ID = len(a.repository) | |
| a.repository = append(a.repository, atk) | |
| return atk, nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment