protected virtual BattleHitStatus getHitStatus(int hitProb, int avoProb, Mem_ship attackShip, Mem_ship targetShip, double cliticalKeisu, bool airAttack) { double num = hitProb - avoProb; FatigueState fatigueState = targetShip.Get_FatigueState(); if (num <= 10.0) { num = 10.0; } double num2 = 1.0; switch (fatigueState) { case FatigueState.Exaltation: num2 = 0.7; break; case FatigueState.Normal: num2 = 1.0; break; case FatigueState.Light: num2 = 1.2; break; case FatigueState.Distress: num2 = 1.4; break; } num *= num2; if (num >= 96.0) { num = 96.0; } double cht = 0.0; double cht2 = 1.0; if (airAttack) { setCliticalAlv(ref num, ref cht, ref cht2, attackShip); } int num3 = randInstance.Next(100); double num4 = Math.Sqrt(num) * cliticalKeisu; if ((double)num3 <= num4) { return(BattleHitStatus.Clitical); } if ((double)num3 > num) { return(BattleHitStatus.Miss); } return(BattleHitStatus.Normal); }
protected override int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow) { int num = 0; using (var enumerator = Enumerable.Select(atk_slot, (Mst_slotitem obj, int idx) => new { obj, idx }).GetEnumerator()) { while (enumerator.MoveNext()) { var current = enumerator.get_Current(); num += current.obj.Houm; } } double num2 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt((double)atk_ship.Level) * 2.0 + (double)num; num2 += (double)((int)((double)atk_pow * 0.35)); num2 = this.valance2 + num2; BattleFormationKinds1 formation; BattleFormationKinds1 formation2; if (!atk_ship.IsEnemy()) { formation = this.F_Data.Formation; formation2 = this.E_Data.Formation; } else { formation = this.E_Data.Formation; formation2 = this.F_Data.Formation; } double formationParamF = this.formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2); num2 *= formationParamF; FatigueState fatigueState = atk_ship.Get_FatigueState(); double num3 = 1.0; if (fatigueState == FatigueState.Exaltation) { num3 = 1.3; } else if (fatigueState == FatigueState.Light) { num3 = 0.7; } else if (fatigueState == FatigueState.Distress) { num3 = 0.35; } num2 *= num3; return((int)num2); }
protected override int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow) { int num = 0; foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new { obj, idx })) { num += item.obj.Houm; } double num2 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num; num2 += (double)(int)((double)atk_pow * 0.35); num2 = valance2 + num2; BattleFormationKinds1 formation; BattleFormationKinds1 formation2; if (!atk_ship.IsEnemy()) { formation = F_Data.Formation; formation2 = E_Data.Formation; } else { formation = E_Data.Formation; formation2 = F_Data.Formation; } double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2); num2 *= formationParamF; FatigueState fatigueState = atk_ship.Get_FatigueState(); double num3 = 1.0; switch (fatigueState) { case FatigueState.Exaltation: num3 = 1.3; break; case FatigueState.Light: num3 = 0.7; break; case FatigueState.Distress: num3 = 0.35; break; } num2 *= num3; return((int)num2); }
private int getMidnightHitProb(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, List <int> deckSearchLight) { List <int> list; if (atk_ship.IsEnemy()) { int deckIdx = this.E_SubInfo.get_Item(atk_ship.Rid).DeckIdx; list = this.E_Data.SlotLevel.get_Item(deckIdx); } else { int deckIdx2 = this.F_SubInfo.get_Item(atk_ship.Rid).DeckIdx; list = this.F_Data.SlotLevel.get_Item(deckIdx2); } double num = 0.0; int num2 = 0; using (var enumerator = Enumerable.Select(atk_slot, (Mst_slotitem obj, int idx) => new { obj, idx }).GetEnumerator()) { while (enumerator.MoveNext()) { var current = enumerator.get_Current(); num2 += current.obj.Houm; num += this.getSlotPlus_HitProb(current.obj, list.get_Item(current.idx)); } } double num3 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt((double)atk_ship.Level) * 2.0 + (double)num2; double num4 = (!atk_ship.IsEnemy()) ? this.fValance2 : this.eValance2; num3 = num4 + num3; BattleFormationKinds1 formation; BattleFormationKinds1 formation2; if (!atk_ship.IsEnemy()) { formation = this.F_Data.Formation; formation2 = this.E_Data.Formation; } else { formation = this.E_Data.Formation; formation2 = this.F_Data.Formation; } double formationParamF = this.formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.MIDNIGHT, formation, formation2); num3 = num3 * this.spHitProbKeisu.get_Item(kind) * formationParamF; FatigueState fatigueState = atk_ship.Get_FatigueState(); double num5 = 1.0; if (fatigueState == FatigueState.Exaltation) { num5 = 1.2; } else if (fatigueState == FatigueState.Light) { num5 = 0.8; } else if (fatigueState == FatigueState.Distress) { num5 = 0.5; } num3 *= num5; if (atk_ship.Stype == 5 || atk_ship.Stype == 6) { int num6 = 0; if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem.get_Item(6))) { num6 = 10; } else if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem.get_Item(50))) { num6 = 15; } num3 += (double)num6; } if (deckSearchLight.get_Count() > 0) { num3 += 7.0; } num3 = this.getMidnightHitProbUpValue(num3, atk_ship, atk_slot); return((int)num3); }
protected virtual int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow) { double num = 0.0; List <int> list; BattleFormationKinds1 formation; BattleFormationKinds1 formation2; if (!atk_ship.IsEnemy()) { list = F_Data.SlotLevel[F_SubInfo[atk_ship.Rid].DeckIdx]; formation = F_Data.Formation; formation2 = E_Data.Formation; num = (double)commandParams.Tspp / 100.0; } else { list = E_Data.SlotLevel[E_SubInfo[atk_ship.Rid].DeckIdx]; formation = E_Data.Formation; formation2 = F_Data.Formation; } double num2 = 0.0; int num3 = 0; foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new { obj, idx })) { num3 += item.obj.Houm; num2 += getSlotPlus_HitProb(item.obj, list[item.idx]); } int raim = Mst_DataManager.Instance.Mst_ship[atk_ship.Ship_id].Raim; double num4 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num3; num4 = num4 + (double)(int)((double)atk_pow * 0.2) + (double)raim; num4 = valance2 + num4 + num2; double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2); num4 *= formationParamF; FatigueState fatigueState = atk_ship.Get_FatigueState(); double num5 = 1.0; switch (fatigueState) { case FatigueState.Exaltation: num5 = 1.3; break; case FatigueState.Light: num5 = 0.7; break; case FatigueState.Distress: num5 = 0.35; break; } num4 *= num5; double num6 = num4 * num; num4 += num6; return((int)num4); }
protected virtual int getHougHitProb(BattleAtackKinds_Day kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int tekkouKind) { double num = 0.0; BattleFormationKinds1 formation; BattleFormationKinds1 formation2; List <int> list; if (!atk_ship.IsEnemy()) { formation = F_Data.Formation; formation2 = E_Data.Formation; int deckIdx = F_SubInfo[atk_ship.Rid].DeckIdx; list = F_Data.SlotLevel[deckIdx]; num = (double)commandParams.Fspp / 100.0; } else { formation = E_Data.Formation; formation2 = F_Data.Formation; int deckIdx2 = E_SubInfo[atk_ship.Rid].DeckIdx; list = E_Data.SlotLevel[deckIdx2]; } double num2 = 0.0; int num3 = 0; foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new { obj, idx })) { num3 += item.obj.Houm; num2 += getHougSlotPlus_Hit(item.obj, list[item.idx]); } double num4 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num3; double num5 = valance2 + num4 + num2; double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.HOUGEKI, formation, formation2); num5 *= formationParamF; FatigueState fatigueState = atk_ship.Get_FatigueState(); double num6 = 1.0; switch (fatigueState) { case FatigueState.Exaltation: num6 = 1.2; break; case FatigueState.Light: num6 = 0.8; break; case FatigueState.Distress: num6 = 0.5; break; } num5 *= num6; num5 = getHougHitProbUpValue(num5, atk_ship, atk_slot); Dictionary <BattleAtackKinds_Day, double> dictionary = new Dictionary <BattleAtackKinds_Day, double>(); dictionary.Add(BattleAtackKinds_Day.Renzoku, 1.1); dictionary.Add(BattleAtackKinds_Day.Sp1, 1.3); dictionary.Add(BattleAtackKinds_Day.Sp2, 1.5); dictionary.Add(BattleAtackKinds_Day.Sp3, 1.3); dictionary.Add(BattleAtackKinds_Day.Sp4, 1.2); Dictionary <BattleAtackKinds_Day, double> dictionary2 = dictionary; if (dictionary2.ContainsKey(kind)) { num5 *= dictionary2[kind]; } num5 *= getTekkouKeisu_Hit(tekkouKind); double num7 = num5 * num; num5 += num7; return((int)num5); }
private void setResultKind() { if (this.mem_deck.MissionState == MissionStates.STOP) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } if (this.mst_mission.Flagship_level > 0) { FatigueState fatigueState = this.mem_ships.get_Item(0).Get_FatigueState(); if (fatigueState >= FatigueState.Light) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } if (this.mst_mission.Flagship_level > this.mem_ships.get_Item(0).Level) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } } if (this.mst_mission.Flagship_stype1 > 0 && this.mst_mission.Flagship_stype1 != this.mem_ships.get_Item(0).Stype) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } if (this.mst_mission.Tanker_num > 0 && this.missionTanker.get_Count() < this.mst_mission.Tanker_num) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } Dictionary <int, int> dictionary = Enumerable.ToDictionary(Enumerable.Select(Enumerable.Select(Utils.Xml_Result("mst_stype_group", "mst_stype_group", "Id"), (XElement data) => new { data = data, item = new { id = int.Parse(data.Element("Id").get_Value()), type = int.Parse(data.Element("Mission").get_Value()) } }), <> __TranspIdent15 => < > __TranspIdent15.item), obj => obj.id, value => value.type); IEnumerable <int> enumerable = Enumerable.Distinct <int>(dictionary.get_Values()); Dictionary <int, int> dictionary2 = Enumerable.ToDictionary <int, int, int>(enumerable, (int type) => type, (int count) => 0); int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; using (List <Mem_ship> .Enumerator enumerator = this.mem_ships.GetEnumerator()) { while (enumerator.MoveNext()) { Mem_ship current = enumerator.get_Current(); FatigueState fatigueState2 = current.Get_FatigueState(); if (fatigueState2 == FatigueState.Distress) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } Mem_ship arg_251_0 = current; HashSet <int> hashSet = new HashSet <int>(); hashSet.Add(68); hashSet.Add(75); Dictionary <int, int> mstSlotItemNum_OrderId = arg_251_0.GetMstSlotItemNum_OrderId(hashSet); Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(current.Ship_id); this.daihatuNum += mstSlotItemNum_OrderId.get_Item(68); if (mstSlotItemNum_OrderId.get_Item(75) > 0) { this.drumShipNum++; } this.drumNum += mstSlotItemNum_OrderId.get_Item(75); num7 += current.Level; num6 += mst_ship.Bull_max; num5 += mst_ship.Fuel_max; if (fatigueState2 == FatigueState.Light) { num2++; } else { if (fatigueState2 == FatigueState.Exaltation) { num++; } num4 += current.Bull; num3 += current.Fuel; int num8 = dictionary.get_Item(current.Stype); Dictionary <int, int> dictionary3; Dictionary <int, int> expr_326 = dictionary3 = dictionary2; int num9; int expr_32B = num9 = num8; num9 = dictionary3.get_Item(num9); expr_326.set_Item(expr_32B, num9 + 1); } } } if (dictionary2.get_Item(1) < this.mst_mission.Stype_num1 || dictionary2.get_Item(2) < this.mst_mission.Stype_num2 || dictionary2.get_Item(3) < this.mst_mission.Stype_num3 || dictionary2.get_Item(4) < this.mst_mission.Stype_num4 || dictionary2.get_Item(5) < this.mst_mission.Stype_num5 || dictionary2.get_Item(6) < this.mst_mission.Stype_num6 || dictionary2.get_Item(7) < this.mst_mission.Stype_num7 || dictionary2.get_Item(8) < this.mst_mission.Stype_num8 || dictionary2.get_Item(9) < this.mst_mission.Stype_num9) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } if (this.mst_mission.Deck_num > 0) { int num10 = this.mem_ships.get_Count() - num2; if (num10 < this.mst_mission.Deck_num) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } } if (num7 < this.mst_mission.Level) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } if (this.drumShipNum < this.mst_mission.Drum_ship_num || this.drumNum < this.mst_mission.Drum_total_num1) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } double num11 = (double)(num3 + num4); double num12 = (double)(num5 + num6); double num13 = num11 / num12 * 100.0; int num14 = (int)(num13 + (double)this.randInstance.Next(20)); if (num14 < 100) { this.resultInfo.MissionResult = MissionResultKinds.FAILE; return; } if (num2 > 0) { this.resultInfo.MissionResult = MissionResultKinds.SUCCESS; return; } if (!this.mst_mission.IsGreatSuccessCondition() && num < this.mem_ships.get_Count()) { this.resultInfo.MissionResult = MissionResultKinds.SUCCESS; return; } int drumKeisu = 0; if (this.mst_mission.Drum_total_num2 > 0) { drumKeisu = ((this.drumNum < this.mst_mission.Drum_total_num2) ? -15 : 20); } if (this.mst_mission.Flagship_stype2 > 0 && this.mst_mission.Flagship_stype2 != this.mem_ships.get_Item(0).Stype) { this.resultInfo.MissionResult = MissionResultKinds.SUCCESS; return; } int checkRate = this.getCheckRate(num, drumKeisu); int num15 = this.randInstance.Next(100); if (checkRate >= num15) { this.resultInfo.MissionResult = MissionResultKinds.GREAT; return; } this.resultInfo.MissionResult = MissionResultKinds.SUCCESS; return; }
protected int getSubmarineHitProb(Mem_ship attackShip, List <Mst_slotitem> attackSlot, List <int> slotLevels) { BattleFormationKinds1 formation; BattleFormationKinds1 formation2; if (!attackShip.IsEnemy()) { formation = F_Data.Formation; BattleFormationKinds2 battleFormation = F_Data.BattleFormation; formation2 = E_Data.Formation; } else { formation = E_Data.Formation; BattleFormationKinds2 battleFormation2 = E_Data.BattleFormation; formation2 = F_Data.Formation; } int num = 0; double num2 = 0.0; foreach (var item in attackSlot.Select((Mst_slotitem obj, int idx) => new { obj, idx })) { if (item.obj.Api_mapbattle_type3 == 14) { num += item.obj.Tais; } if ((item.obj.Api_mapbattle_type3 == 14 || item.obj.Api_mapbattle_type3 == 15 || item.obj.Api_mapbattle_type3 == 40) && slotLevels[item.idx] > 0) { num2 += Math.Sqrt(slotLevels[item.idx]) * 1.3; } } double num3 = Math.Sqrt((double)attackShip.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(attackShip.Level * 2) + (double)num * 2.0; double num4 = valanceSubmarine2 + num3 + num2; double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.SUBMARINE, formation, formation2); num4 *= formationParamF; FatigueState fatigueState = attackShip.Get_FatigueState(); double num5 = 1.0; switch (fatigueState) { case FatigueState.Exaltation: num5 = 1.2; break; case FatigueState.Normal: num5 = 1.0; break; case FatigueState.Light: num5 = 0.8; break; case FatigueState.Distress: num5 = 0.5; break; } double num6 = num4 * num5; if (practiceFlag) { num6 *= 1.5; } return((int)num6); }
private int getMidnightHitProb(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, List <int> deckSearchLight) { List <int> list; if (atk_ship.IsEnemy()) { int deckIdx = E_SubInfo[atk_ship.Rid].DeckIdx; list = E_Data.SlotLevel[deckIdx]; } else { int deckIdx2 = F_SubInfo[atk_ship.Rid].DeckIdx; list = F_Data.SlotLevel[deckIdx2]; } double num = 0.0; int num2 = 0; foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new { obj, idx })) { num2 += item.obj.Houm; num += getSlotPlus_HitProb(item.obj, list[item.idx]); } double num3 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num2; double num4 = (!atk_ship.IsEnemy()) ? fValance2 : eValance2; num3 = num4 + num3; BattleFormationKinds1 formation; BattleFormationKinds1 formation2; if (!atk_ship.IsEnemy()) { formation = F_Data.Formation; formation2 = E_Data.Formation; } else { formation = E_Data.Formation; formation2 = F_Data.Formation; } double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.MIDNIGHT, formation, formation2); num3 = num3 * spHitProbKeisu[kind] * formationParamF; FatigueState fatigueState = atk_ship.Get_FatigueState(); double num5 = 1.0; switch (fatigueState) { case FatigueState.Exaltation: num5 = 1.2; break; case FatigueState.Light: num5 = 0.8; break; case FatigueState.Distress: num5 = 0.5; break; } num3 *= num5; if (atk_ship.Stype == 5 || atk_ship.Stype == 6) { int num6 = 0; if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem[6])) { num6 = 10; } else if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem[50])) { num6 = 15; } num3 += (double)num6; } if (deckSearchLight.Count > 0) { num3 += 7.0; } num3 = getMidnightHitProbUpValue(num3, atk_ship, atk_slot); return((int)num3); }
protected virtual int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow) { double num = 0.0; List <int> list; BattleFormationKinds1 formation; BattleFormationKinds1 formation2; if (!atk_ship.IsEnemy()) { list = this.F_Data.SlotLevel.get_Item(this.F_SubInfo.get_Item(atk_ship.Rid).DeckIdx); formation = this.F_Data.Formation; formation2 = this.E_Data.Formation; num = (double)this.commandParams.Tspp / 100.0; } else { list = this.E_Data.SlotLevel.get_Item(this.E_SubInfo.get_Item(atk_ship.Rid).DeckIdx); formation = this.E_Data.Formation; formation2 = this.F_Data.Formation; } double num2 = 0.0; int num3 = 0; using (var enumerator = Enumerable.Select(atk_slot, (Mst_slotitem obj, int idx) => new { obj, idx }).GetEnumerator()) { while (enumerator.MoveNext()) { var current = enumerator.get_Current(); num3 += current.obj.Houm; num2 += this.getSlotPlus_HitProb(current.obj, list.get_Item(current.idx)); } } int raim = Mst_DataManager.Instance.Mst_ship.get_Item(atk_ship.Ship_id).Raim; double num4 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt((double)atk_ship.Level) * 2.0 + (double)num3; num4 = num4 + (double)((int)((double)atk_pow * 0.2)) + (double)raim; num4 = this.valance2 + num4 + num2; double formationParamF = this.formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2); num4 *= formationParamF; FatigueState fatigueState = atk_ship.Get_FatigueState(); double num5 = 1.0; if (fatigueState == FatigueState.Exaltation) { num5 = 1.3; } else if (fatigueState == FatigueState.Light) { num5 = 0.7; } else if (fatigueState == FatigueState.Distress) { num5 = 0.35; } num4 *= num5; double num6 = num4 * num; num4 += num6; return((int)num4); }