-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
759 additions
and
209 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ElectronicObserver.Data.Battle { | ||
public class BattleAirBattle : BattleData { | ||
|
||
public override int FleetIDFriend { | ||
get { return (int)RawData.api_dock_id; } | ||
} | ||
|
||
public override int[] EmulateBattle() { | ||
|
||
int[] hp = new int[12]; | ||
|
||
KCDatabase db = KCDatabase.Instance; | ||
|
||
Action<int, int> DealDamageFriend = ( int index, int damage ) => { | ||
//if ( hp[index] == -1 ) return; | ||
hp[index] -= Math.Max( damage, 0 ); | ||
if ( hp[index] <= 0 ) { | ||
ShipData ship = db.Ships[db.Fleet[FleetIDFriend].Members[index]]; | ||
if ( ship == null ) return; | ||
|
||
foreach ( int id in ship.SlotMaster ) { | ||
|
||
if ( id == 42 ) { //応急修理要員 | ||
hp[index] = (int)( ship.HPMax * 0.2 ); | ||
break; | ||
} else if ( id == 43 ) { //応急修理女神 | ||
hp[index] = ship.HPMax; | ||
break; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
Action<int, int> DealDamageEnemy = ( int index, int damage ) => { | ||
//if ( hp[index + 6] == -1 ) return; | ||
hp[index + 6] -= Math.Max( damage, 0 ); | ||
}; | ||
|
||
|
||
for ( int i = 0; i < 12; i++ ) { | ||
hp[i] = (int)RawData.api_nowhps[i + 1]; | ||
} | ||
|
||
|
||
//第一次航空戦 | ||
if ( (int)RawData.api_stage_flag[2] != 0 ) { | ||
for ( int i = 0; i < 6; i++ ) { | ||
DealDamageFriend( i, (int)RawData.api_kouku.api_stage3.api_fdam[i + 1] ); | ||
DealDamageEnemy( i, (int)RawData.api_kouku.api_stage3.api_edam[i + 1] ); | ||
} | ||
} | ||
|
||
|
||
//*/ //今のところ未実装だけど念のため | ||
if ( RawData.api_support_flag() ) { | ||
//支援艦隊(空撃) | ||
if ( (int)RawData.api_support_flag == 1 ) { | ||
for ( int i = 0; i < 6; i++ ) { | ||
DealDamageEnemy( i, (int)RawData.api_support_info.api_support_airatack.api_stage3.api_edam[i + 1] ); | ||
} | ||
} | ||
|
||
//支援艦隊(砲雷撃) | ||
if ( (int)RawData.api_support_flag == 2 || | ||
(int)RawData.api_support_flag == 3 ) { | ||
for ( int i = 0; i < 6; i++ ) { | ||
DealDamageEnemy( i, (int)RawData.api_support_info.api_support_hourai.api_damage[i + 1] ); | ||
} | ||
} | ||
} | ||
//*/ | ||
|
||
//第二次航空戦 | ||
if ( (int)RawData.api_stage_flag2[2] != 0 ) { | ||
for ( int i = 0; i < 6; i++ ) { | ||
DealDamageFriend( i, (int)RawData.api_kouku2.api_stage3.api_fdam[i + 1] ); | ||
DealDamageEnemy( i, (int)RawData.api_kouku2.api_stage3.api_edam[i + 1] ); | ||
} | ||
} | ||
|
||
return hp; | ||
|
||
} | ||
|
||
public override string APIName { | ||
get { return "api_req_sortie/airbattle"; } | ||
} | ||
|
||
public override BattleData.BattleTypeFlag BattleType { | ||
get { return BattleTypeFlag.Day; } | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
25 changes: 25 additions & 0 deletions
25
ElectronicObserver/Observer/kcsapi/api_req_sortie/airbattle.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using ElectronicObserver.Data; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ElectronicObserver.Observer.kcsapi.api_req_sortie { | ||
|
||
public class airbattle : APIBase { | ||
|
||
public override void OnResponseReceived( dynamic data ) { | ||
|
||
KCDatabase.Instance.Battle.LoadFromResponse( APIName, data ); | ||
|
||
|
||
base.OnResponseReceived( (object)data ); | ||
} | ||
|
||
public override string APIName { | ||
get { return "api_req_sortie/airbattle"; } | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.