chore: initialize OshimaBot repository (rename from Enhancement)
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
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 => $"每次造成伤害或受到伤害时,进行投掷检定,结果为偶数时,造成的伤害提升 {伤害提升 * 100:0.##}%,受到伤害减少 {伤害减少 * 100:0.##}%;结果为奇数时,该回合提升 {奇数平衡性提升 * 100:0.##}% 暴击率和闪避率、{奇数平衡性提升 * 100:0.##}% 魔法抗性,并将下一次伤害提升 {奇数伤害提升 * 100:0.##}% 或减免 {奇数伤害减少 * 100:0.##}% 下一次受到伤害,若下一次投掷结果为偶数,将叠加该效果。";
|
||||
|
||||
public bool 归元 { get; set; } = false;
|
||||
public bool 回合投掷出奇数 { get; set; } = false;
|
||||
public bool 奇数效果 { get; set; } = false;
|
||||
public double 伤害提升 { get; set; } = 0.6;
|
||||
public double 伤害减少 { get; set; } = 0.3;
|
||||
public double 奇数平衡性提升 { get; set; } = 0.1;
|
||||
public double 奇数伤害提升 { get; set; } = 0.3;
|
||||
public double 奇数伤害减少 { get; set; } = 0.15;
|
||||
|
||||
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;
|
||||
double bonus = 0;
|
||||
if (character != Skill.Character && enemy != Skill.Character)
|
||||
{
|
||||
return bonus;
|
||||
}
|
||||
if (奇数效果)
|
||||
{
|
||||
奇数效果 = false;
|
||||
if (character == Skill.Character)
|
||||
{
|
||||
bonus = damage * 奇数伤害提升;
|
||||
WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害提升了 {Math.Abs(bonus):0.##} 点!");
|
||||
}
|
||||
else if (enemy == Skill.Character)
|
||||
{
|
||||
bonus = -(damage * 奇数伤害减少);
|
||||
WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害减少了 {Math.Abs(bonus):0.##} 点!");
|
||||
}
|
||||
}
|
||||
bool result = 归元 || (!归元 && Random.Next(10) % 2 == 0);
|
||||
WriteLine($"[ {Skill.Character} ] 的八卦阵投掷结果为:{(result ? "偶数" : "奇数")}。");
|
||||
if (damage > 0 && result)
|
||||
{
|
||||
if (character == Skill.Character)
|
||||
{
|
||||
double bonus2 = damage * 伤害提升;
|
||||
bonus += bonus2;
|
||||
WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害提升了 {Math.Abs(bonus2):0.##} 点!");
|
||||
}
|
||||
else if (enemy == Skill.Character)
|
||||
{
|
||||
double bonus2 = damage * 伤害减少;
|
||||
bonus -= bonus2;
|
||||
WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害减少了 {Math.Abs(bonus2):0.##} 点!");
|
||||
}
|
||||
if (归元)
|
||||
{
|
||||
WriteLine($"[ {Skill.Character} ] 发动了归元环!冷却时间减少了 {归元环特效.冷却时间减少 * 100:0.##}%!");
|
||||
foreach (Skill s in Skill.Character.Skills)
|
||||
{
|
||||
s.CurrentCD -= s.CD * 归元环特效.冷却时间减少;
|
||||
if (s.CurrentCD <= 0)
|
||||
{
|
||||
s.CurrentCD = 0;
|
||||
s.Enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!回合投掷出奇数)
|
||||
{
|
||||
回合投掷出奇数 = true;
|
||||
Effect e = new DynamicsEffect(Skill, new()
|
||||
{
|
||||
{ "excr", 奇数平衡性提升 },
|
||||
{ "exer", 奇数平衡性提升 },
|
||||
{ "mdftype", (int)MagicType.None },
|
||||
{ "mdfvalue", 奇数平衡性提升 }
|
||||
}, Skill.Character)
|
||||
{
|
||||
Name = "八卦阵·奇数",
|
||||
Durative = false,
|
||||
DurationTurn = 1,
|
||||
RemainDurationTurn = 1
|
||||
};
|
||||
Skill.Character.Effects.Add(e);
|
||||
e.OnEffectGained(new HookContext(GamingQueue, Skill.Character));
|
||||
WriteLine($"[ {Skill.Character} ] 发动了八卦阵!该回合提升 {奇数平衡性提升 * 100:0.##}% 暴击率和闪避率、{奇数平衡性提升 * 100:0.##}% 魔法抗性!");
|
||||
}
|
||||
if (!奇数效果)
|
||||
{
|
||||
奇数效果 = true;
|
||||
}
|
||||
}
|
||||
return bonus;
|
||||
}
|
||||
|
||||
public override void OnTurnEnd(TurnContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
回合投掷出奇数 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
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 => 60;
|
||||
public override double HardnessTime { get; set; } = 8;
|
||||
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 => $"{Duration:0.##} {GameplayEquilibriumConstant.InGameTime}内,造成伤害必定暴击;使 [ 八卦阵 ] 不需要检定,直接产生偶数效果;并且每次触发偶数效果时,减少所有主动技能 {冷却时间减少 * 100:0.##}% 冷却时间。";
|
||||
public override bool Durative => true;
|
||||
public override double Duration => 30;
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
|
||||
public const double 冷却时间减少 = 0.1;
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
if (character.Effects.Where(e => e is 八卦阵特效 && e.Skill.Character == character).FirstOrDefault() is 八卦阵特效 e)
|
||||
{
|
||||
e.归元 = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
if (character.Effects.Where(e => e is 八卦阵特效 && e.Skill.Character == character).FirstOrDefault() is 八卦阵特效 e)
|
||||
{
|
||||
e.归元 = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override BeforeCriticalCheckResult BeforeCriticalCheck(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character actor || ctx.Enemy is not Character enemy) return default;
|
||||
bool isNormalAttack = ctx.IsNormalAttack;
|
||||
if (actor == Skill.Character)
|
||||
{
|
||||
// 归元期间必定暴击:提供极高的暴击检定加值
|
||||
return new BeforeCriticalCheckResult { ThrowingBonusDelta = 200 };
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
RecordCharacterApplyEffects(caster, EffectType.CritBoost, EffectType.DamageBoost, EffectType.DefenseBoost);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user