测试优化

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;
IsWeb = isWeb;
@ -108,9 +108,9 @@ namespace Oshima.FunGame.OshimaServers.Service
character9, character10, character11, character12
];
int clevel = 60;
int slevel = 6;
int mlevel = 8;
int clevel = 15;
int slevel = 2;
int mlevel = 2;
// 升级和赋能
for (int index = 0; index < characters.Count; index++)
@ -152,37 +152,48 @@ namespace Oshima.FunGame.OshimaServers.Service
// 总游戏时长
double totalTime = 0;
// 初始化商店
Store store = new("模拟商店");
if (useStore)
{
AddStoreItems(actionQueue, store);
}
// 开始空投
Msg = "";
int = 0;
int = 0;
int = 0;
int = 0;
int = 0;
int mQuality = 0;
int wQuality = 0;
int aQuality = 0;
int sQuality = 0;
int acQuality = 0;
double nextDropTime = 0;
if (!useStore)
{
WriteLine($"社区送温暖了,现在随机发放空投!!");
(actionQueue, , , , , );
DropItems(actionQueue, mQuality, wQuality, aQuality, sQuality, acQuality, false);
WriteLine("");
if (isWeb) result.Add("=== 空投 ===\r\n" + Msg);
double = isTeam ? 80 : 40;
if ( < 4)
nextDropTime = isTeam ? 80 : 40;
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();
totalTime += timeLapse;
-= timeLapse;
nextDropTime -= timeLapse;
if (roundMsg != "")
{
@ -335,34 +346,34 @@ namespace Oshima.FunGame.OshimaServers.Service
result.Add(roundMsg);
}
if ( <= 0)
if (!useStore && nextDropTime <= 0)
{
// 空投
Msg = "";
WriteLine($"社区送温暖了,现在随机发放空投!!");
(actionQueue, , , , , );
DropItems(actionQueue, mQuality, wQuality, aQuality, sQuality, acQuality);
WriteLine("");
if (isWeb) result.Add("=== 空投 ===\r\n" + Msg);
= isTeam ? 100 : 40;
if ( < 4)
nextDropTime = isTeam ? 100 : 40;
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);
}
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[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality)];
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality)];
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality)];
Item? a = null, b = null, c = null, d = null, d2 = null;
if (.Length > 0)
{
a = [Random.Shared.Next(.Length)];
Item realItem = item.Copy();
realItem.SetGamingQueue(queue);
realItem.Price = Random.Shared.Next() * (int)item.QualityType;
store.AddItem(realItem, 100);
}
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);
if (b != null) .Add(b);
if (c != null) .Add(c);
if (d != null) .Add(d);
if (d2 != null) .Add(d2);
Item? = FunGameService.GenerateMagicCardPack(3, (QualityType)mQuality);
if ( != null)
}
Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality)];
Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality)];
Item[] shoes = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality)];
Item[] accessories = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality)];
Item? weapon = null, armor = null, shoe = null, accessory1 = null, accessory2 = null;
if (weapons.Length > 0)
{
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;
}
.SetGamingQueue(queue);
queue.Equip(character, );
mcp.SetGamingQueue(queue);
queue.Equip(character, mcp);
}
foreach (Item item in )
foreach (Item item in thisDrops)
{
Item realItem = item.Copy();
realItem.SetGamingQueue(queue);