添加讨伐 Boss

This commit is contained in:
milimoe 2024-12-27 01:57:33 +08:00
parent 76f8eb5918
commit 6d4a953a2a
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
4 changed files with 385 additions and 210 deletions

View File

@ -2792,6 +2792,83 @@ namespace Oshima.Core.Controllers
}
}
[HttpGet("getboss")]
public List<string> GetBoss([FromQuery] int? index = null)
{
List<string> bosses = [];
if (index != null)
{
if (FunGameService.Bosses.Values.FirstOrDefault(kv => kv.Id == index) is Character boss)
{
bosses.Add(boss.GetInfo(false));
}
else
{
bosses.Add($"找不到指定编号的 Boss");
}
}
else if (FunGameService.Bosses.Count > 0)
{
bosses.Add($"Boss 列表:");
foreach (int i in FunGameService.Bosses.Keys)
{
Character boss = FunGameService.Bosses[i];
bosses.Add($"{i}. {boss.ToStringWithLevelWithOutUser()}");
}
}
else
{
bosses.Add($"现在没有任何 Boss请等待刷新~");
}
return bosses;
}
[HttpPost("fightboss")]
public List<string> FightBoss([FromQuery] long? qq = null, [FromQuery] int? index = null, [FromQuery] bool? all = null)
{
long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
int bossIndex = index ?? 0;
bool showAllRound = all ?? false;
PluginConfig pc = new("saved", userid.ToString());
pc.LoadConfig();
if (pc.Count > 0)
{
User user = FunGameService.GetUser(pc);
if (FunGameService.Bosses.Values.FirstOrDefault(kv => kv.Id == index) is Character boss)
{
List<string> msgs = FunGameActionQueue.StartGame([user.Inventory.MainCharacter, boss], false, false, false, false, false, showAllRound);
if (boss.HP <= 0)
{
FunGameService.Bosses.Remove(bossIndex);
double gained = 8 * boss.Level;
user.Inventory.Materials += gained;
msgs.Add($"恭喜你击败了 Boss获得 {gained} 材料奖励!");
}
else
{
msgs.Add($"挑战 Boss 失败,请稍后再来!");
}
user.LastTime = DateTime.Now;
pc.Add("user", user);
pc.SaveConfig();
return msgs;
}
else
{
return [$"找不到指定编号的 Boss"];
}
}
else
{
return [noSaved];
}
}
[HttpGet("reload")]
public string Relaod([FromQuery] long? master = null)
{

View File

@ -82,6 +82,11 @@ namespace Oshima.Core.WebAPI
Controller.WriteLine("读取 FunGame 存档缓存");
}
}, true);
TaskScheduler.Shared.AddRecurringTask("刷新boss", TimeSpan.FromHours(1), () =>
{
FunGameService.GenerateBoss();
Controller.WriteLine("刷新boss");
}, true);
}
}
}

View File

@ -136,7 +136,9 @@ namespace Oshima.Core.Utils
int = 0;
int = 0;
int = 0;
WriteLine($"社区送温暖了,现在随机发放空投!!");
(actionQueue, , , , , );
WriteLine("");
if (isWeb) result.Add("=== 空投 ===\r\n" + Msg);
double = isTeam ? 80 : 40;
if ( < 4)
@ -352,7 +354,9 @@ namespace Oshima.Core.Utils
{
// 空投
Msg = "";
WriteLine($"社区送温暖了,现在随机发放空投!!");
(actionQueue, , , , , );
WriteLine("");
if (isWeb) result.Add("=== 空投 ===\r\n" + Msg);
= isTeam ? 100 : 40;
if ( < 4)
@ -914,7 +918,6 @@ namespace Oshima.Core.Utils
public static void (ActionQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality)
{
WriteLine($"社区送温暖了,现在随机发放空投!!");
foreach (Character character in queue.Queue)
{
Item[] = FunGameService.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality).ToArray();
@ -960,7 +963,6 @@ namespace Oshima.Core.Utils
queue.Equip(character, realItem);
}
}
WriteLine("");
}
public static Dictionary<EffectID, Dictionary<string, object>> RoundRewards

View File

@ -21,214 +21,7 @@ namespace Oshima.Core.Utils
public static List<Item> AllItems { get; } = [];
public static List<Skill> AllSkills { get; } = [];
public static Dictionary<long, string> UserIdAndUsername { get; } = [];
public static Dictionary<int, Dictionary<string, int>> LevelBreakNeedyList
{
get
{
return new()
{
{
0, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 80 },
{ nameof(), 10 }
}
},
{
1, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 400 },
{ nameof(), 20 }
}
},
{
2, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 960 },
{ nameof(), 30 },
{ nameof(), 10 }
}
},
{
3, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 1760 },
{ nameof(), 40 },
{ nameof(), 20 }
}
},
{
4, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 2800 },
{ nameof(), 50 },
{ nameof(), 30 },
{ nameof(), 10 }
}
},
{
5, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 4080 },
{ nameof(), 60 },
{ nameof(), 40 },
{ nameof(), 20 }
}
},
};
}
}
public static Dictionary<int, Dictionary<string, int>> SkillLevelUpList
{
get
{
return new()
{
{
1, new()
{
{ "角色等级", 1 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
2, new()
{
{ "角色等级", 12 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
3, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 3 },
{ nameof(), 1 },
}
},
{
4, new()
{
{ "角色等级", 36 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 4 },
{ nameof(), 2 },
}
},
{
5, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
},
{
6, new()
{
{ "角色等级", 60 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 4 },
{ nameof(), 2 }
}
}
};
}
}
public static Dictionary<int, Dictionary<string, int>> NormalAttackLevelUpList
{
get
{
return new()
{
{
2, new()
{
{ "角色等级", 8 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
3, new()
{
{ "角色等级", 16 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
4, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 3 },
{ nameof(), 1 },
}
},
{
5, new()
{
{ "角色等级", 32 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 4 },
{ nameof(), 2 },
}
},
{
6, new()
{
{ "角色等级", 40 },
{ "角色突破进度", 4 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
},
{
7, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 4 },
{ nameof(), 2 }
}
},
{
8, new()
{
{ "角色等级", 56 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 70000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 280 },
{ nameof(), 7 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
}
};
}
}
public static Dictionary<int, Character> Bosses { get; } = [];
public static void InitFunGame()
{
@ -1213,5 +1006,303 @@ namespace Oshima.Core.Utils
}
return str;
}
public static void GenerateBoss()
{
if (Bosses.Count < 10)
{
int genCount = 10 - Bosses.Count;
for (int i = 0; i < genCount; i++)
{
int nowIndex = Bosses.Count > 0 ? Bosses.Keys.Max() + 1 : 1;
Character boss = new CustomCharacter(nowIndex, GenerateRandomChineseUserName(), "", "Boss");
int cLevel, sLevel, mLevel, naLevel;
switch (Random.Shared.Next(3))
{
case 0:
cLevel = General.GameplayEquilibriumConstant.MaxLevel;
sLevel = General.GameplayEquilibriumConstant.MaxSkillLevel;
mLevel = General.GameplayEquilibriumConstant.MaxMagicLevel;
naLevel = General.GameplayEquilibriumConstant.MaxNormalAttackLevel;
break;
case 1:
cLevel = General.GameplayEquilibriumConstant.MaxLevel / 2;
sLevel = General.GameplayEquilibriumConstant.MaxSkillLevel / 2;
mLevel = General.GameplayEquilibriumConstant.MaxMagicLevel / 2;
naLevel = General.GameplayEquilibriumConstant.MaxNormalAttackLevel / 2;
break;
case 2:
default:
cLevel = General.GameplayEquilibriumConstant.MaxLevel / 4;
sLevel = General.GameplayEquilibriumConstant.MaxSkillLevel / 4;
mLevel = General.GameplayEquilibriumConstant.MaxMagicLevel / 4;
naLevel = General.GameplayEquilibriumConstant.MaxNormalAttackLevel / 4;
break;
}
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 4).ToArray();
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 1).ToArray();
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 1).ToArray();
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 3).ToArray();
Item? a = null, b = null, c = null, d = null;
if (.Length > 0)
{
a = [Random.Shared.Next(.Length)];
}
if (.Length > 0)
{
b = [Random.Shared.Next(.Length)];
}
if (.Length > 0)
{
c = [Random.Shared.Next(.Length)];
}
if (.Length > 0)
{
d = [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);
Item? = GenerateMagicCardPack(3, (QualityType)4);
if ( != null)
{
foreach (Skill magic in .Skills.Magics)
{
magic.Level = mLevel;
}
boss.Equip();
}
foreach (Item item in )
{
Item realItem = item.Copy();
boss.Equip(realItem);
}
boss.Level = cLevel;
boss.NormalAttack.Level = naLevel;
boss.NormalAttack.HardnessTime = 7;
if (boss.CritRate < 65) boss.ExCritRate = 65 - boss.CritRate;
if (boss.CritDMG < 200) boss.ExCritDMG = 200 - boss.CritDMG;
if (boss.AccelerationCoefficient < 0.4) boss.ExAccelerationCoefficient = 0.4 - boss.AccelerationCoefficient;
boss.ExATK2 += boss.PrimaryAttributeValue;
boss.ExDEF2 += boss.PrimaryAttributeValue;
boss.MDF.None += 0.25;
boss.ExHPPercentage += 0.8;
Bosses[nowIndex] = boss;
}
}
}
public static Dictionary<int, Dictionary<string, int>> LevelBreakNeedyList
{
get
{
return new()
{
{
0, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 80 },
{ nameof(), 10 }
}
},
{
1, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 400 },
{ nameof(), 20 }
}
},
{
2, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 960 },
{ nameof(), 30 },
{ nameof(), 10 }
}
},
{
3, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 1760 },
{ nameof(), 40 },
{ nameof(), 20 }
}
},
{
4, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 2800 },
{ nameof(), 50 },
{ nameof(), 30 },
{ nameof(), 10 }
}
},
{
5, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 4080 },
{ nameof(), 60 },
{ nameof(), 40 },
{ nameof(), 20 }
}
},
};
}
}
public static Dictionary<int, Dictionary<string, int>> SkillLevelUpList
{
get
{
return new()
{
{
1, new()
{
{ "角色等级", 1 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
2, new()
{
{ "角色等级", 12 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
3, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 3 },
{ nameof(), 1 },
}
},
{
4, new()
{
{ "角色等级", 36 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 4 },
{ nameof(), 2 },
}
},
{
5, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
},
{
6, new()
{
{ "角色等级", 60 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 4 },
{ nameof(), 2 }
}
}
};
}
}
public static Dictionary<int, Dictionary<string, int>> NormalAttackLevelUpList
{
get
{
return new()
{
{
2, new()
{
{ "角色等级", 8 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
3, new()
{
{ "角色等级", 16 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
4, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 3 },
{ nameof(), 1 },
}
},
{
5, new()
{
{ "角色等级", 32 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 4 },
{ nameof(), 2 },
}
},
{
6, new()
{
{ "角色等级", 40 },
{ "角色突破进度", 4 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
},
{
7, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 4 },
{ nameof(), 2 }
}
},
{
8, new()
{
{ "角色等级", 56 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 70000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 280 },
{ nameof(), 7 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
}
};
}
}
}
}