Compare commits

..

No commits in common. "master" and "1.0-release" have entirely different histories.

15 changed files with 49 additions and 333 deletions

View File

@ -248,7 +248,7 @@ namespace Milimoe.FunGame.Core.Entity
{
foreach (Skill skill in Skills.Passives)
{
List<Effect> effects = [.. Character.Effects.Where(e => e.Skill == skill && e.IsInEffect)];
List<Effect> effects = [.. Character.Effects.Where(e => e.Skill == skill && e.Level > 0 && !e.IsBeingTemporaryDispelled)];
foreach (Effect e in effects)
{
Character.Effects.Remove(e);

View File

@ -55,25 +55,15 @@ namespace Milimoe.FunGame.Core.Entity
/// </summary>
public virtual bool DurativeWithoutDuration { get; set; } = false;
/// <summary>
/// 附属于某个特效
/// </summary>
public Effect? ParentEffect { get; set; } = null;
/// <summary>
/// 是否是某个特效的附属
/// </summary>
public bool IsSubsidiary => ParentEffect != null;
/// <summary>
/// 是否强制在状态栏中隐藏
/// </summary>
public virtual bool ForceHideInStatusBar { get; set; } = false;
public virtual bool IsSubsidiary { get; set; } = false;
/// <summary>
/// 是否显示在状态栏
/// </summary>
public bool ShowInStatusBar => !ForceHideInStatusBar && !IsSubsidiary && (Skill.Item is null || (Durative && Duration > 0) || DurationTurn > 0 || DurativeWithoutDuration);
public bool ShowInStatusBar => Skill.Item is null || (Durative && Duration > 0) || DurationTurn > 0 || DurativeWithoutDuration || IsSubsidiary;
/// <summary>
/// 特效是否生效
@ -360,12 +350,11 @@ namespace Milimoe.FunGame.Core.Entity
/// <param name="character"></param>
/// <param name="enemy"></param>
/// <param name="damage"></param>
/// <param name="actualDamage"></param>
/// <param name="isNormalAttack"></param>
/// <param name="isMagicDamage"></param>
/// <param name="magicType"></param>
/// <param name="damageResult"></param>
public virtual void AfterDamageCalculation(Character character, Character enemy, double damage, double actualDamage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
public virtual void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
}

View File

@ -18,11 +18,6 @@ namespace Milimoe.FunGame.Core.Entity
/// </summary>
public string Description => $"对目标敌人造成 {(1.0 + 0.05 * (Level - 1)) * 100:0.##}% 攻击力 [ {Damage:0.##} ] 点{(IsMagic ? CharacterSet.GetMagicDamageName(MagicType) : "")}。";
/// <summary>
/// 普通攻击的通用说明
/// </summary>
public string GeneralDescription => $"对目标敌人造成基于 100+5/Lv% 攻击力的{(IsMagic ? CharacterSet.GetMagicDamageName(MagicType) : "")}。";
/// <summary>
/// 所属的角色
/// </summary>
@ -58,16 +53,6 @@ namespace Milimoe.FunGame.Core.Entity
/// </summary>
public MagicType MagicType => _MagicType;
/// <summary>
/// 是否可用
/// </summary>
public bool Enable { get; set; } = true;
/// <summary>
/// 是否在持续生效,为 true 时不允许再次使用。普通攻击始终为 false
/// </summary>
public bool IsInEffect => false;
/// <summary>
/// 无视免疫类型
/// </summary>
@ -108,31 +93,6 @@ namespace Milimoe.FunGame.Core.Entity
/// </summary>
public double CanSelectTargetRange { get; set; } = 0;
/// <summary>
/// 普通攻击没有魔法消耗
/// </summary>
public double RealMPCost => 0;
/// <summary>
/// 普通攻击没有吟唱时间
/// </summary>
public double RealCastTime => 0;
/// <summary>
/// 普通攻击没有能量消耗
/// </summary>
public double RealEPCost => 0;
/// <summary>
/// 普通攻击没有冷却时间
/// </summary>
public double RealCD => 0;
/// <summary>
/// 普通攻击没有冷却时间
/// </summary>
public double CurrentCD => 0;
/// <summary>
/// 获取可选择的目标列表
/// </summary>
@ -169,10 +129,6 @@ namespace Milimoe.FunGame.Core.Entity
/// <param name="enemys"></param>
public void Attack(IGamingQueue queue, Character attacker, params IEnumerable<Character> enemys)
{
if (!Enable)
{
return;
}
foreach (Character enemy in enemys)
{
if (enemy.HP > 0)

View File

@ -1,20 +1,8 @@
namespace Milimoe.FunGame.Core.Entity
{
/// <summary>
/// 技能和它的目标结构体
/// </summary>
/// <param name="skill"></param>
/// <param name="targets"></param>
public struct SkillTarget(Skill skill, List<Character> targets)
{
/// <summary>
/// 技能实例
/// </summary>
public Skill Skill { get; set; } = skill;
/// <summary>
/// 技能的目标列表
/// </summary>
public List<Character> Targets { get; set; } = targets;
}
}

View File

@ -23,17 +23,7 @@
<Description>FunGame.Core: A C#.NET library for turn-based games.</Description>
<PackageTags>game;turn-based;server;framework;dotnet;csharp;gamedev</PackageTags>
<PackageReleaseNotes>
- Initial release candidate 1 (1.0.0-rc.1-0428)
- Abstract ActionQueue as GamingQueue, and separate the original Mix / Team modes into two queue types: MixGamingQueue and TeamGamingQueue. (1.0.0-rc.1-0502)
- In the Effect class, added ParentEffect and ForceHideInStatusBar properties for more precise control of the status bar display. (1.0.0-rc.1-0509)
- Added helper methods IsTeammate and GetIsTeammateDictionary to GamingQueue for determining if someone is a teammate, IGamingQueue also. This facilitates the skill effects to determine whether the target is a teammate. (1.0.0-rc.1-0509)
- Added more properties (such as Name, RealCD) to the ISkill interface. Both NormalAttack and Skill inherit from ISkill, thus implementing these properties, although some properties are not meaningful for NormalAttack. (1.0.0-rc.1-0509)
- Added corresponding text for EffectTypes Lifesteal and GrievousWound. (1.0.0-rc.1-0509)
- Added EffectTypes: WeakDispelling and StrongDispelling, representing DurativeWeak and DurativeStrong of DispelType. (1.0.0-rc.1-0509)
- Added underlying processing support for continuous dispelling in the TimeLapse method. (1.0.0-rc.1-0509)
- Fixed an issue where the effect's shield hook provided incorrect parameters. (1.0.0-rc.1-0509)
- Fixed an issue where the result of pre-hooks for evade and critical hit checks always deferred to the result of the last effect. It should be that if any effect prevents the check, it is skipped. (1.0.0-rc.1-0509)
- Added comments for some code. (1.0.0-rc.1-0509)
- Initial release candidate 1 (1.0.0-rc.1)
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/project-redbud/FunGame-Core</RepositoryUrl>
<PackageProjectUrl>https://github.com/project-redbud</PackageProjectUrl>

View File

@ -168,22 +168,6 @@ namespace Milimoe.FunGame.Core.Interface.Base
/// <returns></returns>
public Task<List<Character>> SelectTargetsAsync(Character character, NormalAttack attack, List<Character> enemys, List<Character> teammates);
/// <summary>
/// 判断目标对于某个角色是否是队友
/// </summary>
/// <param name="character"></param>
/// <param name="target"></param>
/// <returns></returns>
public bool IsTeammate(Character character, Character target);
/// <summary>
/// 获取目标对于某个角色是否是队友的字典
/// </summary>
/// <param name="character"></param>
/// <param name="targets"></param>
/// <returns></returns>
public Dictionary<Character, bool> GetIsTeammateDictionary(Character character, IEnumerable<Character> targets);
/// <summary>
/// 检查角色是否在 AI 控制状态
/// </summary>

View File

@ -2,25 +2,10 @@
{
public interface IBaseEntity : IEquatable<IBaseEntity>
{
/// <summary>
/// 实体的数字标识符
/// </summary>
public long Id { get; }
/// <summary>
/// 实体的唯一标识符
/// </summary>
public Guid Guid { get; }
/// <summary>
/// 实体的名称
/// </summary>
public string Name { get; }
/// <summary>
/// 获取实体的 Id.Name
/// </summary>
/// <returns></returns>
public string GetIdName();
}
}

View File

@ -2,41 +2,8 @@
namespace Milimoe.FunGame.Core.Interface.Entity
{
/// <summary>
/// ISkill 是技能的通用接口,包含一些基本属性,实现类:<see cref="NormalAttack"/> 和 <see cref="Skill"/>
/// </summary>
public interface ISkill : IBaseEntity
public interface ISkill
{
/// <summary>
/// 此技能所属的角色
/// </summary>
public Character? Character { get; }
/// <summary>
/// 技能描述
/// </summary>
public string Description { get; }
/// <summary>
/// 技能的通用描述
/// </summary>
public string GeneralDescription { get; }
/// <summary>
/// 技能等级,等于 0 时可以称之为尚未学习
/// </summary>
public int Level { get; }
/// <summary>
/// 是否可用 [ 此项为高优先级 ]
/// </summary>
public bool Enable { get; }
/// <summary>
/// 效果持续生效中 [ 此项为高优先级 ] [ 此项设置为true后不允许再次释放防止重复释放 ]
/// </summary>
public bool IsInEffect { get; }
/// <summary>
/// 可选取自身
/// </summary>
@ -61,36 +28,6 @@ namespace Milimoe.FunGame.Core.Interface.Entity
/// </summary>
public double CanSelectTargetRange { get; }
/// <summary>
/// 实际魔法消耗 [ 魔法 ]
/// </summary>
public double RealMPCost { get; }
/// <summary>
/// 实际吟唱时间 [ 魔法 ]
/// </summary>
public double RealCastTime { get; }
/// <summary>
/// 实际能量消耗 [ 战技 ]
/// </summary>
public double RealEPCost { get; }
/// <summary>
/// 实际冷却时间
/// </summary>
public double RealCD { get; }
/// <summary>
/// 剩余冷却时间
/// </summary>
public double CurrentCD { get; }
/// <summary>
/// 实际硬直时间
/// </summary>
public double RealHardnessTime { get; }
/// <summary>
/// 获取可选择的目标列表
/// </summary>

View File

@ -682,10 +682,6 @@ namespace Milimoe.FunGame.Core.Library.Constant
EffectType.SkilledImmune => "技能免疫",
EffectType.AllImmune => "完全免疫",
EffectType.EvadeBoost => "闪避提升",
EffectType.Lifesteal => "生命偷取",
EffectType.GrievousWound => "重伤",
EffectType.WeakDispelling => "持续性弱驱散",
EffectType.StrongDispelling => "持续性强驱散",
_ => "未知效果"
};
}
@ -714,8 +710,6 @@ namespace Milimoe.FunGame.Core.Library.Constant
EffectType.Petrify => DispelledType.Strong,
EffectType.SilenceMagic => DispelledType.Strong,
EffectType.Banish => DispelledType.Strong,
EffectType.AllImmune => DispelledType.Strong,
EffectType.StrongDispelling => DispelledType.Strong,
EffectType.Mark => DispelledType.Weak,
EffectType.Slow => DispelledType.Weak,
EffectType.Weaken => DispelledType.Weak,
@ -739,10 +733,10 @@ namespace Milimoe.FunGame.Core.Library.Constant
EffectType.PhysicalImmune => DispelledType.Weak,
EffectType.MagicalImmune => DispelledType.Weak,
EffectType.SkilledImmune => DispelledType.Weak,
EffectType.AllImmune => DispelledType.Strong,
EffectType.EvadeBoost => DispelledType.Weak,
EffectType.Lifesteal => DispelledType.Weak,
EffectType.GrievousWound => DispelledType.Weak,
EffectType.WeakDispelling => DispelledType.Weak,
_ => DispelledType.Weak
};
}

View File

@ -62,9 +62,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
{
Normal,
Critical,
Evaded,
Shield,
Immune
Evaded
}
public enum RedeemResult

View File

@ -228,11 +228,6 @@ namespace Milimoe.FunGame.Core.Library.Constant
/// <summary>
/// 注意:具有控制效果的特效,应该和技能本身的特效(一般此项为None)区分开来。此效果被赋值会改变一些判断的结果。
/// <para>关联方法:</para>
/// <para><see cref="SkillSet.GetCharacterStateByEffectType(EffectType)"/></para>
/// <para><see cref="SkillSet.GetDispelledTypeByEffectType(EffectType)"/></para>
/// <para><see cref="SkillSet.GetEffectTypeName(EffectType)"/></para>
/// <para><see cref="SkillSet.GetIsDebuffByEffectType(EffectType)"/></para>
/// </summary>
public enum EffectType
{
@ -469,17 +464,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
/// <summary>
/// 重伤,目标受到的治疗效果降低
/// </summary>
GrievousWound,
/// <summary>
/// 持续性弱驱散
/// </summary>
WeakDispelling,
/// <summary>
/// 持续性强驱散
/// </summary>
StrongDispelling
GrievousWound
}
public enum ItemType

View File

@ -8,7 +8,6 @@ namespace Milimoe.FunGame.Core.Model
{
/// <summary>
/// 提供一个基础的回合制游戏队列基类实现,可继承扩展
/// <para/>该默认实现为混战模式 <see cref="RoomType.Mix"/>
/// </summary>
public class GamingQueue : IGamingQueue
{
@ -578,6 +577,12 @@ namespace Milimoe.FunGame.Core.Model
List<Effect> effects = [.. character.Effects];
foreach (Effect effect in effects)
{
if (effect.IsBeingTemporaryDispelled)
{
effect.IsBeingTemporaryDispelled = false;
effect.OnEffectGained(character);
}
if (effect.Level == 0)
{
character.Effects.Remove(effect);
@ -590,18 +595,6 @@ namespace Milimoe.FunGame.Core.Model
effect.OnTimeElapsed(character, timeToReduce);
}
if (effect.IsBeingTemporaryDispelled)
{
effect.IsBeingTemporaryDispelled = false;
effect.OnEffectGained(character);
}
// 如果特效具备临时驱散或者持续性驱散的功能
if (effect.Source != null && (effect.EffectType == EffectType.WeakDispelling || effect.EffectType == EffectType.StrongDispelling))
{
effect.Dispel(effect.Source, character, IsTeammate(character, effect.Source));
}
// 自身被动不会考虑
if (effect.EffectType == EffectType.None && effect.Skill.SkillType == SkillType.Passive)
{
@ -1132,7 +1125,6 @@ namespace Milimoe.FunGame.Core.Model
}
else if (type == CharacterActionType.EndTurn)
{
baseTime = 3;
decided = true;
WriteLine($"[ {character} ] 结束了回合!");
await OnCharacterDoNothingAsync(character);
@ -1184,16 +1176,13 @@ namespace Milimoe.FunGame.Core.Model
LastRound.CastTime = newHardnessTime;
}
AddCharacter(character, newHardnessTime, isCheckProtected);
LastRound.HardnessTime = newHardnessTime;
await OnQueueUpdatedAsync(_queue, character, newHardnessTime, QueueUpdatedReason.Action, "设置角色行动后的硬直时间。");
LastRound.HardnessTime = newHardnessTime;
effects = [.. character.Effects];
effects = [.. character.Effects.Where(e => e.IsInEffect)];
foreach (Effect effect in effects)
{
if (effect.IsInEffect)
{
effect.OnTurnEnd(character);
}
effect.OnTurnEnd(character);
// 自身被动不会考虑
if (effect.EffectType == EffectType.None && effect.Skill.SkillType == SkillType.Passive)
@ -1341,10 +1330,8 @@ namespace Milimoe.FunGame.Core.Model
return;
}
// 不管有没有暴击,都尝试往回合记录中添加目标,不暴击时不会修改原先值
if (!LastRound.IsCritical.TryAdd(enemy, damageResult == DamageResult.Critical) && damageResult == DamageResult.Critical)
{
// 暴击了修改目标对应的值为 true
LastRound.IsCritical[enemy] = true;
}
@ -1362,7 +1349,6 @@ namespace Milimoe.FunGame.Core.Model
}
}
damage += totalDamageBonus.Sum(kv => kv.Value);
double actualDamage = damage;
// 闪避了就没伤害了
if (damageResult != DamageResult.Evaded)
@ -1406,7 +1392,6 @@ namespace Milimoe.FunGame.Core.Model
if (isImmune)
{
// 免疫
damageResult = DamageResult.Immune;
LastRound.IsImmune[enemy] = true;
WriteLine($"[ {enemy} ] 免疫了此伤害!");
}
@ -1425,7 +1410,7 @@ namespace Milimoe.FunGame.Core.Model
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
foreach (Effect effect in effects)
{
if (!effect.BeforeShieldCalculation(enemy, actor, isMagicDamage, magicType, damage, shield, ref shieldMsg))
if (!effect.BeforeShieldCalculation(actor, enemy, isMagicDamage, magicType, damage, shield, ref shieldMsg))
{
change = true;
}
@ -1443,7 +1428,7 @@ namespace Milimoe.FunGame.Core.Model
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
foreach (Effect effect in effects)
{
if (!effect.OnShieldBroken(enemy, actor, isMagicDamage, magicType, damage, shield, remain))
if (!effect.OnShieldBroken(actor, enemy, isMagicDamage, magicType, damage, shield, remain))
{
change = true;
}
@ -1453,31 +1438,21 @@ namespace Milimoe.FunGame.Core.Model
{
enemy.HP -= remain;
shieldMsg = $"(护盾抵消了 {shield:0.##} 点并破碎,角色承受了 {remain:0.##} 点)";
actualDamage = remain;
}
else
{
shieldMsg = $"(护盾抵消了 {shield:0.##} 点并破碎,角色没有承受伤害)";
damageResult = DamageResult.Shield;
actualDamage = 0;
}
}
else
{
enemy.Shield[isMagicDamage, magicType] = remain;
shieldMsg = $"(护盾抵消了 {damage:0.##} 点,剩余可用 {remain:0.##} 点)";
damageResult = DamageResult.Shield;
actualDamage = 0;
}
}
else
else if (shieldMsg.Trim() == "")
{
if (shieldMsg.Trim() == "")
{
shieldMsg = $"(护盾已使其无效化)";
}
damageResult = DamageResult.Shield;
actualDamage = 0;
shieldMsg = $"(护盾已使其无效化)";
}
}
else enemy.HP -= damage;
@ -1489,7 +1464,7 @@ namespace Milimoe.FunGame.Core.Model
}
else WriteLine($"[ {enemy} ] 受到了 {damage:0.##} 点物理伤害!{shieldMsg}");
// 生命偷取,攻击者为全额
// 生命偷取
double steal = damage * actor.Lifesteal;
await HealToTargetAsync(actor, actor, steal, false);
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
@ -1498,7 +1473,7 @@ namespace Milimoe.FunGame.Core.Model
effect.AfterLifesteal(actor, enemy, damage, steal);
}
// 造成伤害和受伤都可以获得能量。攻击者为全额,被攻击者为 actualDamage护盾抵消的伤害不算
// 造成伤害和受伤都可以获得能量
double ep = GetEP(damage, GameplayEquilibriumConstant.DamageGetEPFactor, GameplayEquilibriumConstant.DamageGetEPMax);
effects = [.. actor.Effects.Where(e => e.IsInEffect)];
foreach (Effect effect in effects)
@ -1506,7 +1481,7 @@ namespace Milimoe.FunGame.Core.Model
effect.AlterEPAfterDamage(actor, ref ep);
}
actor.EP += ep;
ep = GetEP(actualDamage, GameplayEquilibriumConstant.TakenDamageGetEPFactor, GameplayEquilibriumConstant.TakenDamageGetEPMax);
ep = GetEP(damage, GameplayEquilibriumConstant.TakenDamageGetEPFactor, GameplayEquilibriumConstant.TakenDamageGetEPMax);
effects = [.. enemy.Effects.Where(e => e.IsInEffect)];
foreach (Effect effect in effects)
{
@ -1515,7 +1490,7 @@ namespace Milimoe.FunGame.Core.Model
enemy.EP += ep;
// 统计伤害
CalculateCharacterDamageStatistics(actor, enemy, damage, isMagicDamage, actualDamage);
CalculateCharacterDamageStatistics(actor, enemy, damage, isMagicDamage);
// 计算助攻
_assistDetail[actor][enemy, TotalTime] += damage;
@ -1526,12 +1501,12 @@ namespace Milimoe.FunGame.Core.Model
LastRound.IsEvaded[enemy] = true;
}
await OnDamageToEnemyAsync(actor, enemy, damage, actualDamage, isNormalAttack, isMagicDamage, magicType, damageResult);
await OnDamageToEnemyAsync(actor, enemy, damage, isNormalAttack, isMagicDamage, magicType, damageResult);
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
foreach (Effect effect in effects)
{
effect.AfterDamageCalculation(actor, enemy, damage, actualDamage, isNormalAttack, isMagicDamage, magicType, damageResult);
effect.AfterDamageCalculation(actor, enemy, damage, isNormalAttack, isMagicDamage, magicType, damageResult);
}
if (enemy.HP <= 0 && !_eliminated.Contains(enemy) && !_respawnCountdown.ContainsKey(enemy))
@ -1596,11 +1571,7 @@ namespace Milimoe.FunGame.Core.Model
{
WriteLine($"[ {target} ] 复苏了,并回复了 {heal:0.##} 点生命值!!");
}
double hp = target.HP;
double mp = target.MP;
await SetCharacterRespawn(target);
target.HP = hp;
target.MP = mp;
}
else
{
@ -1640,28 +1611,20 @@ namespace Milimoe.FunGame.Core.Model
_stats[death].Deaths += 1;
int money = Random.Shared.Next(250, 350);
// 按伤害比分配金钱 只有造成 10% 伤害以上并且是在 30 时间内造成的伤害才能参与
// 现在 20 时间内的非伤害类型辅助也能参与助攻了
Character[] assists = [.. _assistDetail.Keys.Where(c => c != death && (_assistDetail[c].GetPercentage(death) > 0.10 &&
(_assistDetail[c].GetLastTime(death) - TotalTime <= 30) || (_assistDetail[c].GetNotDamageAssistLastTime(killer) - TotalTime <= 20)))];
double totalDamagePercentage = _assistDetail.Keys.Where(assists.Contains).Select(c => _assistDetail[c].GetPercentage(death) < 0.10 &&
_assistDetail[c].GetNotDamageAssistLastTime(killer) - TotalTime <= 20 ? 0.1 : _assistDetail[c].GetPercentage(death)).Sum();
// 按伤害比分配金钱 只有造成 10% 伤害以上并且是在 30 秒内造成的伤害才能参与
// 现在 20 秒内的非伤害类型辅助也能参与助攻了
Character[] assists = [.. _assistDetail.Keys.Where(c => c != death && _assistDetail[c].GetPercentage(death) > 0.10 &&
(_assistDetail[c].GetLastTime(death) - TotalTime <= 30 || _assistDetail[c].GetNotDamageAssistLastTime(killer) - TotalTime <= 20))];
double totalDamagePercentage = _assistDetail.Keys.Where(assists.Contains).Select(c => _assistDetail[c].GetPercentage(death)).Sum();
int totalMoney = Math.Min(Convert.ToInt32(money * totalDamagePercentage), 425); // 防止刷伤害设置金钱上限
// 分配金钱和累计助攻
foreach (Character assist in assists)
{
bool hasNotDamageAssist = _assistDetail[assist].GetNotDamageAssistLastTime(killer) - TotalTime <= 20;
double damagePercentage = _assistDetail[assist].GetPercentage(death);
if (hasNotDamageAssist && damagePercentage < 0.1)
{
damagePercentage = 0.1;
}
int cmoney = Convert.ToInt32(damagePercentage / totalDamagePercentage * totalMoney);
int cmoney = Convert.ToInt32(_assistDetail[assist].GetPercentage(death) / totalDamagePercentage * totalMoney);
if (assist != killer)
{
if (!_earnedMoney.TryAdd(assist, cmoney)) _earnedMoney[assist] += cmoney;
assist.User.Inventory.Credits += cmoney;
_stats[assist].Assists += 1;
}
else
@ -1731,7 +1694,6 @@ namespace Milimoe.FunGame.Core.Model
}
if (!_earnedMoney.TryAdd(killer, money)) _earnedMoney[killer] += money;
killer.User.Inventory.Credits += money;
await OnDeathCalculation(death, killer);
@ -1745,14 +1707,14 @@ namespace Milimoe.FunGame.Core.Model
}
_continuousKilling.Remove(death);
_eliminated.Add(death);
if (MaxRespawnTimes == 0)
{
// do nothing
_eliminated.Add(death);
}
else if (_respawnTimes.TryGetValue(death, out int times) && MaxRespawnTimes != -1 && times == MaxRespawnTimes)
{
WriteLine($"[ {death} ] 已达到复活次数上限,将不能再复活!!");
_eliminated.Add(death);
}
else
{
@ -2073,10 +2035,7 @@ namespace Milimoe.FunGame.Core.Model
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
foreach (Effect effect in effects)
{
if (!effect.BeforeEvadeCheck(actor, enemy, ref throwingBonus))
{
checkEvade = false;
}
checkEvade = effect.BeforeEvadeCheck(actor, enemy, ref throwingBonus);
}
if (checkEvade)
@ -2116,10 +2075,7 @@ namespace Milimoe.FunGame.Core.Model
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
foreach (Effect effect in effects)
{
if (!effect.BeforeCriticalCheck(actor, enemy, ref throwingBonus))
{
checkCritical = false;
}
checkCritical = effect.BeforeCriticalCheck(actor, enemy, ref throwingBonus);
}
if (checkCritical)
@ -2189,10 +2145,7 @@ namespace Milimoe.FunGame.Core.Model
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
foreach (Effect effect in effects)
{
if (!effect.BeforeEvadeCheck(actor, enemy, ref throwingBonus))
{
checkEvade = false;
}
checkEvade = effect.BeforeEvadeCheck(actor, enemy, ref throwingBonus);
}
if (checkEvade)
@ -2231,10 +2184,7 @@ namespace Milimoe.FunGame.Core.Model
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
foreach (Effect effect in effects)
{
if (!effect.BeforeCriticalCheck(actor, enemy, ref throwingBonus))
{
checkCritical = false;
}
checkCritical = effect.BeforeCriticalCheck(actor, enemy, ref throwingBonus);
}
if (checkCritical)
@ -2268,35 +2218,6 @@ namespace Milimoe.FunGame.Core.Model
return Math.Min((a + Random.Shared.Next(30)) * b, max);
}
/// <summary>
/// 判断目标对于某个角色是否是队友
/// </summary>
/// <param name="character"></param>
/// <param name="target"></param>
/// <returns></returns>
public bool IsTeammate(Character character, Character target)
{
List<Character> teammates = GetTeammates(character);
return teammates.Contains(target);
}
/// <summary>
/// 获取目标对于某个角色是否是友方的字典
/// </summary>
/// <param name="character"></param>
/// <param name="targets"></param>
/// <returns></returns>
public Dictionary<Character, bool> GetIsTeammateDictionary(Character character, params IEnumerable<Character> targets)
{
Dictionary<Character, bool> dict = [];
List<Character> teammates = GetTeammates(character);
foreach (Character target in targets)
{
dict[target] = teammates.Contains(target);
}
return dict;
}
#endregion
#region
@ -2490,16 +2411,15 @@ namespace Milimoe.FunGame.Core.Model
{
double hardnessTime = 5;
character.Respawn(_original[character.Guid]);
_eliminated.Remove(character);
WriteLine($"[ {character} ] 已复活!获得 {hardnessTime} {GameplayEquilibriumConstant.InGameTime}的硬直时间。");
AddCharacter(character, hardnessTime, false);
await OnQueueUpdatedAsync(_queue, character, hardnessTime, QueueUpdatedReason.Respawn, "设置角色复活后的硬直时间。");
LastRound.Respawns.Add(character);
_respawnCountdown.Remove(character);
if (!_respawnTimes.TryAdd(character, 1))
{
_respawnTimes[character] += 1;
}
await OnQueueUpdatedAsync(_queue, character, hardnessTime, QueueUpdatedReason.Respawn, "设置角色复活后的硬直时间。");
}
/// <summary>
@ -2534,8 +2454,8 @@ namespace Milimoe.FunGame.Core.Model
}
}
AddCharacter(character, Calculation.Round2Digits(baseHardnessTime + preCastSSCount * 0.01), false);
skill.OnSkillCasting(this, character, []);
await OnQueueUpdatedAsync(_queue, character, 0, QueueUpdatedReason.PreCastSuperSkill, "设置角色预释放爆发技的硬直时间。");
skill.OnSkillCasting(this, character, []);
}
}
@ -2659,9 +2579,8 @@ namespace Milimoe.FunGame.Core.Model
/// <summary>
/// 计算角色的数据
/// </summary>
public void CalculateCharacterDamageStatistics(Character character, Character characterTaken, double damage, bool isMagic, double takenDamage = -1)
public void CalculateCharacterDamageStatistics(Character character, Character characterTaken, double damage, bool isMagic)
{
if (takenDamage == -1) takenDamage = damage;
if (_stats.TryGetValue(character, out CharacterStatistics? stats) && stats != null)
{
if (isMagic)
@ -2678,13 +2597,13 @@ namespace Milimoe.FunGame.Core.Model
{
if (isMagic)
{
statsTaken.TotalTakenMagicDamage = Calculation.Round2Digits(statsTaken.TotalTakenMagicDamage + takenDamage);
statsTaken.TotalTakenMagicDamage = Calculation.Round2Digits(statsTaken.TotalTakenMagicDamage + damage);
}
else
{
statsTaken.TotalTakenPhysicalDamage = Calculation.Round2Digits(statsTaken.TotalTakenPhysicalDamage + takenDamage);
statsTaken.TotalTakenPhysicalDamage = Calculation.Round2Digits(statsTaken.TotalTakenPhysicalDamage + damage);
}
statsTaken.TotalTakenDamage = Calculation.Round2Digits(statsTaken.TotalTakenDamage + takenDamage);
statsTaken.TotalTakenDamage = Calculation.Round2Digits(statsTaken.TotalTakenDamage + damage);
}
if (LastRound.Damages.TryGetValue(characterTaken, out double damageTotal))
{
@ -2937,7 +2856,7 @@ namespace Milimoe.FunGame.Core.Model
await (HealToTarget?.Invoke(this, actor, target, heal, isRespawn) ?? Task.CompletedTask);
}
public delegate Task DamageToEnemyEventHandler(GamingQueue queue, Character actor, Character enemy, double damage, double actualDamage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult);
public delegate Task DamageToEnemyEventHandler(GamingQueue queue, Character actor, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult);
/// <summary>
/// 造成伤害事件
/// </summary>
@ -2948,15 +2867,14 @@ namespace Milimoe.FunGame.Core.Model
/// <param name="actor"></param>
/// <param name="enemy"></param>
/// <param name="damage"></param>
/// <param name="actualDamage"></param>
/// <param name="isNormalAttack"></param>
/// <param name="isMagicDamage"></param>
/// <param name="magicType"></param>
/// <param name="damageResult"></param>
/// <returns></returns>
protected async Task OnDamageToEnemyAsync(Character actor, Character enemy, double damage, double actualDamage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
protected async Task OnDamageToEnemyAsync(Character actor, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
await (DamageToEnemy?.Invoke(this, actor, enemy, damage, actualDamage, isNormalAttack, isMagicDamage, magicType, damageResult) ?? Task.CompletedTask);
await (DamageToEnemy?.Invoke(this, actor, enemy, damage, isNormalAttack, isMagicDamage, magicType, damageResult) ?? Task.CompletedTask);
}
public delegate Task CharacterNormalAttackEventHandler(GamingQueue queue, Character actor, List<Character> targets);

View File

@ -3,9 +3,6 @@ using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Model
{
/// <summary>
/// 混战游戏队列,增强版混战模式 <see cref="RoomType.Mix"/>
/// </summary>
public class MixGamingQueue : GamingQueue
{
/// <summary>

View File

@ -3,9 +3,6 @@ using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Model
{
/// <summary>
/// 团队游戏队列,团队模式 <see cref="RoomType.Team"/>
/// </summary>
public class TeamGamingQueue : GamingQueue
{
/// <summary>

View File

@ -36,8 +36,6 @@ git clone -b latest https://github.com/project-redbud/FunGame-Core.git
我们维护了一份 API 文档,如有需要请随时查阅:[FunGame 开发文档](https://project-redbud.github.io/)。
文档内容会随着本项目的更改而变化,但是我们不保证能够及时更新文档。
也欢迎查阅由 `DeepWiki` 提供的 AI 生成的文档:[DeepWiki 文档](https://deepwiki.com/project-redbud/FunGame-Core),此 AI 工具从头到尾分析了整个项目的代码并组织为 Wiki 形式,方便开发者结合源代码来理解整个项目。
在使用本项目的过程中遇到任何问题,欢迎提交 [issues](https://github.com/project-redbud/FunGame-Core/issues),我们会积极解决你的问题。
## 许可证