Properties (hp, atk, etc.), spawn test monster
This commit is contained in:
parent
bfa305df8e
commit
8506dbdf71
16 changed files with 1568179 additions and 17 deletions
148
Core/Config/BasePropertyConfig.cs
Normal file
148
Core/Config/BasePropertyConfig.cs
Normal file
|
@ -0,0 +1,148 @@
|
|||
using Core.Config.Attributes;
|
||||
|
||||
namespace Core.Config;
|
||||
|
||||
[ConfigCollection("property/baseproperty.json")]
|
||||
public class BasePropertyConfig : IConfig
|
||||
{
|
||||
public ConfigType Type => ConfigType.BaseProperty;
|
||||
public int Identifier => Id;
|
||||
|
||||
public int Id { get; set; }
|
||||
public int Lv { get; set; }
|
||||
public int LifeMax { get; set; }
|
||||
public int Life { get; set; }
|
||||
public int Sheild { get; set; }
|
||||
public int SheildDamageChange { get; set; }
|
||||
public int SheildDamageReduce { get; set; }
|
||||
public int Atk { get; set; }
|
||||
public int Crit { get; set; }
|
||||
public int CritDamage { get; set; }
|
||||
public int Def { get; set; }
|
||||
public int EnergyEfficiency { get; set; }
|
||||
public int CdReduse { get; set; }
|
||||
public int ReactionEfficiency { get; set; }
|
||||
public int DamageChangeNormalSkill { get; set; }
|
||||
public int DamageChange { get; set; }
|
||||
public int DamageReduce { get; set; }
|
||||
public int DamageChangeAuto { get; set; }
|
||||
public int DamageChangeCast { get; set; }
|
||||
public int DamageChangeUltra { get; set; }
|
||||
public int DamageChangeQte { get; set; }
|
||||
public int DamageChangePhys { get; set; }
|
||||
public int DamageChangeElement1 { get; set; }
|
||||
public int DamageChangeElement2 { get; set; }
|
||||
public int DamageChangeElement3 { get; set; }
|
||||
public int DamageChangeElement4 { get; set; }
|
||||
public int DamageChangeElement5 { get; set; }
|
||||
public int DamageChangeElement6 { get; set; }
|
||||
public int DamageResistancePhys { get; set; }
|
||||
public int DamageResistanceElement1 { get; set; }
|
||||
public int DamageResistanceElement2 { get; set; }
|
||||
public int DamageResistanceElement3 { get; set; }
|
||||
public int DamageResistanceElement4 { get; set; }
|
||||
public int DamageResistanceElement5 { get; set; }
|
||||
public int DamageResistanceElement6 { get; set; }
|
||||
public int HealChange { get; set; }
|
||||
public int HealedChange { get; set; }
|
||||
public int DamageReducePhys { get; set; }
|
||||
public int DamageReduceElement1 { get; set; }
|
||||
public int DamageReduceElement2 { get; set; }
|
||||
public int DamageReduceElement3 { get; set; }
|
||||
public int DamageReduceElement4 { get; set; }
|
||||
public int DamageReduceElement5 { get; set; }
|
||||
public int DamageReduceElement6 { get; set; }
|
||||
public int ReactionChange1 { get; set; }
|
||||
public int ReactionChange2 { get; set; }
|
||||
public int ReactionChange3 { get; set; }
|
||||
public int ReactionChange4 { get; set; }
|
||||
public int ReactionChange5 { get; set; }
|
||||
public int ReactionChange6 { get; set; }
|
||||
public int ReactionChange7 { get; set; }
|
||||
public int ReactionChange8 { get; set; }
|
||||
public int ReactionChange9 { get; set; }
|
||||
public int ReactionChange10 { get; set; }
|
||||
public int ReactionChange11 { get; set; }
|
||||
public int ReactionChange12 { get; set; }
|
||||
public int ReactionChange13 { get; set; }
|
||||
public int ReactionChange14 { get; set; }
|
||||
public int ReactionChange15 { get; set; }
|
||||
public int EnergyMax { get; set; }
|
||||
public int Energy { get; set; }
|
||||
public int SpecialEnergy1Max { get; set; }
|
||||
public int SpecialEnergy1 { get; set; }
|
||||
public int SpecialEnergy2Max { get; set; }
|
||||
public int SpecialEnergy2 { get; set; }
|
||||
public int SpecialEnergy3Max { get; set; }
|
||||
public int SpecialEnergy3 { get; set; }
|
||||
public int SpecialEnergy4Max { get; set; }
|
||||
public int SpecialEnergy4 { get; set; }
|
||||
public int StrengthMax { get; set; }
|
||||
public int Strength { get; set; }
|
||||
public int StrengthRecover { get; set; }
|
||||
public int StrengthPunishTime { get; set; }
|
||||
public int StrengthRun { get; set; }
|
||||
public int StrengthSwim { get; set; }
|
||||
public int StrengthFastSwim { get; set; }
|
||||
public int StrengthClimb { get; set; }
|
||||
public int StrengthFastClimb { get; set; }
|
||||
public int HardnessMax { get; set; }
|
||||
public int Hardness { get; set; }
|
||||
public int HardnessRecover { get; set; }
|
||||
public int HardnessPunishTime { get; set; }
|
||||
public int HardnessChange { get; set; }
|
||||
public int HardnessReduce { get; set; }
|
||||
public int RageMax { get; set; }
|
||||
public int Rage { get; set; }
|
||||
public int RageRecover { get; set; }
|
||||
public int RagePunishTime { get; set; }
|
||||
public int RageChange { get; set; }
|
||||
public int RageReduce { get; set; }
|
||||
public int ToughMax { get; set; }
|
||||
public int Tough { get; set; }
|
||||
public int ToughRecover { get; set; }
|
||||
public int ToughChange { get; set; }
|
||||
public int ToughReduce { get; set; }
|
||||
public int ToughRecoverDelayTime { get; set; }
|
||||
public int ElementPower1 { get; set; }
|
||||
public int ElementPower2 { get; set; }
|
||||
public int ElementPower3 { get; set; }
|
||||
public int ElementPower4 { get; set; }
|
||||
public int ElementPower5 { get; set; }
|
||||
public int ElementPower6 { get; set; }
|
||||
public int SpecialDamageChange { get; set; }
|
||||
public int StrengthFastClimbCost { get; set; }
|
||||
public int ElementPropertyType { get; set; }
|
||||
public int WeakTime { get; set; }
|
||||
public int IgnoreDefRate { get; set; }
|
||||
public int IgnoreDamageResistancePhys { get; set; }
|
||||
public int IgnoreDamageResistanceElement1 { get; set; }
|
||||
public int IgnoreDamageResistanceElement2 { get; set; }
|
||||
public int IgnoreDamageResistanceElement3 { get; set; }
|
||||
public int IgnoreDamageResistanceElement4 { get; set; }
|
||||
public int IgnoreDamageResistanceElement5 { get; set; }
|
||||
public int IgnoreDamageResistanceElement6 { get; set; }
|
||||
public int SkillToughRatio { get; set; }
|
||||
public int StrengthClimbJump { get; set; }
|
||||
public int StrengthGliding { get; set; }
|
||||
public int Mass { get; set; }
|
||||
public int BrakingFrictionFactor { get; set; }
|
||||
public int GravityScale { get; set; }
|
||||
public int SpeedRatio { get; set; }
|
||||
public int DamageChangePhantom { get; set; }
|
||||
public int AutoAttackSpeed { get; set; }
|
||||
public int CastAttackSpeed { get; set; }
|
||||
public int StatusBuildUp1Max { get; set; }
|
||||
public int StatusBuildUp1 { get; set; }
|
||||
public int StatusBuildUp2Max { get; set; }
|
||||
public int StatusBuildUp2 { get; set; }
|
||||
public int StatusBuildUp3Max { get; set; }
|
||||
public int StatusBuildUp3 { get; set; }
|
||||
public int StatusBuildUp4Max { get; set; }
|
||||
public int StatusBuildUp4 { get; set; }
|
||||
public int StatusBuildUp5Max { get; set; }
|
||||
public int StatusBuildUp5 { get; set; }
|
||||
public int ParalysisTimeMax { get; set; }
|
||||
public int ParalysisTime { get; set; }
|
||||
public int ParalysisTimeRecover { get; set; }
|
||||
}
|
17
Core/Config/BlueprintConfig.cs
Normal file
17
Core/Config/BlueprintConfig.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using Core.Config.Attributes;
|
||||
|
||||
namespace Core.Config;
|
||||
|
||||
[ConfigCollection("blueprint/blueprintconfig.json")]
|
||||
public class BlueprintConfig : IConfig
|
||||
{
|
||||
public ConfigType Type => ConfigType.Blueprint;
|
||||
public int Identifier => Id;
|
||||
|
||||
public int Id { get; set; }
|
||||
public string BlueprintType { get; set; } = string.Empty;
|
||||
public string EntityType { get; set; } = string.Empty;
|
||||
public string EntityLogic { get; set; } = string.Empty;
|
||||
public int ModelId { get; set; }
|
||||
public int HalfHeight { get; set; }
|
||||
}
|
|
@ -2,5 +2,8 @@
|
|||
public enum ConfigType
|
||||
{
|
||||
RoleInfo,
|
||||
Weapon
|
||||
Weapon,
|
||||
BaseProperty,
|
||||
LevelEntity,
|
||||
Blueprint
|
||||
}
|
||||
|
|
27
Core/Config/LevelEntityConfig.cs
Normal file
27
Core/Config/LevelEntityConfig.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using Core.Config.Attributes;
|
||||
|
||||
namespace Core.Config;
|
||||
|
||||
[ConfigCollection("level_entity/levelentityconfig.json")]
|
||||
public class LevelEntityConfig : IConfig
|
||||
{
|
||||
public ConfigType Type => ConfigType.LevelEntity;
|
||||
public int Identifier => Id;
|
||||
|
||||
public int Id { get; set; }
|
||||
public int MapId { get; set; }
|
||||
public int EntityId { get; set; }
|
||||
public string BlueprintType { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public bool InSleep { get; set; }
|
||||
public bool IsHidden { get; set; }
|
||||
public int AreaId { get; set; }
|
||||
public Transform[] Transform { get; set; } = [];
|
||||
}
|
||||
|
||||
public class Transform
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public int Z { get; set; }
|
||||
}
|
|
@ -13,6 +13,8 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="data\config\blueprint\blueprintconfig.json" />
|
||||
<None Remove="data\config\property\baseproperty.json" />
|
||||
<None Remove="data\config\weapon\weaponconf.json" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -20,4 +22,8 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="data\config\level_entity\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
12986
Core/data/config/blueprint/blueprintconfig.json
Normal file
12986
Core/data/config/blueprint/blueprintconfig.json
Normal file
File diff suppressed because it is too large
Load diff
1488979
Core/data/config/level_entity/levelentityconfig.json
Normal file
1488979
Core/data/config/level_entity/levelentityconfig.json
Normal file
File diff suppressed because it is too large
Load diff
65749
Core/data/config/property/baseproperty.json
Normal file
65749
Core/data/config/property/baseproperty.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,7 @@ internal class CreatureController : Controller
|
|||
|
||||
await Session.Push(MessageId.JoinSceneNotify, new JoinSceneNotify
|
||||
{
|
||||
MaxEntityId = 10000,
|
||||
MaxEntityId = 10000000,
|
||||
TransitionOption = new TransitionOptionPb
|
||||
{
|
||||
TransitionType = (int)TransitionType.Empty
|
||||
|
@ -226,6 +226,7 @@ internal class CreatureController : Controller
|
|||
entity.IsCurrentRole = i == 0;
|
||||
|
||||
_entitySystem.Create(entity);
|
||||
entity.InitProps(_configManager.GetConfig<BasePropertyConfig>(entity.ConfigId)!);
|
||||
|
||||
// Give weapon to entity
|
||||
RoleInfoConfig roleConfig = _configManager.GetConfig<RoleInfoConfig>(entity.ConfigId)!;
|
||||
|
@ -234,5 +235,17 @@ internal class CreatureController : Controller
|
|||
|
||||
if (i == 0) _modelManager.Creature.PlayerEntityId = entity.Id;
|
||||
}
|
||||
|
||||
// Test monster
|
||||
MonsterEntity monster = _entityFactory.CreateMonster(102000014); // Monster001
|
||||
monster.Pos = new()
|
||||
{
|
||||
X = 4444,
|
||||
Y = -2222,
|
||||
Z = 260
|
||||
};
|
||||
|
||||
_entitySystem.Create(monster);
|
||||
monster.InitProps(_configManager.GetConfig<BasePropertyConfig>(600000100)!);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ internal class FormationController : Controller
|
|||
{
|
||||
new FightFormation
|
||||
{
|
||||
CurRole = _modelManager.Player.Characters[0],
|
||||
CurRole = _modelManager.Formation.RoleIds[0],
|
||||
FormationId = 1,
|
||||
IsCurrent = true,
|
||||
RoleIds = { _modelManager.Player.Characters },
|
||||
RoleIds = { _modelManager.Formation.RoleIds },
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
20
GameServer/Systems/Entity/Component/EntityFsmComponent.cs
Normal file
20
GameServer/Systems/Entity/Component/EntityFsmComponent.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using Protocol;
|
||||
|
||||
namespace GameServer.Systems.Entity.Component;
|
||||
internal class EntityFsmComponent : EntityComponentBase
|
||||
{
|
||||
public List<DFsm> Fsms { get; } = [];
|
||||
|
||||
public override EntityComponentType Type => EntityComponentType.EntityFsm;
|
||||
|
||||
public override EntityComponentPb Pb => new()
|
||||
{
|
||||
EntityFsmComponentPb = new()
|
||||
{
|
||||
Fsms =
|
||||
{
|
||||
Fsms
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using Protocol;
|
||||
|
||||
namespace GameServer.Systems.Entity.Component;
|
||||
internal class EntityMonsterAiComponent : EntityComponentBase
|
||||
{
|
||||
public override EntityComponentType Type => EntityComponentType.MonsterAi;
|
||||
|
||||
public int AiTeamInitId { get; set; }
|
||||
|
||||
public override EntityComponentPb Pb => new()
|
||||
{
|
||||
MonsterAiComponentPb = new MonsterAiComponentPb
|
||||
{
|
||||
AiTeamInitId = AiTeamInitId,
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using GameServer.Systems.Entity.Component;
|
||||
using Core.Config;
|
||||
using GameServer.Systems.Entity.Component;
|
||||
using Protocol;
|
||||
|
||||
namespace GameServer.Systems.Entity;
|
||||
|
@ -41,4 +42,146 @@ internal abstract class EntityBase
|
|||
public abstract EntityConfigType ConfigType { get; }
|
||||
|
||||
public abstract EntityPb Pb { get; }
|
||||
|
||||
public void InitProps(BasePropertyConfig config)
|
||||
{
|
||||
EntityAttributeComponent attributeComponent = ComponentSystem.Get<EntityAttributeComponent>();
|
||||
|
||||
attributeComponent.SetAttribute(EAttributeType.Lv, config.Lv);
|
||||
attributeComponent.SetAttribute(EAttributeType.LifeMax, config.LifeMax);
|
||||
attributeComponent.SetAttribute(EAttributeType.Life, config.Life);
|
||||
attributeComponent.SetAttribute(EAttributeType.Sheild, config.Sheild);
|
||||
attributeComponent.SetAttribute(EAttributeType.SheildDamageChange, config.SheildDamageChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.SheildDamageReduce, config.SheildDamageReduce);
|
||||
attributeComponent.SetAttribute(EAttributeType.Atk, config.Atk);
|
||||
attributeComponent.SetAttribute(EAttributeType.Crit, config.Crit);
|
||||
attributeComponent.SetAttribute(EAttributeType.CritDamage, config.CritDamage);
|
||||
attributeComponent.SetAttribute(EAttributeType.Def, config.Def);
|
||||
attributeComponent.SetAttribute(EAttributeType.EnergyEfficiency, config.EnergyEfficiency);
|
||||
attributeComponent.SetAttribute(EAttributeType.CdReduse, config.CdReduse);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionEfficiency, config.ReactionEfficiency);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeNormalSkill, config.DamageChangeNormalSkill);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChange, config.DamageChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReduce, config.DamageReduce);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeAuto, config.DamageChangeAuto);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeCast, config.DamageChangeCast);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeUltra, config.DamageChangeUltra);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeQte, config.DamageChangeQte);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangePhys, config.DamageChangePhys);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeElement1, config.DamageChangeElement1);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeElement2, config.DamageChangeElement2);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeElement3, config.DamageChangeElement3);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeElement4, config.DamageChangeElement4);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeElement5, config.DamageChangeElement5);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangeElement6, config.DamageChangeElement6);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageResistancePhys, config.DamageResistancePhys);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageResistanceElement1, config.DamageResistanceElement1);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageResistanceElement2, config.DamageResistanceElement2);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageResistanceElement3, config.DamageResistanceElement3);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageResistanceElement4, config.DamageResistanceElement4);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageResistanceElement5, config.DamageResistanceElement5);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageResistanceElement6, config.DamageResistanceElement6);
|
||||
attributeComponent.SetAttribute(EAttributeType.HealChange, config.HealChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.HealedChange, config.HealedChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReducePhys, config.DamageReducePhys);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReduceElement1, config.DamageReduceElement1);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReduceElement2, config.DamageReduceElement2);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReduceElement3, config.DamageReduceElement3);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReduceElement4, config.DamageReduceElement4);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReduceElement5, config.DamageReduceElement5);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageReduceElement6, config.DamageReduceElement6);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange1, config.ReactionChange1);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange2, config.ReactionChange2);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange3, config.ReactionChange3);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange4, config.ReactionChange4);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange5, config.ReactionChange5);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange6, config.ReactionChange6);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange7, config.ReactionChange7);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange8, config.ReactionChange8);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange9, config.ReactionChange9);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange10, config.ReactionChange10);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange11, config.ReactionChange11);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange12, config.ReactionChange12);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange13, config.ReactionChange13);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange14, config.ReactionChange14);
|
||||
attributeComponent.SetAttribute(EAttributeType.ReactionChange15, config.ReactionChange15);
|
||||
attributeComponent.SetAttribute(EAttributeType.EnergyMax, config.EnergyMax);
|
||||
attributeComponent.SetAttribute(EAttributeType.Energy, config.Energy);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy1Max, config.SpecialEnergy1Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy1, config.SpecialEnergy1);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy2Max, config.SpecialEnergy2Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy2, config.SpecialEnergy2);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy3Max, config.SpecialEnergy3Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy3, config.SpecialEnergy3);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy4Max, config.SpecialEnergy4Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialEnergy4, config.SpecialEnergy4);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthMax, config.StrengthMax);
|
||||
attributeComponent.SetAttribute(EAttributeType.Strength, config.Strength);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthRecover, config.StrengthRecover);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthPunishTime, config.StrengthPunishTime);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthRun, config.StrengthRun);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthSwim, config.StrengthSwim);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthFastSwim, config.StrengthFastSwim);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthClimb, config.StrengthClimb);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthFastClimb, config.StrengthFastClimb);
|
||||
attributeComponent.SetAttribute(EAttributeType.HardnessMax, config.HardnessMax);
|
||||
attributeComponent.SetAttribute(EAttributeType.Hardness, config.Hardness);
|
||||
attributeComponent.SetAttribute(EAttributeType.HardnessRecover, config.HardnessRecover);
|
||||
attributeComponent.SetAttribute(EAttributeType.HardnessPunishTime, config.HardnessPunishTime);
|
||||
attributeComponent.SetAttribute(EAttributeType.HardnessChange, config.HardnessChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.HardnessReduce, config.HardnessReduce);
|
||||
attributeComponent.SetAttribute(EAttributeType.RageMax, config.RageMax);
|
||||
attributeComponent.SetAttribute(EAttributeType.Rage, config.Rage);
|
||||
attributeComponent.SetAttribute(EAttributeType.RageRecover, config.RageRecover);
|
||||
attributeComponent.SetAttribute(EAttributeType.RagePunishTime, config.RagePunishTime);
|
||||
attributeComponent.SetAttribute(EAttributeType.RageChange, config.RageChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.RageReduce, config.RageReduce);
|
||||
attributeComponent.SetAttribute(EAttributeType.ToughMax, config.ToughMax);
|
||||
attributeComponent.SetAttribute(EAttributeType.Tough, config.Tough);
|
||||
attributeComponent.SetAttribute(EAttributeType.ToughRecover, config.ToughRecover);
|
||||
attributeComponent.SetAttribute(EAttributeType.ToughChange, config.ToughChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.ToughReduce, config.ToughReduce);
|
||||
attributeComponent.SetAttribute(EAttributeType.ToughRecoverDelayTime, config.ToughRecoverDelayTime);
|
||||
attributeComponent.SetAttribute(EAttributeType.ElementPower1, config.ElementPower1);
|
||||
attributeComponent.SetAttribute(EAttributeType.ElementPower2, config.ElementPower2);
|
||||
attributeComponent.SetAttribute(EAttributeType.ElementPower3, config.ElementPower3);
|
||||
attributeComponent.SetAttribute(EAttributeType.ElementPower4, config.ElementPower4);
|
||||
attributeComponent.SetAttribute(EAttributeType.ElementPower5, config.ElementPower5);
|
||||
attributeComponent.SetAttribute(EAttributeType.ElementPower6, config.ElementPower6);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpecialDamageChange, config.SpecialDamageChange);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthFastClimbCost, config.StrengthFastClimbCost);
|
||||
attributeComponent.SetAttribute(EAttributeType.ElementPropertyType, config.ElementPropertyType);
|
||||
attributeComponent.SetAttribute(EAttributeType.WeakTime, config.WeakTime);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDefRate, config.IgnoreDefRate);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDamageResistancePhys, config.IgnoreDamageResistancePhys);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDamageResistanceElement1, config.IgnoreDamageResistanceElement1);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDamageResistanceElement2, config.IgnoreDamageResistanceElement2);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDamageResistanceElement3, config.IgnoreDamageResistanceElement3);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDamageResistanceElement4, config.IgnoreDamageResistanceElement4);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDamageResistanceElement5, config.IgnoreDamageResistanceElement5);
|
||||
attributeComponent.SetAttribute(EAttributeType.IgnoreDamageResistanceElement6, config.IgnoreDamageResistanceElement6);
|
||||
attributeComponent.SetAttribute(EAttributeType.SkillToughRatio, config.SkillToughRatio);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthClimbJump, config.StrengthClimbJump);
|
||||
attributeComponent.SetAttribute(EAttributeType.StrengthGliding, config.StrengthGliding);
|
||||
attributeComponent.SetAttribute(EAttributeType.Mass, config.Mass);
|
||||
attributeComponent.SetAttribute(EAttributeType.BrakingFrictionFactor, config.BrakingFrictionFactor);
|
||||
attributeComponent.SetAttribute(EAttributeType.GravityScale, config.GravityScale);
|
||||
attributeComponent.SetAttribute(EAttributeType.SpeedRatio, config.SpeedRatio);
|
||||
attributeComponent.SetAttribute(EAttributeType.DamageChangePhantom, config.DamageChangePhantom);
|
||||
attributeComponent.SetAttribute(EAttributeType.AutoAttackSpeed, config.AutoAttackSpeed);
|
||||
attributeComponent.SetAttribute(EAttributeType.CastAttackSpeed, config.CastAttackSpeed);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp1Max, config.StatusBuildUp1Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp1, config.StatusBuildUp1);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp2Max, config.StatusBuildUp2Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp2, config.StatusBuildUp2);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp3Max, config.StatusBuildUp3Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp3, config.StatusBuildUp3);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp4Max, config.StatusBuildUp4Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp4, config.StatusBuildUp4);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp5Max, config.StatusBuildUp5Max);
|
||||
attributeComponent.SetAttribute(EAttributeType.StatusBuildUp5, config.StatusBuildUp5);
|
||||
attributeComponent.SetAttribute(EAttributeType.ParalysisTimeMax, config.ParalysisTimeMax);
|
||||
attributeComponent.SetAttribute(EAttributeType.ParalysisTime, config.ParalysisTime);
|
||||
attributeComponent.SetAttribute(EAttributeType.ParalysisTimeRecover, config.ParalysisTimeRecover);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,5 +6,7 @@ internal class EntityFactory
|
|||
public PlayerEntity CreatePlayer(int characterConfigId, int playerId)
|
||||
=> new(NextId(), characterConfigId, playerId);
|
||||
|
||||
public MonsterEntity CreateMonster(int levelEntityId) => new(NextId(), levelEntityId);
|
||||
|
||||
private long NextId() => Interlocked.Increment(ref _entityIdCounter);
|
||||
}
|
||||
|
|
64
GameServer/Systems/Entity/MonsterEntity.cs
Normal file
64
GameServer/Systems/Entity/MonsterEntity.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using GameServer.Systems.Entity.Component;
|
||||
using Protocol;
|
||||
|
||||
namespace GameServer.Systems.Entity;
|
||||
internal class MonsterEntity : EntityBase
|
||||
{
|
||||
public MonsterEntity(long id, int configId) : base(id)
|
||||
{
|
||||
ConfigId = configId;
|
||||
}
|
||||
|
||||
public int ConfigId { get; }
|
||||
|
||||
public override EEntityType Type => EEntityType.Monster;
|
||||
public override EntityConfigType ConfigType => EntityConfigType.Level;
|
||||
|
||||
public override void OnCreate()
|
||||
{
|
||||
base.OnCreate();
|
||||
|
||||
EntityAttributeComponent attributeComponent = ComponentSystem.Create<EntityAttributeComponent>();
|
||||
attributeComponent.SetAttribute(EAttributeType.LifeMax, 100);
|
||||
attributeComponent.SetAttribute(EAttributeType.Life, 100);
|
||||
|
||||
State = EntityState.Born;
|
||||
|
||||
EntityMonsterAiComponent aiComponent = ComponentSystem.Create<EntityMonsterAiComponent>();
|
||||
aiComponent.AiTeamInitId = 100;
|
||||
|
||||
EntityFsmComponent fsm = ComponentSystem.Create<EntityFsmComponent>();
|
||||
fsm.Fsms.Add(new DFsm
|
||||
{
|
||||
FsmId = 10007, // Main State Machine
|
||||
CurrentState = 10009, // Standby Entry
|
||||
Status = 1, // ??
|
||||
Flag = (int)EFsmStateFlag.Confirmed
|
||||
});
|
||||
}
|
||||
|
||||
public override EntityPb Pb
|
||||
{
|
||||
get
|
||||
{
|
||||
EntityPb pb = new()
|
||||
{
|
||||
Id = Id,
|
||||
EntityType = (int)Type,
|
||||
ConfigType = (int)ConfigType,
|
||||
EntityState = (int)State,
|
||||
ConfigId = ConfigId,
|
||||
Pos = Pos,
|
||||
Rot = Rot,
|
||||
LivingStatus = (int)LivingStatus,
|
||||
IsVisible = IsVisible,
|
||||
InitLinearVelocity = new(),
|
||||
InitPos = new()
|
||||
};
|
||||
|
||||
pb.ComponentPbs.AddRange(ComponentSystem.Pb);
|
||||
|
||||
return pb;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,8 +46,6 @@ internal class PlayerEntity : EntityBase
|
|||
|
||||
_ = ComponentSystem.Create<EntityEquipComponent>();
|
||||
_ = ComponentSystem.Create<EntityAttributeComponent>();
|
||||
|
||||
InitAttributes();
|
||||
}
|
||||
|
||||
public override void Activate()
|
||||
|
@ -55,16 +53,6 @@ internal class PlayerEntity : EntityBase
|
|||
base.Activate();
|
||||
}
|
||||
|
||||
private void InitAttributes()
|
||||
{
|
||||
EntityAttributeComponent attributeComponent = ComponentSystem.Get<EntityAttributeComponent>();
|
||||
attributeComponent.SetAttribute(EAttributeType.Life, 1000);
|
||||
attributeComponent.SetAttribute(EAttributeType.LifeMax, 1000);
|
||||
attributeComponent.SetAttribute(EAttributeType.Lv, 1);
|
||||
attributeComponent.SetAttribute(EAttributeType.AutoAttackSpeed, 10000);
|
||||
attributeComponent.SetAttribute(EAttributeType.CastAttackSpeed, 10000);
|
||||
}
|
||||
|
||||
public override EEntityType Type => EEntityType.Player;
|
||||
public override EntityConfigType ConfigType => EntityConfigType.Character;
|
||||
|
||||
|
|
Loading…
Reference in a new issue