OSDN Git Service

通常vs連合の被ダメ計算に
authormasakih <masakih@users.sourceforge.jp>
Sat, 3 Dec 2016 16:12:57 +0000 (01:12 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sat, 3 Dec 2016 16:12:57 +0000 (01:12 +0900)
KCD/HMBattleResultCommand.m
KCD/HMCalculateDamageCommand.m
KCD/HMCombinedBattleCommand.m
KCD/HMMidnightBattleCommand.m

index 0be6f53..fd75438 100644 (file)
@@ -11,6 +11,7 @@
 #import "HMCalculateDamageCommand.h"
 #import "HMDropShipHistoryCommand.h"
 #import "HMDummyShipCommand.h"
+#import "HMGuardShelterCommand.h"
 
 
 @implementation HMBattleResultCommand
 
 + (BOOL)canExcuteAPI:(NSString *)api
 {
-       return [api isEqualToString:@"/kcsapi/api_req_sortie/battleresult"];
+    if([api isEqualToString:@"/kcsapi/api_req_sortie/battleresult"]) return YES;
+    if([api isEqualToString:@"/kcsapi/api_req_combined_battle/battleresult"]) return YES;
+    
+    return NO;
 }
 
 - (id)init
@@ -33,6 +37,7 @@
                        [HMDropShipHistoryCommand new],
                        [HMCalculateDamageCommand new],
                        [HMDummyShipCommand new],
+            [HMGuardShelterCommand new],
                        nil];
        return self;
 }
index 7587949..e04400c 100644 (file)
@@ -26,6 +26,8 @@ typedef NS_ENUM(NSUInteger, HMBattleType) {
        typeCombinedWater,
     typeEachCombinedAir,
     typeEachCombinedWater,
+    
+    typeEnemyCombined,
 };
 
 typedef NS_ENUM(NSUInteger, HMDamageControlMasterSlotItemID) {
@@ -361,16 +363,19 @@ typedef NS_ENUM(NSUInteger, HMDamageControlMasterSlotItemID) {
 
 - (BOOL)isCombinedBattle
 {
-       return [self.api hasPrefix:@"/kcsapi/api_req_combined_battle"];
-}
-- (BOOL)isEnemyCombinedBattle
-{
-    if([self.api isEqualToString:@"/kcsapi/api_req_combined_battle/each_battle"]) return YES;
-    if([self.api isEqualToString:@"/kcsapi/api_req_combined_battle/each_battle_water"]) return YES;
-    if([self.api isEqualToString:@"/kcsapi/api_req_combined_battle/ec_midnight_battle"]) return YES;
-    
+    switch(self.battleType) {
+        case typeCombinedWater:
+        case typeCombinedAir:
+        case typeEachCombinedWater:
+        case typeEachCombinedAir:
+            return YES;
+        default:
+            //
+            break;
+    }
     return NO;
 }
+
 - (void)calcKouku:(NSArray<HMKCDamage *> *)damages
 {
     [self calculateFDam:damages
@@ -385,7 +390,7 @@ typedef NS_ENUM(NSUInteger, HMDamageControlMasterSlotItemID) {
     // 連合vs連合(水上) 第2 use kouku nor kouku2
     // 連合vs連合(機動) 第1 use kouku nor kouku2
     if(self.isCombinedBattle) {
-        self.calcSecondFleet = YES; // self.battleType == typeCombinedAir || self.battleType == typeCombinedWater;
+        self.calcSecondFleet = YES;
         [self calculateFDam:damages
                 fdamKeyPath:@"api_data.api_kouku.api_stage3_combined.api_fdam"];
         [self calculateFDam:damages
@@ -548,7 +553,7 @@ typedef NS_ENUM(NSUInteger, HMDamageControlMasterSlotItemID) {
 }
 - (void)calcEnemyCombinedBattle
 {
-    // same phase with combined air
+    // same phase as combined air
     [self calcCombinedBattleAir];
 }
 
@@ -711,6 +716,12 @@ NSInteger damageControlIfPossible(NSInteger nowhp, HMKCShipObject *ship)
                [self calculateMidnightBattle];
                return;
        }
+    
+    if([self.api isEqualToString:@"/kcsapi/api_req_combined_battle/ec_battle"]) {
+        self.battleType = typeEnemyCombined;
+        [self calcEnemyCombinedBattle];
+        return;
+    }
        
        // combined battle
        if([self.api isEqualToString:@"/kcsapi/api_req_combined_battle/battle"]
index fc34188..6e3f01d 100644 (file)
@@ -10,7 +10,6 @@
 
 #import "HMCalculateDamageCommand.h"
 #import "HMDropShipHistoryCommand.h"
-#import "HMGuardShelterCommand.h"
 
 
 @implementation HMCombinedBattleCommand
        if([api isEqualToString:@"/kcsapi/api_req_combined_battle/battle"]) return YES;
        if([api isEqualToString:@"/kcsapi/api_req_combined_battle/airbattle"]) return YES;
        if([api isEqualToString:@"/kcsapi/api_req_combined_battle/battle_water"]) return YES;
+    if([api isEqualToString:@"/kcsapi/api_req_combined_battle/ec_battle"]) return YES;
     if([api isEqualToString:@"/kcsapi/api_req_combined_battle/each_battle"]) return YES;
     if([api isEqualToString:@"/kcsapi/api_req_combined_battle/each_battle_water"]) return YES;
-       if([api isEqualToString:@"/kcsapi/api_req_combined_battle/midnight_battle"]) return YES;
-       if([api isEqualToString:@"/kcsapi/api_req_combined_battle/sp_midnight"]) return YES;
-    if([api isEqualToString:@"/kcsapi/api_req_combined_battle/battleresult"]) return YES;
        
        return NO;
 }
@@ -39,9 +36,7 @@
 - (id)init
 {
        self = [super initWithCommands:
-                       [HMDropShipHistoryCommand new],
                        [HMCalculateDamageCommand new],
-                       [HMGuardShelterCommand new],
                        nil];
        return self;
 }
index 0763731..15e3377 100644 (file)
@@ -24,6 +24,8 @@
        if([api isEqualToString:@"/kcsapi/api_req_battle_midnight/battle"]) return YES;
     if([api isEqualToString:@"/kcsapi/api_req_battle_midnight/sp_midnight"]) return YES;
     if([api isEqualToString:@"/kcsapi/api_req_combined_battle/ec_midnight_battle"]) return YES;
+    if([api isEqualToString:@"/kcsapi/api_req_combined_battle/midnight_battle"]) return YES;
+    if([api isEqualToString:@"/kcsapi/api_req_combined_battle/sp_midnight"]) return YES;
        
        return NO;
 }