chore: initialize OshimaBot repository (rename from Enhancement)

This commit is contained in:
2026-11-09 19:38:28 +08:00
commit f9052358a9
414 changed files with 36653 additions and 0 deletions
@@ -0,0 +1,82 @@
using FunGame.Core.Entity;
using FunGame.Core.Interface.Entity;
using FunGame.Core.Library.Constant;
using FunGame.Core.Model.EffectContext;
namespace OshimaBot.Content.Skills
{
public class 弱者猎手 : Skill
{
public override long Id => (long)PassiveID.弱者猎手;
public override string Name => "弱者猎手";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public 弱者猎手(Character? character = null) : base(SkillType.Passive, character)
{
Effects.Add(new 弱者猎手特效(this));
}
public override IEnumerable<Effect> AddPassiveEffectToCharacter()
{
return Effects;
}
}
public class 弱者猎手特效(Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"在 AI 控制下,任何目标都将则优先选择血量更低的角色。行动开始时,弱者猎手会盯上一名角色,然后标记所有生命值百分比低于自己的角色。在此回合内攻击被盯上或者被标记的角色,将造成 140% 伤害。";
public HashSet<Character> 猎手标记 { get; set; } = [];
public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx)
{
if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0;
double damage = ctx.Damage;
bool isNormalAttack = ctx.IsNormalAttack;
DamageType damageType = ctx.DamageType;
MagicType magicType = ctx.MagicType;
Dictionary<Effect, double> totalDamageBonus = ctx.TotalDamageBonus;
if (character == Skill.Character && 猎手标记.Contains(enemy))
{
double 额外伤害 = damage * 0.4;
return 额外伤害;
}
return 0;
}
public override void AlterSelectListBeforeSelection(SelectionContext ctx)
{
if (ctx.Trigger is not Character character || ctx.Skill is not ISkill skill) return;
List<Character> allEnemys = ctx.AllEnemys;
List<Character> allTeammates = ctx.AllTeammates;
List<Character> enemys = ctx.Enemys;
List<Character> teammates = ctx.Teammates;
猎手标记.Clear();
AddHalfOfMe([.. enemys.Where(e => e.HP > 0).OrderBy(e => e.HP / e.MaxHP)]);
if (猎手标记.Count > 0)
{
WriteLine($"[ {character} ] 的弱者猎手标记了以下角色:[ {string.Join(" ] / [ ", 猎手标记)} ] !");
if (IsCharacterInAIControlling(character))
{
enemys.Clear();
int count = skill.RealCanSelectTargetCount(enemys, teammates);
enemys.AddRange(猎手标记.Take(count));
WriteLine($"[ {character} ] 发动了弱者猎手![ {string.Join(" ] / [ ", enemys)} ] 被盯上了!");
}
}
}
private void AddHalfOfMe(params IEnumerable<Character> enemys)
{
foreach (Character enemy in enemys)
{
if (Skill.Character != null && enemy.HP > 0 && (enemy.HP / enemy.MaxHP) < (Skill.Character.HP / Skill.Character.MaxHP))
{
猎手标记.Add(enemy);
}
}
}
}
}
@@ -0,0 +1,68 @@
using FunGame.Core.Entity;
using FunGame.Core.Library.Constant;
using FunGame.Core.Model.EffectContext;
using FunGame.Core.Model.Framework;
namespace OshimaBot.Content.Skills
{
public class 饕餮盛宴 : Skill
{
public override long Id => (long)SuperSkillID.饕餮盛宴;
public override string Name => "饕餮盛宴";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : "";
public override double EPCost => 100;
public override double CD => 45 + 1 * (Level - 1);
public override double HardnessTime { get; set; } = 7;
public override bool CanSelectSelf => true;
public override bool CanSelectEnemy => false;
public 饕餮盛宴(Character? character = null) : base(SkillType.SuperSkill, character)
{
Effects.Add(new 饕餮盛宴特效(this));
}
}
public class 饕餮盛宴特效(Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"获得 {吸血系数 * 100:0.##}% 吸血,持续 {Duration:0.##} {GameplayEquilibriumConstant.InGameTime}。";
public override bool Durative => true;
public override double Duration => 30;
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
private double 吸血系数 => 0.2 + 0.05 * (Level - 1);
public override void AfterDamageCalculation(DamageContext ctx)
{
if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return;
double damage = ctx.Damage;
double actualDamage = ctx.ActualDamage;
bool isNormalAttack = ctx.IsNormalAttack;
DamageType damageType = ctx.DamageType;
MagicType magicType = ctx.MagicType;
DamageResult damageResult = ctx.DamageResult;
if (character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && character.HP < character.MaxHP)
{
double 实际吸血 = 吸血系数 * damage;
HealToTarget(character, character, 实际吸血);
}
}
public override void OnSkillCasted(SkillCastContext ctx)
{
if (ctx.Trigger is not Character caster) return;
List<Character> targets = ctx.Targets;
List<Grid> grids = ctx.Grids;
Dictionary<string, object> others = ctx.Others;
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
caster.Effects.Add(this);
OnEffectGained(new HookContext(GamingQueue, caster));
}
GamingQueue?.AddApplyEffects(caster, EffectType.Lifesteal);
}
}
}