Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ElectronicObserver/Data/FleetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public ReadOnlyCollection<ShipData> MembersWithoutEscaped
/// </summary>
public bool IsInSortie { get; internal set; }

public bool IsInPractice { get; internal set; }




Expand Down Expand Up @@ -144,6 +146,7 @@ public override void LoadFromResponse(string apiname, dynamic data)
Utility.Logger.Add(2, string.Format("#{0}「{1}」が帰投しました。", FleetID, Name));
}
IsInSortie = false;
IsInPractice = false;

break;

Expand Down
1 change: 1 addition & 0 deletions ElectronicObserver/Data/FleetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public override void LoadFromRequest(string apiname, Dictionary<string, string>
{
int fleetID = int.Parse(data["api_deck_id"]);
Fleets[fleetID].IsInSortie = true;
Fleets[fleetID].IsInPractice = true;
}
break;

Expand Down
27 changes: 25 additions & 2 deletions ElectronicObserver/Data/Quest/ProgressData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,34 @@ public virtual void CheckProgress(QuestData q)
switch (q.Progress)
{
case 1: //50%
Progress = (int)Math.Max(Progress, Math.Ceiling((ProgressMax + SharedCounterShift) * 0.5) - SharedCounterShift);
switch (q.QuestID)
{
case 337: // rounds to 2/3
Progress = 1;
break;

default:
Progress = (int)Math.Max(Progress, Math.Ceiling((ProgressMax + SharedCounterShift) * 0.5) - SharedCounterShift);
break;
}
break;
case 2: //80%
Progress = (int)Math.Max(Progress, Math.Ceiling((ProgressMax + SharedCounterShift) * 0.8) - SharedCounterShift);
switch (q.QuestID)
{
case 330: // rounds to 4/4
Progress = 3;
break;

case 337: // rounds to 3/3
Progress = 2;
break;

default:
Progress = (int)Math.Max(Progress, Math.Ceiling((ProgressMax + SharedCounterShift) * 0.8) - SharedCounterShift);
break;
}
break;

}

}
Expand Down
54 changes: 51 additions & 3 deletions ElectronicObserver/Data/Quest/ProgressPractice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,72 @@ public class ProgressPractice : ProgressData
[DataMember]
private bool WinOnly { get; set; }

/// <summary>
/// 条件を満たす最低ランク
/// </summary>
[DataMember]
private int LowestRank { get; set; }


public ProgressPractice(QuestData quest, int maxCount, bool winOnly)
: base(quest, maxCount)
{

LowestRank = winOnly ? Constants.GetWinRank("B") : Constants.GetWinRank("");
WinOnly = winOnly;
}

public ProgressPractice(QuestData quest, int maxCount, string lowestRank)
: base(quest, maxCount)
{
LowestRank = Constants.GetWinRank(lowestRank);
}


public void Increment(string rank)
{
FleetData fleet = KCDatabase.Instance.Fleet.Fleets.Values
.FirstOrDefault(f => f.IsInPractice);

if (fleet == null) return;

if (WinOnly && Constants.GetWinRank(rank) < Constants.GetWinRank("B"))
return;
if (Constants.GetWinRank(rank) < LowestRank) return;

if (!MeetsSpecialRequirements(QuestID, fleet)) return;

Increment();
}

// todo: library with full enum
private enum ShipId
{
Kagerou = 17,
Shiranui = 18,
Arare = 48,
Kasumi = 49,
}

private bool MeetsSpecialRequirements(int questId, FleetData fleet)
{
switch (questId)
{
case 329:
return fleet.MembersInstance.Count(s => s.MasterShip.ShipType == ShipTypes.Destroyer ||
s.MasterShip.ShipType == ShipTypes.Escort) >= 2;

case 330:
return fleet.MembersInstance[0].MasterShip.IsAircraftCarrier &&
fleet.MembersInstance.Count(s => s.MasterShip.IsAircraftCarrier) >= 2 &&
fleet.MembersInstance.Count(s => s.MasterShip.ShipType == ShipTypes.Destroyer) >= 2;

case 337:
return fleet.MembersInstance.Any(s => s.MasterShip.BaseShip().ShipID == (int) ShipId.Kagerou) &&
fleet.MembersInstance.Any(s => s.MasterShip.BaseShip().ShipID == (int) ShipId.Shiranui) &&
fleet.MembersInstance.Any(s => s.MasterShip.BaseShip().ShipID == (int) ShipId.Arare) &&
fleet.MembersInstance.Any(s => s.MasterShip.BaseShip().ShipID == (int) ShipId.Kasumi);
}

return true;
}

public override string GetClearCondition()
{
Expand Down
25 changes: 25 additions & 0 deletions ElectronicObserver/Data/Quest/ProgressSpecialBattle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,31 @@ public override void Increment(string rank, int areaID, bool isBoss)
isAccepted =
memberstype.Any(t => t == ShipTypes.LightAircraftCarrier || t == ShipTypes.AircraftCarrier || t == ShipTypes.ArmoredAircraftCarrier);
break;

//|840|【節分任務】令和二年節分作戦|1-4・2-1・2-2ボスA勝利各1|旗艦(軽母or軽巡)1/(駆逐or海防)3
case 840:
isAccepted = (memberstype[0] == ShipTypes.LightAircraftCarrier ||
memberstype[0] == ShipTypes.LightCruiser) &&
memberstype.Count(t => t == ShipTypes.Escort || t == ShipTypes.Destroyer) >= 3;
break;

//|841|【節分任務】令和二年西方海域節分作戦|4-1・4-2・4-3ボスS勝利各1|旗艦(水母or重巡級)1/駆逐2
case 841:
isAccepted = (memberstype[0] == ShipTypes.SeaplaneTender ||
memberstype[0] == ShipTypes.HeavyCruiser ||
memberstype[0] == ShipTypes.AviationCruiser) &&
memberstype.Count(t => t == ShipTypes.Destroyer) >= 2;
break;

//|843|【節分拡張任務】令和二年節分作戦、全力出撃!|5-4・5-5・6-4ボスS勝利各1|旗艦(戦艦or航空母)1/駆逐2
case 843:
isAccepted = (memberstype[0] == ShipTypes.Battleship ||
memberstype[0] == ShipTypes.AviationBattleship ||
memberstype[0] == ShipTypes.Battlecruiser ||
memberstype[0] == ShipTypes.AircraftCarrier ||
memberstype[0] == ShipTypes.ArmoredAircraftCarrier) &&
memberstype.Count(t => t == ShipTypes.Destroyer) >= 2;
break;
}

// 第二ゲージでも第一ボスに行ける場合があるので、個別対応が必要
Expand Down
34 changes: 34 additions & 0 deletions ElectronicObserver/Data/Quest/QuestProgressManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,31 @@ void QuestUpdated(string apiname, dynamic data)
}));
break;

case 840: //|840|【節分任務】令和二年節分作戦|1-4・2-1・2-2ボスA勝利各1|旗艦(軽母or軽巡)1/(駆逐or海防)3
Progresses.Add(new ProgressMultiBattle(q, new[]
{
new ProgressSpecialBattle(q, 1, "A", new[]{ 14 }, true),
new ProgressSpecialBattle(q, 1, "A", new[]{ 21 }, true),
new ProgressSpecialBattle(q, 1, "A", new[]{ 22 }, true),
}));
break;
case 841: //|841|【節分任務】令和二年西方海域節分作戦|4-1・4-2・4-3ボスS勝利各1|旗艦(水母or重巡)1/駆逐2
Progresses.Add(new ProgressMultiBattle(q, new[]
{
new ProgressSpecialBattle(q, 1, "S", new[]{ 41 }, true),
new ProgressSpecialBattle(q, 1, "S", new[]{ 42 }, true),
new ProgressSpecialBattle(q, 1, "S", new[]{ 43 }, true),
}));
break;
case 843: //|843|【節分拡張任務】令和二年節分作戦、全力出撃!|5-4・5-5・6-4ボスS勝利各1|旗艦(戦艦or航空母)1/駆逐2
Progresses.Add(new ProgressMultiBattle(q, new[]
{
new ProgressSpecialBattle(q, 1, "S", new[]{ 54 }, true),
new ProgressSpecialBattle(q, 1, "S", new[]{ 55 }, true),
new ProgressSpecialBattle(q, 1, "S", new[]{ 64 }, true),
}));
break;

case 303: //|303|「演習」で練度向上!|演習3
Progresses.Add(new ProgressPractice(q, 3, false));
break;
Expand All @@ -398,6 +423,15 @@ void QuestUpdated(string apiname, dynamic data)
case 311: //|311|精鋭艦隊演習|演習勝利7|マンスリーだが1日で進捗リセット
Progresses.Add(new ProgressPractice(q, 7, true));
break;
case 329: //|329|【節分任務】節分演習!|演習S勝利3|(駆逐or海防)2
Progresses.Add(new ProgressPractice(q, 3, "S"));
break;
case 330: //|330|空母機動部隊、演習始め!|演習B勝利4|旗艦空母/空母1/駆逐2|クォータリーだが1日で進捗リセット
Progresses.Add(new ProgressPractice(q, 4, "B"));
break;
case 337: //|337|「十八駆」演習!|演習S勝利3|霞/霰/陽炎/不知火|クォータリーだが1日で進捗リセット
Progresses.Add(new ProgressPractice(q, 3, "S"));
break;

case 402: //|402|「遠征」を3回成功させよう!|遠征成功3
Progresses.Add(new ProgressExpedition(q, 3, null));
Expand Down
2 changes: 1 addition & 1 deletion ElectronicObserver/Data/QuestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public override void LoadFromResponse(string apiname, dynamic data)
//周期任務削除
if (DateTimeHelper.IsCrossedDay(progress.LastUpdateTime, 5, 0, 0))
{
progress.Progresses.RemoveAll(p => (p.QuestType == 1 || p.QuestID == 211 /* 空母3 */ || p.QuestID == 212 /* 輸送5 */ || p.QuestID == 311 /* 演習勝利7 */ ));
progress.Progresses.RemoveAll(p => (p.QuestType == 1 || p.QuestID == 211 /* 空母3 */ || p.QuestID == 212 /* 輸送5 */ || p.QuestID == 311 /* 演習勝利7 */ || p.QuestID == 330 ||p.QuestID == 337));
Quests.RemoveAll(q => q.Type == 1 || q.QuestID == 211 /* 空母3 */ || q.QuestID == 212 /* 輸送5 */ || q.QuestID == 311 /* 演習勝利7 */ );
}
if (DateTimeHelper.IsCrossedWeek(progress.LastUpdateTime, DayOfWeek.Monday, 5, 0, 0))
Expand Down
10 changes: 10 additions & 0 deletions ElectronicObserver/Data/ShipDataMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,17 @@ public ShipDataMaster()
RemodelBeforeShipID = 0;
}

public ShipDataMaster BaseShip()
{
ShipDataMaster ship = this;

while (ship.RemodelBeforeShip != null)
{
ship = ship.RemodelBeforeShip;
}

return ship;
}

public int ID => ShipID;

Expand Down