测试优化

This commit is contained in:
milimoe 2025-05-12 01:06:59 +08:00
parent 995c3057d0
commit 8f0aa1d3c7
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E

View File

@ -57,7 +57,7 @@ namespace Oshima.FunGame.OshimaServers.Service
} }
} }
public static async Task<List<string>> StartSimulationGame(bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, int maxRespawnTimesMix = 1) public static async Task<List<string>> StartSimulationGame(bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, int maxRespawnTimesMix = 1, bool useStore = false)
{ {
PrintOut = printout; PrintOut = printout;
IsWeb = isWeb; IsWeb = isWeb;
@ -108,9 +108,9 @@ namespace Oshima.FunGame.OshimaServers.Service
character9, character10, character11, character12 character9, character10, character11, character12
]; ];
int clevel = 60; int clevel = 15;
int slevel = 6; int slevel = 2;
int mlevel = 8; int mlevel = 2;
// 升级和赋能 // 升级和赋能
for (int index = 0; index < characters.Count; index++) for (int index = 0; index < characters.Count; index++)
@ -152,37 +152,48 @@ namespace Oshima.FunGame.OshimaServers.Service
// 总游戏时长 // 总游戏时长
double totalTime = 0; double totalTime = 0;
// 初始化商店
Store store = new("模拟商店");
if (useStore)
{
AddStoreItems(actionQueue, store);
}
// 开始空投 // 开始空投
Msg = ""; Msg = "";
int = 0; int mQuality = 0;
int = 0; int wQuality = 0;
int = 0; int aQuality = 0;
int = 0; int sQuality = 0;
int = 0; int acQuality = 0;
double nextDropTime = 0;
if (!useStore)
{
WriteLine($"社区送温暖了,现在随机发放空投!!"); WriteLine($"社区送温暖了,现在随机发放空投!!");
(actionQueue, , , , , ); DropItems(actionQueue, mQuality, wQuality, aQuality, sQuality, acQuality, false);
WriteLine(""); WriteLine("");
if (isWeb) result.Add("=== 空投 ===\r\n" + Msg); if (isWeb) result.Add("=== 空投 ===\r\n" + Msg);
double = isTeam ? 80 : 40; nextDropTime = isTeam ? 80 : 40;
if ( < 4) if (mQuality < 4)
{ {
++; mQuality++;
} }
if ( < 4) if (wQuality < 4)
{ {
++; wQuality++;
} }
if ( < 1) if (aQuality < 1)
{ {
++; aQuality++;
} }
if ( < 1) if (sQuality < 1)
{ {
++; sQuality++;
} }
if ( < 3) if (acQuality < 3)
{ {
++; acQuality++;
}
} }
// 显示角色信息 // 显示角色信息
@ -324,7 +335,7 @@ namespace Oshima.FunGame.OshimaServers.Service
// 模拟时间流逝 // 模拟时间流逝
double timeLapse = await actionQueue.TimeLapse(); double timeLapse = await actionQueue.TimeLapse();
totalTime += timeLapse; totalTime += timeLapse;
-= timeLapse; nextDropTime -= timeLapse;
if (roundMsg != "") if (roundMsg != "")
{ {
@ -335,34 +346,34 @@ namespace Oshima.FunGame.OshimaServers.Service
result.Add(roundMsg); result.Add(roundMsg);
} }
if ( <= 0) if (!useStore && nextDropTime <= 0)
{ {
// 空投 // 空投
Msg = ""; Msg = "";
WriteLine($"社区送温暖了,现在随机发放空投!!"); WriteLine($"社区送温暖了,现在随机发放空投!!");
(actionQueue, , , , , ); DropItems(actionQueue, mQuality, wQuality, aQuality, sQuality, acQuality);
WriteLine(""); WriteLine("");
if (isWeb) result.Add("=== 空投 ===\r\n" + Msg); if (isWeb) result.Add("=== 空投 ===\r\n" + Msg);
= isTeam ? 100 : 40; nextDropTime = isTeam ? 100 : 40;
if ( < 4) if (mQuality < 4)
{ {
++; mQuality++;
} }
if ( < 4) if (wQuality < 4)
{ {
++; wQuality++;
} }
if ( < 1) if (aQuality < 1)
{ {
++; aQuality++;
} }
if ( < 1) if (sQuality < 1)
{ {
++; sQuality++;
} }
if ( < 3) if (acQuality < 3)
{ {
++; acQuality++;
} }
} }
} }
@ -598,52 +609,85 @@ namespace Oshima.FunGame.OshimaServers.Service
if (PrintOut) Console.WriteLine(str); if (PrintOut) Console.WriteLine(str);
} }
public static void (GamingQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality) public static void AddStoreItems(GamingQueue queue, Store store)
{ {
foreach (Character character in queue.Queue) foreach (Item item in FunGameConstant.Equipment)
{ {
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality)]; Item realItem = item.Copy();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality)]; realItem.SetGamingQueue(queue);
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality)]; realItem.Price = Random.Shared.Next() * (int)item.QualityType;
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality)]; store.AddItem(realItem, 100);
Item? a = null, b = null, c = null, d = null, d2 = null;
if (.Length > 0)
{
a = [Random.Shared.Next(.Length)];
} }
if (.Length > 0)
{
b = [Random.Shared.Next(.Length)];
} }
if (.Length > 0)
public static void DropItems(GamingQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality, bool addLevel = true)
{ {
c = [Random.Shared.Next(.Length)]; if (wQuality == 0 && aQuality == 0 && sQuality == 0 && acQuality == 0) return;
foreach (Character character in queue.HardnessTime.Keys)
{
if (addLevel)
{
character.Level += 15;
character.NormalAttack.Level += 2;
foreach (Skill skill in character.Skills)
{
if (skill.SkillType == SkillType.Passive) continue;
skill.Level += 2;
} }
if (.Length > 0) Character? original = queue.Original[character.Guid];
if (original != null)
{ {
d = [Random.Shared.Next(.Length)]; original.Level += 15;
original.NormalAttack.Level += 2;
foreach (Skill skill in original.Skills)
{
if (skill.SkillType == SkillType.Passive) continue;
skill.Level += 2;
} }
if (.Length > 0)
{
d2 = [Random.Shared.Next(.Length)];
} }
List<Item> = []; }
if (a != null) .Add(a); Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality)];
if (b != null) .Add(b); Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality)];
if (c != null) .Add(c); Item[] shoes = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality)];
if (d != null) .Add(d); Item[] accessories = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality)];
if (d2 != null) .Add(d2); Item? weapon = null, armor = null, shoe = null, accessory1 = null, accessory2 = null;
Item? = FunGameService.GenerateMagicCardPack(3, (QualityType)mQuality); if (weapons.Length > 0)
if ( != null)
{ {
foreach (Skill magic in .Skills.Magics) weapon = weapons[Random.Shared.Next(weapons.Length)];
}
if (armors.Length > 0)
{
armor = armors[Random.Shared.Next(armors.Length)];
}
if (shoes.Length > 0)
{
shoe = shoes[Random.Shared.Next(shoes.Length)];
}
if (accessories.Length > 0)
{
accessory1 = accessories[Random.Shared.Next(accessories.Length)];
}
if (accessories.Length > 0)
{
accessory2 = accessories[Random.Shared.Next(accessories.Length)];
}
List<Item> thisDrops = [];
if (weapon != null) thisDrops.Add(weapon);
if (armor != null) thisDrops.Add(armor);
if (shoe != null) thisDrops.Add(shoe);
if (accessory1 != null) thisDrops.Add(accessory1);
if (accessory2 != null) thisDrops.Add(accessory2);
Item? mcp = FunGameService.GenerateMagicCardPack(3, (QualityType)mQuality);
if (mcp != null)
{
foreach (Skill magic in mcp.Skills.Magics)
{ {
magic.Level = 8; magic.Level = 8;
} }
.SetGamingQueue(queue); mcp.SetGamingQueue(queue);
queue.Equip(character, ); queue.Equip(character, mcp);
} }
foreach (Item item in ) foreach (Item item in thisDrops)
{ {
Item realItem = item.Copy(); Item realItem = item.Copy();
realItem.SetGamingQueue(queue); realItem.SetGamingQueue(queue);