FunGame-Testing/Library/Skills/NiuNan/智慧与力量.cs

92 lines
3.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.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> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"当生命值低于 30% 时,智力转化为力量;当生命值高于或等于 30% 时,力量转化为智力。" +
(Skill.Character != null ? "(当前模式:" + CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) + "" : "");
public override bool TargetSelf => true;
private double = 0;
private double = 0;
public override void OnAttributeChanged(Character character)
{
if (Skill.Character != null)
{
if (Skill.Character.PrimaryAttribute == PrimaryAttribute.INT)
{
double diff = character.ExSTR - ;
character.ExINT = + character.BaseSTR + diff;
}
else if (Skill.Character.PrimaryAttribute == PrimaryAttribute.STR)
{
double diff = character.ExINT - ;
character.ExSTR = + character.BaseINT + diff;
}
}
}
public override void OnTimeElapsed(Character character, double elapsed)
{
if (Skill.Character != null)
{
Character c = Skill.Character;
if (c.HP < c.MaxHP * 0.3)
{
if (c.PrimaryAttribute == PrimaryAttribute.INT)
{
double pastHP = c.HP;
double pastMaxHP = c.MaxHP;
double pastMP = c.MP;
double pastMaxMP = c.MaxMP;
c.PrimaryAttribute = PrimaryAttribute.STR;
= c.ExINT;
= c.ExSTR;
c.ExINT = -c.BaseINT;
c.ExSTR = + c.BaseINT + ;
c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
}
}
else
{
if (c.PrimaryAttribute == PrimaryAttribute.STR)
{
double pastHP = c.HP;
double pastMaxHP = c.MaxHP;
double pastMP = c.MP;
double pastMaxMP = c.MaxMP;
c.PrimaryAttribute = PrimaryAttribute.INT;
= c.ExINT;
= c.ExSTR;
c.ExINT = + c.BaseSTR + ;
c.ExSTR = -c.BaseSTR;
c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
}
}
}
}
}
}