Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
andanteyk committed Feb 26, 2015
2 parents a272098 + 23e15ef commit 45df000
Show file tree
Hide file tree
Showing 19 changed files with 471 additions and 281 deletions.
4 changes: 2 additions & 2 deletions ElectronicObserver/Data/CompassData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public int Destination {

/// <summary>
/// イベントID
/// 0=初期位置, 2=資源, 3=渦潮, 4=通常戦闘, 5=ボス戦闘, 7=連合艦隊航空戦
/// 0=初期位置, 2=資源, 3=渦潮, 4=通常戦闘, 5=ボス戦闘, 6=気のせいだった, 7=連合艦隊航空戦
/// </summary>
public int EventID {
get { return (int)RawData.api_event_id; }
}

/// <summary>
/// イベント種別
/// 0=非戦闘イベント, 1=戦闘イベント
/// 0=非戦闘, 1=通常戦闘, 2=夜戦, 3=夜昼戦, 4=航空戦
/// </summary>
public int EventKind {
get { return (int)RawData.api_event_kind; }
Expand Down
84 changes: 84 additions & 0 deletions ElectronicObserver/Data/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,60 @@ public static string GetDamageState( double hprate, bool isPractice = false, boo
#endregion


#region 出撃

/// <summary>
/// マップ上のセルでのイベントを表す文字列を取得します。
/// </summary>
public static string GetMapEventID( int value ) {

switch ( value ) {

case 0:
return "初期位置";
case 1:
return "なし";
case 2:
return "資源";
case 3:
return "渦潮";
case 4:
return "通常戦闘";
case 5:
return "ボス戦闘";
case 6:
return "気のせいだった";
case 7:
return "機動部隊航空戦";
default:
return "不明";
}
}

/// <summary>
/// マップ上のセルでのイベント種別を表す文字列を取得します。
/// </summary>
public static string GetMapEventKind( int value ) {

switch ( value ) {
case 0:
return "非戦闘";
case 1:
return "昼夜戦";
case 2:
return "夜戦";
case 3:
return "夜昼戦";
case 4:
return "航空戦";
default:
return "不明";
}
}

#endregion


#region 戦闘

/// <summary>
Expand Down Expand Up @@ -454,6 +508,36 @@ public static string GetWinRank( int rank ) {

#region その他

/// <summary>
/// 資源の名前を取得します。
/// </summary>
/// <param name="materialID">資源のID。</param>
/// <returns>資源の名前。</returns>
public static string GetMaterialName( int materialID ) {

switch ( materialID ) {
case 1:
return "燃料";
case 2:
return "弾薬";
case 3:
return "鋼材";
case 4:
return "ボーキサイト";
case 5:
return "高速建造材";
case 6:
return "高速修復材";
case 7:
return "開発資材";
case 8:
return "改修資材";
default:
return "不明";
}
}


/// <summary>
/// 階級を表す文字列を取得します。
/// </summary>
Expand Down
28 changes: 0 additions & 28 deletions ElectronicObserver/Data/MaterialData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,34 +118,6 @@ public override void LoadFromRequest( string apiname, Dictionary<string, string>
}


/// <summary>
/// 資源の名前を取得します。
/// </summary>
/// <param name="materialID">資源のID。</param>
/// <returns>資源の名前。</returns>
public static string GetMaterialName( int materialID ) {

switch ( materialID ) {
case 1:
return "燃料";
case 2:
return "弾薬";
case 3:
return "鋼材";
case 4:
return "ボーキサイト";
case 5:
return "高速建造材";
case 6:
return "高速修復材";
case 7:
return "開発資材";
case 8:
return "改修資材";
default:
return "不明";
}
}
}

}
103 changes: 90 additions & 13 deletions ElectronicObserver/Data/Quest/ProgressAGo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ProgressAGo : ProgressData {
[IgnoreDataMember]
private int sortieCount {
get { return Progress & 0xFF; }
set { Progress = ( Progress & ~0xFF ) | ( value & 0xFF ); }
set { Progress = ( Progress & ~0xFF ) | ( Math.Min( value, sortieMax ) & 0xFF ); }
}

/// <summary>
Expand All @@ -53,7 +53,7 @@ private int sortieCount {
[IgnoreDataMember]
private int sWinCount {
get { return ( Progress >> 8 ) & 0xFF; }
set { Progress = ( Progress & ~( 0xFF << 8 ) ) | ( ( value & 0xFF ) << 8 ); }
set { Progress = ( Progress & ~( 0xFF << 8 ) ) | ( ( Math.Min( value, sWinMax ) & 0xFF ) << 8 ); }
}

/// <summary>
Expand All @@ -62,7 +62,7 @@ private int sWinCount {
[IgnoreDataMember]
private int bossCount {
get { return ( Progress >> 16 ) & 0xFF; }
set { Progress = ( Progress & ~( 0xFF << 16 ) ) | ( ( value & 0xFF ) << 16 ); }
set { Progress = ( Progress & ~( 0xFF << 16 ) ) | ( ( Math.Min( value, bossMax ) & 0xFF ) << 16 ); }
}

/// <summary>
Expand All @@ -71,10 +71,50 @@ private int bossCount {
[IgnoreDataMember]
private int bossWinCount {
get { return ( Progress >> 24 ) & 0xFF; }
set { Progress = ( Progress & ~( 0xFF << 24 ) ) | ( ( value & 0xFF ) << 24 ); }
set { Progress = ( Progress & ~( 0xFF << 24 ) ) | ( ( Math.Min( value, bossWinMax ) & 0xFF ) << 24 ); }
}


#region tempシリーズ

/// <summary>
/// 現在の出撃回数(temp)
/// </summary>
[IgnoreDataMember]
private int sortieCountTemp {
get { return TemporaryProgress & 0xFF; }
set { TemporaryProgress = ( TemporaryProgress & ~0xFF ) | ( Math.Min( value, sortieMax ) & 0xFF ); }
}

/// <summary>
/// 現在のS勝利回数(temp)
/// </summary>
[IgnoreDataMember]
private int sWinCountTemp {
get { return ( TemporaryProgress >> 8 ) & 0xFF; }
set { TemporaryProgress = ( TemporaryProgress & ~( 0xFF << 8 ) ) | ( ( Math.Min( value, sWinMax ) & 0xFF ) << 8 ); }
}

/// <summary>
/// 現在のボス戦闘回数(temp)
/// </summary>
[IgnoreDataMember]
private int bossCountTemp {
get { return ( TemporaryProgress >> 16 ) & 0xFF; }
set { TemporaryProgress = ( TemporaryProgress & ~( 0xFF << 16 ) ) | ( ( Math.Min( value, bossMax ) & 0xFF ) << 16 ); }
}

/// <summary>
/// 現在のボス勝利回数(temp)
/// </summary>
[IgnoreDataMember]
private int bossWinCountTemp {
get { return ( TemporaryProgress >> 24 ) & 0xFF; }
set { TemporaryProgress = ( TemporaryProgress & ~( 0xFF << 24 ) ) | ( ( Math.Min( value, bossWinMax ) & 0xFF ) << 24 ); }
}

#endregion


public ProgressAGo( int questID )
: base( questID, 0 ) {
Expand All @@ -99,45 +139,82 @@ public override void Increment() {
}


public override void CheckProgress( int progressFlag ) {
//なにもしない
public override void CheckProgress( QuestData q ) {

if ( TemporaryProgress != 0 ) {
if ( q.State == 2 ) {

sortieCount = sortieCount + sortieCountTemp;
sWinCount = sWinCount + sWinCountTemp;
bossCount = bossCount + bossCountTemp;
bossWinCount = bossWinCount + bossWinCountTemp;

}

TemporaryProgress = 0;
}

}


/// <summary>
/// 出撃回数を増やします。
/// </summary>
public void IncrementSortie() {
sortieCount = Math.Min( sortieCount + 1, sortieMax );

var q = KCDatabase.Instance.Quest[QuestID];

if ( q == null ) {
sortieCountTemp++;
return;
}

if ( q.State != 2 )
return;


CheckProgress( q );

sortieCount++;
}

/// <summary>
/// 戦闘回数を増やします。
/// </summary>
public void IncrementBattle( string rank, bool isBoss ) {

var q = KCDatabase.Instance.Quest[QuestID];

if ( q != null ) {
if ( q.State != 2 )
return;
else
CheckProgress( q );
}


int irank = Constants.GetWinRank( rank );

if ( isBoss ) {
bossCount = Math.Min( bossCount + 1, bossMax );
if ( q != null ) bossCount++; else bossCountTemp++;

if ( irank >= Constants.GetWinRank( "B" ) )
bossWinCount = Math.Min( bossWinCount + 1, bossWinMax );
if ( q != null ) bossWinCount++; else bossWinCountTemp++;
}

if ( irank >= Constants.GetWinRank( "S" ) )
sWinCount = Math.Min( sWinCount + 1, sWinMax );
if ( q != null ) sWinCount++; else sWinCountTemp++;

}


public override string ToString() {
return string.Format( "出撃 {0}/{1}, S勝利 {2}/{3}, ボス {4}/{5}, ボス勝利 {6}/{7} ({8:p})",
return string.Format( "{0:p1} (出撃 {1}/{2}, S勝利 {3}/{4}, ボス {5}/{6}, ボス勝利 {7}/{8})",
ProgressPercentage,
sortieCount, sortieMax,
sWinCount, sWinMax,
bossCount, bossMax,
bossWinCount, bossMax,
ProgressPercentage );
bossWinCount, bossWinMax );
}

}
Expand Down
Loading

0 comments on commit 45df000

Please sign in to comment.