OSDN Git Service

不要となっていたプロパティを削除
[kcd/KCD.git] / KCD / TPValueCalculator.swift
index 211d983..2cb04c7 100644 (file)
@@ -27,7 +27,7 @@ final class ShipTPValueCalculator: TPValueCalculator {
     
     var value: Int {
         
-        if ship.nowhp == 0 {
+        if ship.status == 3 {
             
             return 0
         }
@@ -35,7 +35,7 @@ final class ShipTPValueCalculator: TPValueCalculator {
         let shipTPValue = shipTypeValue(ShipType(rawValue: ship.master_ship.stype.id))
         
         let itemValue = ship.equippedItem.array
-            .flatMap { $0 as? SlotItem }
+            .compactMap { $0 as? SlotItem }
             .map { EquipmentTPValueCalculator($0) }
             .map { $0.value }
             .reduce(0, +)
@@ -52,7 +52,10 @@ final class ShipTPValueCalculator: TPValueCalculator {
             return 10
         }
         
-        guard let type = shipType else { return 0 }
+        guard let type = shipType else {
+            
+            return 0
+        }
         
         switch type {
             
@@ -77,6 +80,7 @@ final class ShipTPValueCalculator: TPValueCalculator {
         case .supplyShip: return 15
             
         default: return 0
+            
         }
     }
 }
@@ -92,7 +96,10 @@ final class EquipmentTPValueCalculator: TPValueCalculator {
     
     var value: Int {
         
-        guard let type = EquipmentType(rawValue: slotItem.master_slotItem.type_2) else { return 0 }
+        guard let type = EquipmentType(rawValue: slotItem.master_slotItem.type_2) else {
+            
+            return 0
+        }
         
         switch type {
             
@@ -105,6 +112,7 @@ final class EquipmentTPValueCalculator: TPValueCalculator {
         case .onigiri: return 1
             
         default: return 0
+            
         }
     }
 }