2024-10-30 20:31:15 +08:00

176 lines
7.6 KiB
C#

using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Testing.Effects.OpenEffects;
using Milimoe.FunGame.Testing.Items;
using Milimoe.FunGame.Testing.Skills;
namespace Addons
{
public class ExampleGameModuleConstant
{
public const string Example = "fungame.example.gamemode";
public const string ExampleCharacter = "fungame.example.character";
public const string ExampleSkill = "fungame.example.skill";
public const string ExampleItem = "fungame.example.item";
}
public class ExampleCharacterModule : CharacterModule
{
public override string Name => ExampleGameModuleConstant.ExampleCharacter;
public override string Description => "My First CharacterModule";
public override string Version => "1.0.0";
public override string Author => "FunGamer";
public override Dictionary<string, Character> Characters
{
get
{
EntityModuleConfig<Character> config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter);
config.LoadConfig();
return config;
}
}
}
public class ExampleSkillModule : SkillModule
{
public override string Name => ExampleGameModuleConstant.ExampleSkill;
public override string Description => "My First SkillModule";
public override string Version => "1.0.0";
public override string Author => "FunGamer";
public override Dictionary<string, Skill> Skills
{
get
{
return Factory.GetGameModuleInstances<Skill>(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleSkill);
}
}
protected override Factory.EntityFactoryDelegate<Skill> SkillFactory()
{
return (id, name, args) =>
{
Skill skill = id switch
{
(long)MagicID. => new (),
(long)SkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)SuperSkillID. => new (),
(long)PassiveID.META马 => new META马(),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)PassiveID. => new (),
(long)ItemPassiveID. => new (),
_ => new OpenSkill(id, name, args)
};
if (skill is OpenSkill && args.TryGetValue("values", out object? value) && value is Dictionary<string, object> dict)
{
foreach (string key in dict.Keys)
{
skill.Values[key] = dict[key];
}
}
return skill;
};
}
protected override Factory.EntityFactoryDelegate<Effect> EffectFactory()
{
return (id, name, args) =>
{
if (args.TryGetValue("skill", out object? value) && value is Skill skill && args.TryGetValue("values", out value) && value is Dictionary<string, object> dict)
{
return (EffectID)id switch
{
EffectID.ExATK => new ExATK(skill, dict),
EffectID.ExDEF => new ExDEF(skill, dict),
EffectID.ExSTR => new ExSTR(skill, dict),
EffectID.ExAGI => new ExAGI(skill, dict),
EffectID.ExINT => new ExINT(skill, dict),
EffectID.SkillHardTimeReduce => new SkillHardTimeReduce(skill, dict),
EffectID.NormalAttackHardTimeReduce => new NormalAttackHardTimeReduce(skill, dict),
EffectID.AccelerationCoefficient => new AccelerationCoefficient(skill, dict),
EffectID.ExSPD => new ExSPD(skill, dict),
EffectID.ExActionCoefficient => new ExActionCoefficient(skill, dict),
EffectID.ExCDR => new ExCDR(skill, dict),
EffectID.ExMaxHP => new ExMaxHP(skill, dict),
EffectID.ExMaxMP => new ExMaxMP(skill, dict),
EffectID.ExCritRate => new ExCritRate(skill, dict),
EffectID.ExCritDMG => new ExCritDMG(skill, dict),
EffectID.ExEvadeRate => new ExEvadeRate(skill, dict),
EffectID.PhysicalPenetration => new PhysicalPenetration(skill, dict),
EffectID.MagicalPenetration => new MagicalPenetration(skill, dict),
EffectID.ExPDR => new ExPDR(skill, dict),
EffectID.ExMDF => new ExMDF(skill, dict),
EffectID.ExHR => new ExHR(skill, dict),
EffectID.ExMR => new ExMR(skill, dict),
_ => null
};
}
return null;
};
}
}
public class ExampleItemModule : ItemModule
{
public override string Name => ExampleGameModuleConstant.ExampleItem;
public override string Description => "My First ItemModule";
public override string Version => "1.0.0";
public override string Author => "FunGamer";
public override Dictionary<string, Item> Items
{
get
{
return Factory.GetGameModuleInstances<Item>(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleItem);
}
}
protected override Factory.EntityFactoryDelegate<Item> ItemFactory()
{
return (id, name, args) =>
{
return id switch
{
(long)AccessoryID.10 => new 10(),
(long)AccessoryID.30 => new 30(),
(long)AccessoryID.50 => new 50(),
_ => null,
};
};
}
}
}