2 // NyukyoStartCommand.swift
5 // Created by Hori,Masaki on 2017/01/08.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
11 final class NyukyoStartCommand: JSONCommand {
13 override class func canExecuteAPI(_ api: API) -> Bool {
15 return api.endpoint == .startNyukyo
18 override func execute() {
20 guard let hi = parameter["api_highspeed"].int, hi != 0 else { return }
22 let store = ServerDataStore.oneTimeEditor()
24 parameter["api_ship_id"]
26 .flatMap(store.ship(by:))
27 .map { $0.nowhp = $0.maxhp }
30 .map { $0.kousokushuhuku = $0.kousokushuhuku - 1 }