protected virtual AirFireInfo getAntiAirFireAttacker(BattleBaseData baseData) { List <Mem_ship> shipData = baseData.ShipData; List <List <Mst_slotitem> > slotData = baseData.SlotData; List <AirFireInfo> list = new List <AirFireInfo>(); for (int i = 0; i < shipData.Count; i++) { if (shipData[i].IsFight() && slotData[i].Count != 0) { AirFireInfo antifireKind = getAntifireKind(shipData[i], slotData[i]); if (antifireKind != null) { list.Add(antifireKind); } } } if (list.Count == 0) { return(null); } IOrderedEnumerable <AirFireInfo> source = from x in list orderby x.AirFireKind select x; return(source.First()); }
protected void _CalcStage2() { if (_data.Air2 == null) { return; } Random random = new Random(); if (_planes_f.Count > 0) { int lost = Stage2_LostCount_f; while (lost > 0) { List <PlaneModelBase> list = _planes_f.FindAll((PlaneModelBase plane) => plane.Power_Stage2End > 0); if (list.Count > 0) { PlaneModelBase planeModelBase = list[random.Next(list.Count)]; planeModelBase.SetStage2Lost(ref lost); } } } if (_planes_e.Count > 0) { int lost2 = Stage2_LostCount_e; while (lost2 > 0) { List <PlaneModelBase> list2 = _planes_e.FindAll((PlaneModelBase plane) => plane.Power_Stage2End > 0); if (list2.Count > 0) { PlaneModelBase planeModelBase2 = list2[random.Next(list2.Count)]; planeModelBase2.SetStage2Lost(ref lost2); } } } if (_data.Air2.F_AntiFire != null) { AirFireInfo info = _data.Air2.F_AntiFire; _taiku_ship_f = _ships_f.Find((ShipModel_BattleAll ship) => ship.TmpId == info.AttackerId).__CreateAttacker__(); _taiku_slotitems_f = new List <SlotitemModel_Battle>(); for (int i = 0; i < info.UseItems.Count; i++) { _taiku_slotitems_f.Add(new SlotitemModel_Battle(info.UseItems[i])); } } if (_data.Air2.E_AntiFire != null) { AirFireInfo info2 = _data.Air2.E_AntiFire; _taiku_ship_e = _ships_e.Find((ShipModel_BattleAll ship) => ship.TmpId == info2.AttackerId).__CreateAttacker__(); _taiku_slotitems_e = new List <SlotitemModel_Battle>(); for (int j = 0; j < info2.UseItems.Count; j++) { _taiku_slotitems_e.Add(new SlotitemModel_Battle(info2.UseItems[j])); } } }
protected void _CalcStage2() { if (this._data.Air2 == null) { return; } Random random = new Random(); if (this._planes_f.get_Count() > 0) { int i = this.Stage2_LostCount_f; while (i > 0) { List <PlaneModelBase> list = this._planes_f.FindAll((PlaneModelBase plane) => plane.Power_Stage2End > 0); if (list.get_Count() > 0) { PlaneModelBase planeModelBase = list.get_Item(random.Next(list.get_Count())); planeModelBase.SetStage2Lost(ref i); } } } if (this._planes_e.get_Count() > 0) { int j = this.Stage2_LostCount_e; while (j > 0) { List <PlaneModelBase> list2 = this._planes_e.FindAll((PlaneModelBase plane) => plane.Power_Stage2End > 0); if (list2.get_Count() > 0) { PlaneModelBase planeModelBase2 = list2.get_Item(random.Next(list2.get_Count())); planeModelBase2.SetStage2Lost(ref j); } } } if (this._data.Air2.F_AntiFire != null) { AirFireInfo info = this._data.Air2.F_AntiFire; this._taiku_ship_f = this._ships_f.Find((ShipModel_BattleAll ship) => ship.TmpId == info.AttackerId).__CreateAttacker__(); this._taiku_slotitems_f = new List <SlotitemModel_Battle>(); for (int k = 0; k < info.UseItems.get_Count(); k++) { this._taiku_slotitems_f.Add(new SlotitemModel_Battle(info.UseItems.get_Item(k))); } } if (this._data.Air2.E_AntiFire != null) { AirFireInfo info = this._data.Air2.E_AntiFire; this._taiku_ship_e = this._ships_e.Find((ShipModel_BattleAll ship) => ship.TmpId == info.AttackerId).__CreateAttacker__(); this._taiku_slotitems_e = new List <SlotitemModel_Battle>(); for (int l = 0; l < info.UseItems.get_Count(); l++) { this._taiku_slotitems_e.Add(new SlotitemModel_Battle(info.UseItems.get_Item(l))); } } }
protected override int battleTaiku(List <Mem_ship> taikuHaveShip, int deckTyku, AirFireInfo antifire) { return(base.battleTaiku(taikuHaveShip, deckTyku, null)); }
protected virtual int battleTaiku(List <Mem_ship> taikuHaveShip, int deckTyku, AirFireInfo antifire) { IEnumerable <KeyValuePair <Mem_ship, List <FighterInfo> > > enumerable; Dictionary <int, int[]> slotExperience; List <Mem_ship> shipData; List <List <Mst_slotitem> > slotData; List <List <int> > slotLevel; double num; if (taikuHaveShip[0].IsEnemy()) { enumerable = from item in e_FighterInfo where taikuHaveShip.Contains(item.Key) select item; slotExperience = E_Data.SlotExperience; shipData = F_Data.ShipData; slotData = F_Data.SlotData; slotLevel = F_Data.SlotLevel; num = 0.75; } else { enumerable = from item in f_FighterInfo where taikuHaveShip.Contains(item.Key) select item; slotExperience = F_Data.SlotExperience; shipData = E_Data.ShipData; slotData = E_Data.SlotData; slotLevel = E_Data.SlotLevel; num = 0.8; } int num2 = 0; IEnumerable <Mem_ship> enumerable2 = from x in shipData where x.IsFight() select x; if (enumerable2 == null || enumerable2.Count() == 0) { return(num2); } foreach (KeyValuePair <Mem_ship, List <FighterInfo> > item in enumerable) { Mem_ship key = item.Key; foreach (FighterInfo item2 in item.Value) { if (key.Onslot[item2.SlotIdx] > 0 && item2.ValidTaiku()) { Mem_ship taikuShip = (from x in enumerable2 orderby Guid.NewGuid() select x).First(); int index = shipData.FindIndex((Mem_ship x) => x.Rid == taikuShip.Rid); double shipTaikuPow = getShipTaikuPow(taikuShip, slotData[index], slotLevel[index]); double num3 = valance1; double num4 = (shipTaikuPow + (double)deckTyku) * num3 * num; double[] antifireParam = getAntifireParam(antifire); if (antifire == null && taikuShip.IsEnemy()) { antifireParam[0] = 0.0; } int num5 = (int)(num4 * (double)randInstance.Next(2) * antifireParam[2] + antifireParam[0]); int num6 = (int)((double)key.Onslot[item2.SlotIdx] * 0.02 * shipTaikuPow * num3 * (double)randInstance.Next(2) + antifireParam[1]); int num7 = num5 + num6; if (num7 > key.Onslot[item2.SlotIdx]) { num7 = key.Onslot[item2.SlotIdx]; } int[] value = null; if (slotExperience.TryGetValue(key.Slot[item2.SlotIdx], out value)) { int slotExpSubValueToTaiku = getSlotExpSubValueToTaiku(key.Onslot[item2.SlotIdx], num7, value[0]); value[1] += slotExpSubValueToTaiku; } List <int> onslot; List <int> list = onslot = key.Onslot; int slotIdx; int index2 = slotIdx = item2.SlotIdx; slotIdx = onslot[slotIdx]; list[index2] = slotIdx - num7; num2 += num7; } } } return(num2); }
private double[] getAntifireParam(AirFireInfo info) { if (info == null) { return(new double[3] { 1.0, 0.0, 1.0 }); } Dictionary <int, double[]> dictionary = new Dictionary <int, double[]>(); dictionary.Add(1, new double[3] { 3.0, 5.0, 1.75 }); dictionary.Add(2, new double[3] { 3.0, 4.0, 1.7 }); dictionary.Add(3, new double[3] { 2.0, 3.0, 1.6 }); dictionary.Add(4, new double[3] { 5.0, 2.0, 1.5 }); dictionary.Add(5, new double[3] { 2.0, 3.0, 1.55 }); dictionary.Add(6, new double[3] { 4.0, 1.0, 1.5 }); dictionary.Add(7, new double[3] { 2.0, 2.0, 1.35 }); dictionary.Add(8, new double[3] { 2.0, 3.0, 1.45 }); dictionary.Add(9, new double[3] { 1.0, 2.0, 1.3 }); dictionary.Add(10, new double[3] { 3.0, 6.0, 1.65 }); dictionary.Add(11, new double[3] { 2.0, 5.0, 1.5 }); dictionary.Add(12, new double[3] { 1.0, 3.0, 1.25 }); dictionary.Add(13, new double[3] { 1.0, 4.0, 1.35 }); Dictionary <int, double[]> dictionary2 = dictionary; return(dictionary2[info.AirFireKind]); }
private AirFireInfo getAntifireKind(Mem_ship shipData, List <Mst_slotitem> slotData) { Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship[shipData.Ship_id]; ILookup <int, Mst_slotitem> lookup = slotData.ToLookup((Mst_slotitem x) => x.Type4); HashSet <int> hashSet = new HashSet <int>(); hashSet.Add(54); HashSet <int> hashSet2 = hashSet; hashSet = new HashSet <int>(); hashSet.Add(428); HashSet <int> hashSet3 = hashSet; AirFireInfo result = null; Dictionary <int, int> dictionary = new Dictionary <int, int>(); dictionary.Add(1, 65); dictionary.Add(2, 58); dictionary.Add(3, 50); dictionary.Add(4, 52); dictionary.Add(5, 55); dictionary.Add(6, 40); dictionary.Add(7, 45); dictionary.Add(8, 50); dictionary.Add(9, 40); dictionary.Add(10, 60); dictionary.Add(11, 55); dictionary.Add(12, 45); dictionary.Add(13, 35); Dictionary <int, int> dictionary2 = dictionary; int num = (int)Utils.GetRandDouble(0.0, 100.0, 1.0, 1); List <int> list = new List <int>(); if (hashSet2.Contains(mst_ship.Ctype)) { if (!lookup.Contains(16)) { return(null); } List <Mst_slotitem> list2 = lookup[16].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 8); List <Mst_slotitem> list3 = new List <Mst_slotitem>(); if (lookup.Contains(11)) { list3 = lookup[11].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 2); } if (list2.Count >= 2 && list3.Count >= 1 && num < dictionary2[1]) { list.Add(list2[0].Id); list.Add(list2[1].Id); list.Add(list3[0].Id); result = new AirFireInfo(shipData.Rid, 1, list); } else if (list2.Count >= 1 && list3.Count >= 1 && num < dictionary2[2]) { list.Add(list2[0].Id); list.Add(list3[0].Id); result = new AirFireInfo(shipData.Rid, 2, list); } else if (list2.Count >= 2 && num < dictionary2[3]) { list.Add(list2[0].Id); list.Add(list2[1].Id); result = new AirFireInfo(shipData.Rid, 3, list); } return(result); } if (hashSet3.Contains(mst_ship.Id) && lookup.Contains(16) && lookup.Contains(15)) { List <Mst_slotitem> list4 = lookup[16].ToList(); List <Mst_slotitem> list5 = lookup[15].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 9); List <Mst_slotitem> list6 = new List <Mst_slotitem>(); if (lookup.Contains(11)) { list6 = lookup[11].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 2); } if (list5.Count > 0 && list6.Count > 0 && num < dictionary2[10]) { list.Add(list4[0].Id); list.Add(list5[0].Id); list.Add(list6[0].Id); return(new AirFireInfo(shipData.Rid, 10, list)); } if (list5.Count > 0 && num < dictionary2[11]) { list.Add(list4[0].Id); list.Add(list5[0].Id); return(new AirFireInfo(shipData.Rid, 11, list)); } } List <Mst_slotitem> list7 = new List <Mst_slotitem>(); if (lookup.Contains(16)) { list7 = lookup[16].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 8); } List <Mst_slotitem> list8 = new List <Mst_slotitem>(); if (lookup.Contains(11)) { list8 = lookup[11].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 2); } if (lookup.Contains(30) && lookup.Contains(3) && lookup.Contains(12) && list8.Count >= 1 && num < dictionary2[4]) { list.Add(lookup[3].First().Id); list.Add(lookup[12].First().Id); list.Add(lookup[30].First().Id); return(new AirFireInfo(shipData.Rid, 4, list)); } if (list7.Count >= 2 && list8.Count >= 1 && num < dictionary2[5]) { list.Add(list7[0].Id); list.Add(list7[1].Id); list.Add(list8[0].Id); return(new AirFireInfo(shipData.Rid, 5, list)); } if (lookup.Contains(30) && lookup.Contains(3) && lookup.Contains(12) && num < dictionary2[6]) { list.Add(lookup[3].First().Id); list.Add(lookup[12].First().Id); list.Add(lookup[30].First().Id); return(new AirFireInfo(shipData.Rid, 6, list)); } if (lookup.Contains(30) && lookup.Contains(16) && list8.Count >= 1 && num < dictionary2[7]) { Mst_slotitem mst_slotitem = (list7.Count <= 0) ? lookup[16].First() : list7[0]; list.Add(mst_slotitem.Id); list.Add(lookup[30].First().Id); list.Add(list8[0].Id); return(new AirFireInfo(shipData.Rid, 7, list)); } if (list7.Count >= 1 && list8.Count >= 1 && num < dictionary2[8]) { list.Add(list7[0].Id); list.Add(list8[0].Id); return(new AirFireInfo(shipData.Rid, 8, list)); } if (lookup.Contains(30) && lookup.Contains(16) && num < dictionary2[9]) { Mst_slotitem mst_slotitem2 = (list7.Count <= 0) ? lookup[16].First() : list7[0]; list.Add(mst_slotitem2.Id); list.Add(lookup[30].First().Id); return(new AirFireInfo(shipData.Rid, 9, list)); } List <Mst_slotitem> list9 = new List <Mst_slotitem>(); new List <Mst_slotitem>(); List <Mst_slotitem> list10 = new List <Mst_slotitem>(); if (lookup.Contains(15)) { list9 = lookup[15].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 9); List <Mst_slotitem> collection = lookup[15].ToList().FindAll((Mst_slotitem x) => x.Tyku >= 3); list10.AddRange(list9); list10.AddRange(collection); } if (list10.Count >= 2 && list8.Count >= 1 && num < dictionary2[12]) { list.Add(list10[0].Id); list.Add(list10[1].Id); list.Add(list8[0].Id); return(new AirFireInfo(shipData.Rid, 12, list)); } if (hashSet3.Contains(mst_ship.Id)) { return(result); } if (list7.Count >= 1 && list9.Count >= 1 && list8.Count >= 1 && num < dictionary2[13]) { list.Add(list7[0].Id); list.Add(list9[0].Id); list.Add(list8[0].Id); return(new AirFireInfo(shipData.Rid, 13, list)); } return(result); }