diff --git a/OshimaModules/Characters/CustomCharacter.cs b/OshimaModules/Characters/CustomCharacter.cs index 38ef19b..a3b9157 100644 --- a/OshimaModules/Characters/CustomCharacter.cs +++ b/OshimaModules/Characters/CustomCharacter.cs @@ -48,29 +48,5 @@ namespace Oshima.FunGame.OshimaModules.Characters InitialHR = Random.Shared.Next(1, 6); InitialMR = Random.Shared.Next(1, 6); } - - public void SetPrimaryAttribute(PrimaryAttribute? value = null) - { - if (value != null && value.HasValue) - { - PrimaryAttribute = value.Value; - } - else - { - double max = Math.Max(Math.Max(STR, AGI), INT); - if (max == STR) - { - PrimaryAttribute = PrimaryAttribute.STR; - } - else if (max == AGI) - { - PrimaryAttribute = PrimaryAttribute.AGI; - } - else if (max == INT) - { - PrimaryAttribute = PrimaryAttribute.INT; - } - } - } } } diff --git a/OshimaModules/Items/SpecialItem/RegionItem.cs b/OshimaModules/Items/SpecialItem/RegionItem.cs new file mode 100644 index 0000000..3f896c0 --- /dev/null +++ b/OshimaModules/Items/SpecialItem/RegionItem.cs @@ -0,0 +1,23 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Items +{ + public class RegionItem : Item + { + public HashSet> GenerationPredicates { get; } = []; + + public RegionItem(long id, string name, string description, string story = "", QualityType quality = QualityType.White, params IEnumerable> predicates) : base(ItemType.SpecialItem) + { + Id = id; + Name = name; + Description = description; + BackgroundStory = story; + QualityType = quality; + foreach (Func predicate in predicates) + { + GenerationPredicates.Add(predicate); + } + } + } +} diff --git a/OshimaModules/Regions/Anomaly.cs b/OshimaModules/Regions/Anomaly.cs new file mode 100644 index 0000000..e69e689 --- /dev/null +++ b/OshimaModules/Regions/Anomaly.cs @@ -0,0 +1,125 @@ +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Regions +{ + public class 银辉城 : OshimaRegion + { + public 银辉城() + { + Id = 1; + Name = "银辉城"; + Description = "悬浮在云海中的倒三角金属都市,建筑由星银合金铸造,街道流淌着液态月光。核心区藏有能改写现实法则的「悖论引擎」"; + Category = "奇异"; + Weathers.Add("晴朗", 20); + ChangeRandomWeather(); + Difficulty = RarityType.TwoStar; + Characters.Add(new(10101, "失控的悖论引擎")); + Units.Add(new(20101, "星银守卫")); + Crops.Add(new(180101, "星银合金", "锻造物品的材料。", "银辉城特有的金属材料,拥有着银色的光泽和坚固的质地。据说它能够吸收和储存能量,是建造城市和制造武器的理想材料。")); + Crops.Add(new(180102, "液态月光", "锻造物品的材料。", "一种在银辉城特有的、散发着柔和光芒的液体,如同月光般清澈。据说它蕴含着悖论引擎的能量,能够影响现实的结构。")); + } + } + + public class 永霜裂痕 : OshimaRegion + { + public 永霜裂痕() + { + Id = 4; + Name = "永霜裂痕"; + Description = "冰晶峡谷冻结着不同时代的战争残影,哨塔时钟随机倒转/加速,需服用「时霜药剂」保持神智"; + Category = "奇异"; + Weathers.Add("极寒", -25); + ChangeRandomWeather(); + Difficulty = RarityType.FiveStar; + Characters.Add(new(10401, "时空扭曲者")); + Units.Add(new(20401, "冰霜傀儡")); + Crops.Add(new(180401, "时霜药剂", "锻造物品的材料。", "一种在永霜裂痕中使用的特殊药剂,能够减缓时间流逝,保持人的神智清醒。但长期服用可能导致记忆混乱和时间感知错乱。")); + Crops.Add(new(180402, "冰封记忆", "锻造物品的材料。", "永霜裂痕中冰封的古代战争幻象碎片,触碰时会引发强烈的记忆回溯,但同时也伴随着认知扭曲的风险。")); + } + } + + public class 千瞳镜湖 : OshimaRegion + { + public 千瞳镜湖() + { + Id = 5; + Name = "千瞳镜湖"; + Description = "湖面倒影展现平行时空,潜入会进入重力颠倒的镜像城,湖底布满瞳孔状传送门"; + Category = "奇异"; + Weathers.Add("阴沉", 10); + ChangeRandomWeather(); + Difficulty = RarityType.TwoStar; + Characters.Add(new(10501, "镜像之主")); + Units.Add(new(20501, "镜像守卫")); + Crops.Add(new(180501, "量子纠缠碎片", "锻造物品的材料。", "千瞳镜湖的瞳孔状传送门中提取的微小碎片,拥有着神秘的能量。据说它们与平行时空相连,能够引发量子纠缠现象。")); + } + } + + public class 流沙时计荒漠 : OshimaRegion + { + public 流沙时计荒漠() + { + Id = 7; + Name = "流沙时计荒漠"; + Description = "沙粒蕴含时间魔法,沙丘每小时重组地形,沙暴中会出现海市蜃楼般的「昨日之城」"; + Category = "奇异"; + Weathers.Add("沙尘暴", 35); + ChangeRandomWeather(); + Difficulty = RarityType.ThreeStar; + Characters.Add(new(10701, "时间吞噬者")); + Units.Add(new(20701, "流沙蝎")); + Crops.Add(new(180701, "时间碎片", "锻造物品的材料。", "流沙时计荒漠中散落的神秘碎片,拥有着不规则的形状和模糊的纹路。据说它们是过去时光的残余,会随机重组。")); + } + } + + public class 穹顶之泪湖 : OshimaRegion + { + public 穹顶之泪湖() + { + Id = 11; + Name = "穹顶之泪湖"; + Description = "破碎天穹下的倒影湖泊,折射多维星空,星辉水母群午夜重构水体重力法则"; + Category = "奇异"; + Weathers.Add("星光", 16); + ChangeRandomWeather(); + Difficulty = RarityType.OneStar; + Characters.Add(new(11101, "星辉巨母")); + Units.Add(new(21101, "星辉水母")); + Crops.Add(new(181101, "星辉凝露", "锻造物品的材料。", "穹顶之泪湖中星辉水母散发出的凝露,蕴含着重构水体重力法则的能量,但可能引发重力波动。")); + } + } + + public class 时漏沙漠 : OshimaRegion + { + public 时漏沙漠() + { + Id = 16; + Name = "时漏沙漠"; + Description = "时间碎片组成的流沙领域,时之蝎加速局部时间,沙漏仙人掌分泌时凝液"; + Category = "奇异"; + Weathers.Add("不稳定", 38); + ChangeRandomWeather(); + Difficulty = RarityType.TwoStar; + Characters.Add(new(11601, "时之君王")); + Units.Add(new(21601, "时之蝎")); + Crops.Add(new(181601, "时凝液", "锻造物品的材料。", "时漏沙漠中沙漏仙人掌分泌的液体,拥有着粘稠的质地和淡淡的光泽。据说它能够加速时间的流逝,但使用时需要谨慎。")); + } + } + + public class 谵妄海市 : OshimaRegion + { + public 谵妄海市() + { + Id = 20; + Name = "谵妄海市"; + Description = "需认知干扰剂进入的幻觉城市,思维寄生虫伪装市民,贩卖可食用梦境碎片"; + Category = "奇异"; + Weathers.Add("迷幻", 20); + ChangeRandomWeather(); + Difficulty = RarityType.FourStar; + Characters.Add(new(12001, "梦魇之主")); + Units.Add(new(22001, "思维寄生虫")); + Crops.Add(new(182001, "梦境碎片", "锻造物品的材料。", "谵妄海市中流通的特殊商品,拥有着不同的颜色和味道。据说它能够影响人的梦境,甚至改变人的认知。")); + } + } +} diff --git a/OshimaModules/Regions/Ecology.cs b/OshimaModules/Regions/Ecology.cs new file mode 100644 index 0000000..2db198b --- /dev/null +++ b/OshimaModules/Regions/Ecology.cs @@ -0,0 +1,125 @@ +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Regions +{ + public class 瑟兰薇歌林海 : OshimaRegion + { + public 瑟兰薇歌林海() + { + Id = 2; + Name = "瑟兰薇歌林海"; + Description = "树木枝干中流淌荧蓝汁液,春季行走重组地貌,冬季化为水晶雕塑。深处沉睡着被精灵封印的「旋律古龙」"; + Category = "生态"; + Weathers.Add("多云", 15); + ChangeRandomWeather(); + Difficulty = RarityType.FourStar; + Characters.Add(new(10201, "旋律古龙")); + Units.Add(new(20201, "荧光精灵")); + Crops.Add(new(180201, "荧蓝汁液", "锻造物品的材料。", "瑟兰薇歌林海特有树木的汁液,呈现美丽的荧蓝色。采集时需要小心,因为树木在受到威胁时会将汁液转化为神经毒素。")); + } + } + + public class 腐萤沼渊 : OshimaRegion + { + public 腐萤沼渊() + { + Id = 8; + Name = "腐萤沼渊"; + Description = "荧光毒气沼泽,中心生长直径三公里的脑状肉瘤「共生母体」,菌类模仿动物叫声诱捕猎物"; + Category = "生态"; + Weathers.Add("潮湿", 22); + ChangeRandomWeather(); + Difficulty = RarityType.OneStar; + Characters.Add(new(10801, "共生母体")); + Units.Add(new(20801, "沼泽毒虫")); + Crops.Add(new(180801, "菌类样本", "锻造物品的材料。", "腐萤沼渊共生母体上生长的奇异菌类,拥有着不同的颜色和形态。采集时需要小心,因为某些菌类会释放麻痹毒素。")); + } + } + + public class 永燃坩埚 : OshimaRegion + { + public 永燃坩埚() + { + Id = 14; + Name = "永燃坩埚"; + Description = "岩浆海上的球形锻造都市,岩浆鱿鱼游弋街道,火山灰培育活体金属苔藓"; + Category = "生态"; + Weathers.Add("高温", 60); + ChangeRandomWeather(); + Difficulty = RarityType.FiveStar; + Characters.Add(new(11401, "岩浆之王")); + Units.Add(new(21401, "岩浆鱿鱼")); + Crops.Add(new(181401, "活体金属苔藓", "锻造物品的材料。", "永燃坩埚特有的金属质感的苔藓,能够在火山灰中生长。它拥有着自我修复和繁殖的能力,是研究金属生命的重要材料。")); + } + } + + public class 骨桥深渊 : OshimaRegion + { + public 骨桥深渊() + { + Id = 15; + Name = "骨桥深渊"; + Description = "巨型骸骨形成的呼吸桥梁,幽灵船在桥底虚空航行,骸骨寄生神经蕨类"; + Category = "生态"; + Weathers.Add("阴森", 8); + ChangeRandomWeather(); + Difficulty = RarityType.ThreeStar; + Characters.Add(new(11501, "骸骨巨龙")); + Units.Add(new(21501, "幽灵")); + Crops.Add(new(181501, "虚空骨髓", "锻造物品的材料。", "骨桥深渊中巨型骸骨内部的特殊物质,散发着微弱的虚空能量,长期接触可能导致精神错乱。")); + Crops.Add(new(181502, "神经蕨类", "锻造物品的材料。", "骨桥深渊中寄生在骸骨上的奇异蕨类,其根系与骸骨的神经系统相连,触碰时会引发幻觉和精神冲击。")); + } + } + + public class 脉轮圣树 : OshimaRegion + { + public 脉轮圣树() + { + Id = 17; + Name = "脉轮圣树"; + Description = "树干直径十公里的螺旋巨树,年轮是立体城市,树液凝结可编程蜜蜡"; + Category = "生态"; + Weathers.Add("晴朗", 24); + ChangeRandomWeather(); + Difficulty = RarityType.ThreeStar; + Characters.Add(new(11701, "圣树守护者")); + Units.Add(new(21701, "蜜蜡蜂")); + Crops.Add(new(181701, "可编程蜜蜡", "锻造物品的材料。", "脉轮圣树分泌的树脂凝结而成的蜡状物质,拥有着独特的纹路和光泽。据说它能够被编程,用于创造各种奇妙的物品。")); + } + } + + public class 双生月崖 : OshimaRegion + { + public 双生月崖() + { + Id = 19; + Name = "双生月崖"; + Description = "撕裂的悬浮山脉,永昼侧栖光鹰,永夜侧绽影玫瑰。此地区不定期切换昼夜,在切换窗口期内可安全离开此地,否则,视为跨越界限触发湮灭"; + Category = "生态"; + Weathers.Add("永昼", 15); + Weathers.Add("永夜", -10); + ChangeRandomWeather(); + Difficulty = RarityType.FiveStar; + Characters.Add(new(11901, "昼夜守护者")); + Units.Add(new(21901, "光鹰", [(r => r.Weather == "永昼")])); + Crops.Add(new(181901, "影玫瑰", "锻造物品的材料。", "双生月崖永夜侧绽放的奇异玫瑰,散发着幽暗的光芒。", QualityType.White, [(r => r.Weather == "永夜")])); + } + } + + public class 回音棱镜林 : OshimaRegion + { + public 回音棱镜林() + { + Id = 13; + Name = "回音棱镜林"; + Description = "晶体化红杉储存亡者记忆,荧光孢子引发共感,影狼嚎叫产生空间褶皱"; + Category = "生态"; + Weathers.Add("雾气", 14); + ChangeRandomWeather(); + Difficulty = RarityType.FourStar; + Characters.Add(new(11301, "远古影狼")); + Units.Add(new(21301, "棱镜幽灵")); + Crops.Add(new(181301, "晶化记忆孢子", "锻造物品的材料。", "回音棱镜林晶体化红杉散发的孢子,蕴含着亡者的记忆,吸入可能引发共感。")); + } + } +} diff --git a/OshimaModules/Regions/Machine.cs b/OshimaModules/Regions/Machine.cs new file mode 100644 index 0000000..bdd71ea --- /dev/null +++ b/OshimaModules/Regions/Machine.cs @@ -0,0 +1,38 @@ +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Regions +{ + public class 齿轮坟场 : OshimaRegion + { + public 齿轮坟场() + { + Id = 12; + Name = "齿轮坟场"; + Description = "堆积上古机械文明的金属荒漠,沙粒为微缩齿轮,构装巨龙在沙暴中游荡"; + Category = "机械"; + Weathers.Add("沙尘", 30); + ChangeRandomWeather(); + Difficulty = RarityType.ThreeStar; + Characters.Add(new(11201, "报废的构装巨龙")); + Units.Add(new(21201, "齿轮傀儡")); + Crops.Add(new(181201, "机械核心碎片", "锻造物品的材料。", "齿轮坟场中构装巨龙残骸的动力核心碎片,蕴含着上古机械文明的能量,但可能带有自毁装置。")); + } + } + + public class 齿与血回廊 : OshimaRegion + { + public 齿与血回廊() + { + Id = 10; + Name = "齿与血回廊"; + Description = "自我扩建的活体建筑群,齿轮血管输送液态魔力,「造物车间」会强制改造闯入者"; + Category = "机械"; + Weathers.Add("阴暗", 12); + ChangeRandomWeather(); + Difficulty = RarityType.FiveStar; + Characters.Add(new(11001, "回廊之心")); + Units.Add(new(21001, "改造士兵")); + Crops.Add(new(181001, "活体魔力血", "锻造物品的材料。", "齿与血回廊活体建筑中流动的液态魔力,具有自我修复和改造的能力,但接触可能导致身体异变。")); + } + } +} diff --git a/OshimaModules/Regions/Mineral.cs b/OshimaModules/Regions/Mineral.cs new file mode 100644 index 0000000..ca61962 --- /dev/null +++ b/OshimaModules/Regions/Mineral.cs @@ -0,0 +1,39 @@ +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Regions +{ + public class 赫菲斯托斯之喉 : OshimaRegion + { + public 赫菲斯托斯之喉() + { + Id = 3; + Name = "赫菲斯托斯之喉"; + Description = "螺旋向下的火山矿井,底层矿工开采深渊火钻,矿道会突然熔化成通往元素位面的裂缝"; + Category = "矿区"; + Weathers.Add("炎热", 45); + ChangeRandomWeather(); + Difficulty = RarityType.FourStar; + Characters.Add(new(10301, "熔岩巨兽")); + Units.Add(new(20301, "火焰元素")); + Crops.Add(new(180301, "深渊火钻", "锻造物品的材料。", "赫菲斯托斯之喉深处开采出的珍贵矿石,散发着炙热的红色光芒。据说只有被矿工灵魂烙印认可的人才能安全触碰它。")); + } + } + + public class 悲鸣矿脉 : OshimaRegion + { + public 悲鸣矿脉() + { + Id = 18; + Name = "悲鸣矿脉"; + Description = "岩层嵌满神经宝石的活体矿山,开采引发山体剧痛,晶簇守卫实体化巡逻"; + Category = "矿区"; + Weathers.Add("幽暗", 10); + ChangeRandomWeather(); + Difficulty = RarityType.FourStar; + Characters.Add(new(11801, "矿脉之心")); + Units.Add(new(21801, "晶簇守卫")); + Crops.Add(new(181801, "神经宝石", "锻造物品的材料。", "悲鸣矿脉中开采出的特殊宝石,散发着微弱的蓝色光芒。据说它与矿脉的神经系统相连,能够引发剧烈的疼痛。")); + Crops.Add(new(181802, "矿脉神经纤维", "锻造物品的材料。", "悲鸣矿脉中连接神经宝石的纤维,触碰时会引发山体剧痛,并可能导致精神污染。")); + } + } +} diff --git a/OshimaModules/Regions/OshimaRegion.cs b/OshimaModules/Regions/OshimaRegion.cs new file mode 100644 index 0000000..d1c2dc9 --- /dev/null +++ b/OshimaModules/Regions/OshimaRegion.cs @@ -0,0 +1,54 @@ +using System.Text; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Interface.Entity; +using Milimoe.FunGame.Core.Library.Constant; +using Oshima.FunGame.OshimaModules.Items; +using Oshima.FunGame.OshimaModules.Units; + +namespace Oshima.FunGame.OshimaModules.Regions +{ + public class OshimaRegion : Region + { + public new HashSet Characters { get; } = []; + public new HashSet Units { get; } = []; + public new HashSet Crops { get; } = []; + + public override bool Equals(IBaseEntity? other) + { + return other is OshimaRegion && other.GetIdName() == GetIdName(); + } + + public override string ToString() + { + StringBuilder builder = new(); + + builder.AppendLine($"☆--- {Name} ---☆"); + builder.AppendLine($"编号:{Id}"); + builder.AppendLine($"天气:{Weather}"); + builder.AppendLine($"温度:{Temperature} °C"); + builder.AppendLine($"{Description}"); + + if (Characters.Count > 0) + { + builder.AppendLine($"== 头目 =="); + builder.AppendLine(string.Join(",", Characters.Select(o => o.Name))); + } + + if (Units.Count > 0) + { + builder.AppendLine($"== 生物 =="); + builder.AppendLine(string.Join(",", Units.Select(o => o.Name))); + } + + if (Crops.Count > 0) + { + builder.AppendLine($"== 作物 =="); + builder.AppendLine(string.Join(",", Crops.Select(c => c.Name))); + } + + builder.AppendLine($"探索难度:{CharacterSet.GetRarityTypeName(Difficulty)}"); + + return builder.ToString().Trim(); + } + } +} diff --git a/OshimaModules/Regions/Outworld.cs b/OshimaModules/Regions/Outworld.cs new file mode 100644 index 0000000..fe9dc38 --- /dev/null +++ b/OshimaModules/Regions/Outworld.cs @@ -0,0 +1,38 @@ +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Regions +{ + public class 雷霆王座山脉 : OshimaRegion + { + public 雷霆王座山脉() + { + Id = 6; + Name = "雷霆王座山脉"; + Description = "悬浮岩块组成的三维迷宫,最高峰「裁决尖碑」在月圆之夜投射出泰坦调试世界的符文"; + Category = "世外"; + Weathers.Add("雷暴", 5); + ChangeRandomWeather(); + Difficulty = RarityType.FourStar; + Characters.Add(new(10601, "雷霆泰坦")); + Units.Add(new(20601, "雷霆元素")); + Crops.Add(new(180601, "泰坦符文石", "锻造物品的材料。", "雷霆王座山脉裁决尖碑上脱落的符文石,蕴含着泰坦调试世界的法则,但解读时需要强大的精神力。")); + } + } + + public class 苍穹碎屿 : OshimaRegion + { + public 苍穹碎屿() + { + Id = 9; + Name = "苍穹碎屿"; + Description = "破碎天穹形成的浮空岛群,「星锚之地」竖立着束缚星空巨兽的引雷柱"; + Category = "世外"; + Weathers.Add("晴朗", 18); + ChangeRandomWeather(); + Difficulty = RarityType.ThreeStar; + Characters.Add(new(10901, "星空巨兽")); + Units.Add(new(20901, "浮空岛灵")); + Crops.Add(new(180901, "星锚晶石", "锻造物品的材料。", "苍穹碎屿星锚之地用于束缚星空巨兽的晶石,蕴含着强大的雷电能量,但可能引发空间裂缝。")); + } + } +} diff --git a/OshimaModules/Units/RegionCharacter.cs b/OshimaModules/Units/RegionCharacter.cs new file mode 100644 index 0000000..e86ea67 --- /dev/null +++ b/OshimaModules/Units/RegionCharacter.cs @@ -0,0 +1,56 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Units +{ + public class RegionCharacter : Character + { + public HashSet> GenerationPredicates { get; } = []; + + public RegionCharacter(long id, string name, params IEnumerable> predicates) + { + Id = id; + Name = name; + NickName = name; + PrimaryAttribute = (PrimaryAttribute)Random.Shared.Next(1, 4); + InitialATK = Random.Shared.Next(55, 101); + InitialHP = Random.Shared.Next(80, 201); + InitialMP = Random.Shared.Next(50, 131); + + int value = 61; + int valueGrowth = 61; + for (int i = 0; i < 3; i++) + { + if (value == 0) break; + int attribute = i < 2 ? Random.Shared.Next(value) : (value - 1); + int growth = i < 2 ? Random.Shared.Next(0, valueGrowth) : (valueGrowth - 1); + switch (i) + { + case 1: + InitialAGI = attribute; + AGIGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case 2: + InitialINT = attribute; + INTGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case 0: + default: + InitialSTR = attribute; + STRGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + } + value -= attribute; + valueGrowth -= growth; + } + InitialSPD = Random.Shared.Next(220, 451); + InitialHR = Random.Shared.Next(3, 9); + InitialMR = Random.Shared.Next(3, 9); + foreach (Func predicate in predicates) + { + GenerationPredicates.Add(predicate); + } + } + } +} diff --git a/OshimaModules/Units/RegionUnit.cs b/OshimaModules/Units/RegionUnit.cs new file mode 100644 index 0000000..041b53d --- /dev/null +++ b/OshimaModules/Units/RegionUnit.cs @@ -0,0 +1,25 @@ +using Milimoe.FunGame.Core.Entity; + +namespace Oshima.FunGame.OshimaModules.Units +{ + public class RegionUnit : Unit + { + public HashSet> GenerationPredicates { get; } = []; + + public RegionUnit(long id, string name, params IEnumerable> predicates) + { + Id = id; + Name = name; + InitialATK = Random.Shared.Next(25, 51); + InitialHP = Random.Shared.Next(35, 91); + InitialMP = Random.Shared.Next(20, 61); + InitialSPD = Random.Shared.Next(155, 320); + InitialHR = Random.Shared.Next(1, 6); + InitialMR = Random.Shared.Next(1, 6); + foreach (Func predicate in predicates) + { + GenerationPredicates.Add(predicate); + } + } + } +} diff --git a/OshimaServers/AnonymousServer.cs b/OshimaServers/AnonymousServer.cs index 6cbc90e..73e8388 100644 --- a/OshimaServers/AnonymousServer.cs +++ b/OshimaServers/AnonymousServer.cs @@ -247,7 +247,7 @@ namespace Oshima.FunGame.OshimaServers msg = SCAdd(data); break; case "sclist": - msg = SCList(); + msg = SCList(data); break; case "att": break; @@ -312,13 +312,15 @@ namespace Oshima.FunGame.OshimaServers return result; } - public string SCList() + public string SCList(Dictionary data) { string result = $"☆--- OSMTV 圣人排行榜 TOP10 ---☆\r\n统计时间:{DateTime.Now.ToString(General.GeneralDateTimeFormatChinese)}\r\n"; SQLHelper? sql = Controller.SQLHelper; if (sql != null) { + long userQQ = Controller.JSON.GetObject(data, "qq"); + (bool userHas, double userSC, int userTop, string userRemark) = (false, 0, 0, ""); sql.Script = "select * from saints order by sc desc"; sql.ExecuteDataSet(); if (sql.Success && sql.DataSet.Tables.Count > 0) @@ -327,13 +329,25 @@ namespace Oshima.FunGame.OshimaServers foreach (DataRow dr in sql.DataSet.Tables[0].Rows) { count++; - if (count > 10) break; long qq = Convert.ToInt64(dr["qq"]); double sc = Convert.ToDouble(dr["sc"]); string remark = Convert.ToString(dr["remark"]) ?? ""; + if (qq == userQQ) + { + userHas = true; + userSC = sc; + userTop = count; + userRemark = remark; + } + if (count > 10) continue; result += $"{count}. 用户:{qq},圣人点数:{sc} 分{(remark.Trim() != "" ? $" ({remark})" : "")}\r\n"; } + if (userHas) + { + result += $"你的圣人点数为:{userSC} 分{(userRemark.Trim() != "" ? $"({userRemark})" : "")},排在第 {userTop} / {sql.DataSet.Tables[0].Rows.Count} 名。"; + } } + else result = "圣人榜目前没有任何数据。"; } else result = "无法调用此接口:SQL 服务不可用。"; diff --git a/OshimaServers/Service/FunGameConstant.cs b/OshimaServers/Service/FunGameConstant.cs index 5bf13e6..4449157 100644 --- a/OshimaServers/Service/FunGameConstant.cs +++ b/OshimaServers/Service/FunGameConstant.cs @@ -2,6 +2,7 @@ using Milimoe.FunGame.Core.Library.Constant; using Oshima.FunGame.OshimaModules.Effects.OpenEffects; using Oshima.FunGame.OshimaModules.Items; +using Oshima.FunGame.OshimaModules.Regions; namespace Oshima.FunGame.OshimaServers.Service { @@ -17,11 +18,13 @@ namespace Oshima.FunGame.OshimaServers.Service public static List Magics { get; } = []; public static List Equipment { get; } = []; public static List Items { get; } = []; + public static List DrawCardItems { get; } = []; public static List ItemSkills { get; } = []; public static List AllItems { get; } = []; public static List AllSkills { get; } = []; public static Dictionary UserIdAndUsername { get; } = []; public static ItemType[] ItemCanUsed => [ItemType.Consumable, ItemType.MagicCard, ItemType.SpecialItem, ItemType.GiftBox, ItemType.Others]; + public static ItemType[] ItemCanNotDrawCard => [ItemType.Collectible, ItemType.QuestItem, ItemType.GiftBox, ItemType.Others]; public static Dictionary> LevelBreakNeedyList { get; } = new() { @@ -535,187 +538,10 @@ namespace Oshima.FunGame.OshimaServers.Service } }; - public static List Regions { get; } = [ - new Region() - { - Id = 1, - Name = "银辉城", - Description = "悬浮在云海中的倒三角金属都市,建筑由星银合金铸造,街道流淌着液态月光。核心区藏有能改写现实法则的「悖论引擎」", - Weather = "晴朗", - Temperature = 20, - Difficulty = RarityType.TwoStar - }, - new Region() - { - Id = 2, - Name = "瑟兰薇歌林海", - Description = "树木枝干中流淌荧蓝汁液,春季行走重组地貌,冬季化为水晶雕塑。深处沉睡着被精灵封印的「旋律古龙」", - Weather = "多云", - Temperature = 15, - Difficulty = RarityType.FourStar - }, - new Region() - { - Id = 3, - Name = "赫菲斯托斯之喉", - Description = "螺旋向下的火山矿井,底层矿工开采深渊火钻,矿道会突然熔化成通往元素位面的裂缝", - Weather = "炎热", - Temperature = 45, - Difficulty = RarityType.FourStar - }, - new Region() - { - Id = 4, - Name = "永霜裂痕", - Description = "冰晶峡谷冻结着不同时代的战争残影,哨塔时钟随机倒转/加速,需服用「时霜药剂」保持神智", - Weather = "极寒", - Temperature = -25, - Difficulty = RarityType.FiveStar - }, - new Region() - { - Id = 5, - Name = "千瞳镜湖", - Description = "湖面倒影展现平行时空,潜入会进入重力颠倒的镜像城,湖底布满瞳孔状传送门", - Weather = "阴沉", - Temperature = 10, - Difficulty = RarityType.TwoStar - }, - new Region() - { - Id = 6, - Name = "雷霆王座山脉", - Description = "悬浮岩块组成的三维迷宫,最高峰「裁决尖碑」在月圆之夜投射出泰坦调试世界的符文", - Weather = "雷暴", - Temperature = 5, - Difficulty = RarityType.FourStar - }, - new Region() - { - Id = 7, - Name = "流沙时计荒漠", - Description = "沙粒蕴含时间魔法,沙丘每小时重组地形,沙暴中会出现海市蜃楼般的「昨日之城」", - Weather = "沙尘暴", - Temperature = 35, - Difficulty = RarityType.ThreeStar - }, - new Region() - { - Id = 8, - Name = "腐萤沼渊", - Description = "荧光毒气沼泽,中心生长直径三公里的脑状肉瘤「共生母体」,菌类模仿动物叫声诱捕猎物", - Weather = "潮湿", - Temperature = 22, - Difficulty = RarityType.OneStar - }, - new Region() - { - Id = 9, - Name = "苍穹碎屿", - Description = "破碎天穹形成的浮空岛群,「星锚之地」竖立着束缚星空巨兽的引雷柱", - Weather = "晴朗", - Temperature = 18, - Difficulty = RarityType.ThreeStar - }, - new Region() - { - Id = 10, - Name = "齿与血回廊", - Description = "自我扩建的活体建筑群,齿轮血管输送液态魔力,「造物车间」会强制改造闯入者", - Weather = "阴暗", - Temperature = 12, - Difficulty = RarityType.FiveStar - }, - new Region() - { - Id = 11, - Name = "穹顶之泪湖", - Description = "破碎天穹下的倒影湖泊,折射多维星空,星辉水母群午夜重构水体重力法则", - Weather = "星光", - Temperature = 16, - Difficulty = RarityType.OneStar - }, - new Region() - { - Id = 12, - Name = "齿轮坟场", - Description = "堆积上古机械文明的金属荒漠,沙粒为微缩齿轮,构装巨龙在沙暴中游荡", - Weather = "沙尘", - Temperature = 30, - Difficulty = RarityType.ThreeStar - }, - new Region() - { - Id = 13, - Name = "回音棱镜林", - Description = "晶体化红杉储存亡者记忆,荧光孢子引发共感,影狼嚎叫产生空间褶皱", - Weather = "雾气", - Temperature = 14, - Difficulty = RarityType.FourStar - }, - new Region() - { - Id = 14, - Name = "永燃坩埚", - Description = "岩浆海上的球形锻造都市,岩浆鱿鱼游弋街道,火山灰培育活体金属苔藓", - Weather = "高温", - Temperature = 60, - Difficulty = RarityType.FiveStar - }, - new Region() - { - Id = 15, - Name = "骨桥深渊", - Description = "巨型骸骨形成的呼吸桥梁,幽灵船在桥底虚空航行,骸骨寄生神经蕨类", - Weather = "阴森", - Temperature = 8, - Difficulty = RarityType.ThreeStar - }, - new Region() - { - Id = 16, - Name = "时漏沙漠", - Description = "时间碎片组成的流沙领域,时之蝎加速局部时间,沙漏仙人掌分泌时凝液", - Weather = "不稳定", - Temperature = 38, - Difficulty = RarityType.TwoStar - }, - new Region() - { - Id = 17, - Name = "脉轮圣树", - Description = "树干直径十公里的螺旋巨树,年轮是立体城市,树液凝结可编程蜜蜡", - Weather = "晴朗", - Temperature = 24, - Difficulty = RarityType.ThreeStar - }, - new Region() - { - Id = 18, - Name = "悲鸣矿脉", - Description = "岩层嵌满神经宝石的活体矿山,开采引发山体剧痛,晶簇守卫实体化巡逻", - Weather = "幽暗", - Temperature = 10, - Difficulty = RarityType.FourStar - }, - new Region() - { - Id = 19, - Name = "双生月崖", - Description = "撕裂的悬浮山脉,永昼侧栖光鹰,永夜侧绽影玫瑰,跨越界限触发湮灭", - Weather = "昼夜交替", - Temperature = 15, - Difficulty = RarityType.FiveStar - }, - new Region() - { - Id = 20, - Name = "谵妄海市", - Description = "需认知干扰剂进入的幻觉城市,思维寄生虫伪装市民,贩卖可食用梦境碎片", - Weather = "迷幻", - Temperature = 20, - Difficulty = RarityType.FourStar - } + public static List Regions { get; } = [ + new 银辉城(), new 瑟兰薇歌林海(), new 赫菲斯托斯之喉(), new 永霜裂痕(), new 千瞳镜湖(), new 雷霆王座山脉(), new 流沙时计荒漠(), new 腐萤沼渊(), + new 苍穹碎屿(), new 齿与血回廊(), new 穹顶之泪湖(), new 齿轮坟场(), new 回音棱镜林(), new 永燃坩埚(), new 骨桥深渊(), new 时漏沙漠(), + new 脉轮圣树(), new 悲鸣矿脉(), new 双生月崖(), new 谵妄海市() ]; public static Dictionary DrawCardProbabilities { get; } = new() diff --git a/OshimaServers/Service/FunGameService.cs b/OshimaServers/Service/FunGameService.cs index 2c1eb22..ab7f6b7 100644 --- a/OshimaServers/Service/FunGameService.cs +++ b/OshimaServers/Service/FunGameService.cs @@ -7,6 +7,7 @@ using Oshima.Core.Constant; using Oshima.FunGame.OshimaModules.Characters; using Oshima.FunGame.OshimaModules.Effects.OpenEffects; using Oshima.FunGame.OshimaModules.Items; +using Oshima.FunGame.OshimaModules.Regions; using Oshima.FunGame.OshimaModules.Skills; namespace Oshima.FunGame.OshimaServers.Service @@ -52,6 +53,13 @@ namespace Oshima.FunGame.OshimaServers.Service FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment); FunGameConstant.AllItems.AddRange(FunGameConstant.Items); + foreach (OshimaRegion region in FunGameConstant.Regions) + { + FunGameConstant.AllItems.AddRange(region.Crops.Select(i => i.Copy())); + } + + FunGameConstant.DrawCardItems.AddRange(FunGameConstant.AllItems.Where(i => !FunGameConstant.ItemCanNotDrawCard.Contains(i.ItemType))); + Skill?[] activeSkills = [.. FunGameConstant.Equipment.Select(i => i.Skills.Active), .. FunGameConstant.Items.Select(i => i.Skills.Active)]; foreach (Skill? skill in activeSkills) { @@ -367,6 +375,7 @@ namespace Oshima.FunGame.OshimaServers.Service FunGameConstant.SuperSkills.Clear(); FunGameConstant.PassiveSkills.Clear(); FunGameConstant.Magics.Clear(); + FunGameConstant.DrawCardItems.Clear(); FunGameConstant.AllItems.Clear(); FunGameConstant.ItemSkills.Clear(); FunGameConstant.AllSkills.Clear(); @@ -613,7 +622,7 @@ namespace Oshima.FunGame.OshimaServers.Service break; case 7: - Item 物品 = FunGameConstant.Items[Random.Shared.Next(FunGameConstant.Items.Count)].Copy(); + Item 物品 = FunGameConstant.DrawCardItems[Random.Shared.Next(FunGameConstant.DrawCardItems.Count)].Copy(); SetSellAndTradeTime(物品); user.Inventory.Items.Add(物品); msg += ItemSet.GetQualityTypeName(物品.QualityType) + ItemSet.GetItemTypeName(物品.ItemType) + "【" + 物品.Name + "】!\r\n" + 物品.Description; @@ -648,7 +657,7 @@ namespace Oshima.FunGame.OshimaServers.Service double q = Random.Shared.NextDouble() * 100; // 根据签到天数调整概率 - double daysFactor = Math.Min(days * 0.02, 30); + double daysFactor = Math.Min(days * 0.03, 30); Dictionary adjustedProbabilities = new(FunGameConstant.DrawCardProbabilities); foreach (QualityType typeTemp in adjustedProbabilities.Keys) { @@ -1371,7 +1380,7 @@ namespace Oshima.FunGame.OshimaServers.Service boss.Skills.Add(super); boss.Recovery(); - boss.SetPrimaryAttribute(); + SetCharacterPrimaryAttribute(boss); Bosses[nowIndex] = boss; } @@ -1479,24 +1488,26 @@ namespace Oshima.FunGame.OshimaServers.Service QuestType type = (QuestType)Random.Shared.Next(3); long id = quests.Count > 0 ? quests.Values.Max(q => q.Id) + 1 : 1; + // 生成任务奖励物品 + HashSet items = []; + Dictionary itemsCount = []; + int index = Random.Shared.Next(FunGameConstant.DrawCardItems.Count); + Item item = FunGameConstant.DrawCardItems[index]; + items.Add(item); + itemsCount[item.Name] = 1; + index = Random.Shared.Next(FunGameConstant.DrawCardItems.Count); + Item item2 = FunGameConstant.DrawCardItems[index]; + items.Add(item2); + if (!itemsCount.TryAdd(item2.Name, 1)) + { + itemsCount[item2.Name]++; + } + Quest quest; if (type == QuestType.Continuous) { string name = FunGameConstant.ContinuousQuestList.Keys.OrderBy(o => Random.Shared.Next()).First(); int minutes = Random.Shared.Next(10, 41); - HashSet items = []; - Dictionary itemsCount = []; - int index = Random.Shared.Next(FunGameConstant.AllItems.Count); - Item item = FunGameConstant.AllItems[index]; - items.Add(item); - itemsCount[item.Name] = 1; - index = Random.Shared.Next(FunGameConstant.AllItems.Count); - Item item2 = FunGameConstant.AllItems[index]; - items.Add(item2); - if (!itemsCount.TryAdd(item2.Name, 1)) - { - itemsCount[item2.Name]++; - } quest = new() { Id = id, @@ -1514,19 +1525,6 @@ namespace Oshima.FunGame.OshimaServers.Service { string name = FunGameConstant.ImmediateQuestList.Keys.OrderBy(o => Random.Shared.Next()).First(); int difficulty = Random.Shared.Next(3, 11); - HashSet items = []; - Dictionary itemsCount = []; - int index = Random.Shared.Next(FunGameConstant.AllItems.Count); - Item item = FunGameConstant.AllItems[index]; - items.Add(item); - itemsCount[item.Name] = 1; - index = Random.Shared.Next(FunGameConstant.AllItems.Count); - Item item2 = FunGameConstant.AllItems[index]; - items.Add(item2); - if (!itemsCount.TryAdd(item2.Name, 1)) - { - itemsCount[item2.Name]++; - } quest = new() { Id = id, @@ -1543,19 +1541,6 @@ namespace Oshima.FunGame.OshimaServers.Service { string name = FunGameConstant.ProgressiveQuestList.Keys.OrderBy(o => Random.Shared.Next()).First(); int maxProgress = Random.Shared.Next(3, 11); - HashSet items = []; - Dictionary itemsCount = []; - int index = Random.Shared.Next(FunGameConstant.AllItems.Count); - Item item = FunGameConstant.AllItems[index]; - items.Add(item); - itemsCount[item.Name] = 1; - index = Random.Shared.Next(FunGameConstant.AllItems.Count); - Item item2 = FunGameConstant.AllItems[index]; - items.Add(item2); - if (!itemsCount.TryAdd(item2.Name, 1)) - { - itemsCount[item2.Name]++; - } quest = new() { Id = id, @@ -1741,5 +1726,29 @@ namespace Oshima.FunGame.OshimaServers.Service SQLHelper.Parameters["@AutoKey"] = AutoKey; return $"{Milimoe.FunGame.Core.Library.SQLScript.Entity.UserQuery.Select_Users} {Milimoe.FunGame.Core.Library.SQLScript.Constant.Command_Where} {Milimoe.FunGame.Core.Library.SQLScript.Entity.UserQuery.Column_AutoKey} = @AutoKey"; } + + public static void SetCharacterPrimaryAttribute(Character character, PrimaryAttribute? value = null) + { + if (value != null && value.HasValue) + { + character.PrimaryAttribute = value.Value; + } + else + { + double max = Math.Max(Math.Max(character.STR, character.AGI), character.INT); + if (max == character.STR) + { + character.PrimaryAttribute = PrimaryAttribute.STR; + } + else if (max == character.AGI) + { + character.PrimaryAttribute = PrimaryAttribute.AGI; + } + else if (max == character.INT) + { + character.PrimaryAttribute = PrimaryAttribute.INT; + } + } + } } } diff --git a/OshimaWebAPI/Controllers/FunGameController.cs b/OshimaWebAPI/Controllers/FunGameController.cs index 8c56183..f014d3b 100644 --- a/OshimaWebAPI/Controllers/FunGameController.cs +++ b/OshimaWebAPI/Controllers/FunGameController.cs @@ -12,6 +12,7 @@ using Milimoe.FunGame.Core.Library.SQLScript.Entity; using Oshima.Core.Configs; using Oshima.FunGame.OshimaModules.Characters; using Oshima.FunGame.OshimaModules.Items; +using Oshima.FunGame.OshimaModules.Regions; using Oshima.FunGame.OshimaServers.Service; namespace Oshima.FunGame.WebAPI.Controllers @@ -719,10 +720,7 @@ namespace Oshima.FunGame.WebAPI.Controllers return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameMaterial}不足 {reduce} 呢,无法重随自建角色属性!"); } newCustom = new CustomCharacter(FunGameConstant.CustomCharacterId, ""); - if (newCustom is CustomCharacter temp) - { - temp.SetPrimaryAttribute(); - } + FunGameService.SetCharacterPrimaryAttribute(newCustom); user.LastTime = DateTime.Now; pc.Add("user", user); pc.SaveConfig(); @@ -5083,7 +5081,7 @@ namespace Oshima.FunGame.WebAPI.Controllers List regions = []; if (index != null) { - if (FunGameConstant.Regions.FirstOrDefault(kv => kv.Id == index) is Region region) + if (FunGameConstant.Regions.FirstOrDefault(kv => kv.Id == index) is OshimaRegion region) { regions.Add(region.ToString()); } diff --git a/OshimaWebAPI/Controllers/QQBotController.cs b/OshimaWebAPI/Controllers/QQBotController.cs index d69c22a..45d99e2 100644 --- a/OshimaWebAPI/Controllers/QQBotController.cs +++ b/OshimaWebAPI/Controllers/QQBotController.cs @@ -182,23 +182,30 @@ namespace Oshima.FunGame.WebAPI.Controllers { if (msg is null) return ""; - if (await FungameService.Handler(third: msg)) + bool result = true; + string error = ""; + TaskUtility.NewTask(async () => result = await FungameService.Handler(third: msg)).OnError(e => error = e.ToString()); + + int time = 0; + int timeout = 8 * 1000; + while (true) { - int time = 0; - int timeout = 8 * 1000; - while (true) + await Task.Delay(200); + time += 200; + if (time >= timeout) { - await Task.Delay(200); - time += 200; - if (time >= timeout) - { - break; - } - if (msg.IsCompleted) - { - break; - } + break; } + if (!result || msg.IsCompleted) + { + break; + } + } + + if (error != "") + { + if (msg.Result != "") msg.Result += "\r\n"; + msg.Result += error; } return NetworkUtility.JsonSerialize(msg.Result);