forked from Oshima-Studios/OshimaGameModule
测试优化
This commit is contained in:
parent
995c3057d0
commit
8f0aa1d3c7
@ -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);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user