-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added backward, party ability, and modified perfect score threshold a…
…nd error threshold for commands
- Loading branch information
Showing
8 changed files
with
219 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
PataNext.Simulation.Mixed.Abilities/Abilities/BackwardCommand/DefaultBackward.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"modifiers": | ||
{ | ||
"active": { | ||
"movement_speed": 0.5, | ||
"defense": 1.1 | ||
}, | ||
"perfect": { | ||
"movement_speed": 1.2, | ||
"defense": 1.1 | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
PataNext.Simulation.Mixed.Abilities/Defaults/DefaultBackwardAbility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using Collections.Pooled; | ||
using GameHost.Core.Ecs; | ||
using GameHost.Simulation.Features.ShareWorldState.BaseSystems; | ||
using GameHost.Simulation.TabEcs; | ||
using GameHost.Simulation.TabEcs.HLAPI; | ||
using GameHost.Simulation.TabEcs.Interfaces; | ||
using GameHost.Simulation.Utility.EntityQuery; | ||
using PataNext.Module.Simulation.BaseSystems; | ||
using PataNext.Module.Simulation.Components.GamePlay.Abilities; | ||
using PataNext.Simulation.Mixed.Abilities.Subset; | ||
using PataNext.Simulation.mixed.Components.GamePlay.RhythmEngine.DefaultCommands; | ||
|
||
namespace PataNext.Simulation.Mixed.Abilities.Defaults | ||
{ | ||
/// <summary> | ||
/// The default backward ability | ||
/// </summary> | ||
/// <remarks> | ||
/// If you wish to modify the AccelerationFactor, do it so in the attached <see cref="DefaultBackwardAbility"/> component | ||
/// </remarks> | ||
public struct DefaultBackwardAbility : IComponentData | ||
{ | ||
public class Register : RegisterGameHostComponentData<DefaultBackwardAbility> | ||
{} | ||
} | ||
|
||
public class DefaultBackwardAbilityProvider : BaseRhythmAbilityProvider<DefaultBackwardAbility> | ||
{ | ||
public override string MasterServerId => "backward"; | ||
|
||
public DefaultBackwardAbilityProvider(WorldCollection collection) : base(collection) | ||
{ | ||
} | ||
|
||
public override void GetComponents(PooledList<ComponentType> entityComponents) | ||
{ | ||
base.GetComponents(entityComponents); | ||
entityComponents.Add(GameWorld.AsComponentType<DefaultSubsetMarch>()); | ||
} | ||
|
||
public override void SetEntityData(GameEntity entity, CreateAbility data) | ||
{ | ||
base.SetEntityData(entity, data); | ||
|
||
GameWorld.GetComponentData<DefaultSubsetMarch>(entity) = new DefaultSubsetMarch | ||
{ | ||
AccelerationFactor = -1, | ||
Target = DefaultSubsetMarch.ETarget.All | ||
}; | ||
} | ||
|
||
public override ComponentType GetChainingCommand() | ||
{ | ||
return GameWorld.AsComponentType<BackwardCommand>(); | ||
} | ||
} | ||
|
||
public class DefaultBackwardAbilitySystem : BaseAbilitySystem | ||
{ | ||
public DefaultBackwardAbilitySystem(WorldCollection collection) : base(collection) | ||
{ | ||
} | ||
|
||
private EntityQuery abilityQuery; | ||
|
||
public override void OnAbilityUpdate() | ||
{ | ||
var abilityAccessor = new ComponentDataAccessor<AbilityState>(GameWorld); | ||
var subsetAccessor = new ComponentDataAccessor<DefaultSubsetMarch>(GameWorld); | ||
foreach (var entity in (abilityQuery ??= CreateEntityQuery(new[] | ||
{ | ||
typeof(DefaultBackwardAbility), | ||
typeof(DefaultSubsetMarch), | ||
typeof(AbilityState) | ||
})).GetEntities()) | ||
{ | ||
subsetAccessor[entity].IsActive = abilityAccessor[entity].IsActive; | ||
} | ||
} | ||
} | ||
} |
113 changes: 113 additions & 0 deletions
113
PataNext.Simulation.Mixed.Abilities/Defaults/DefaultPartyAbility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using System; | ||
using GameHost.Core.Ecs; | ||
using GameHost.Simulation.TabEcs; | ||
using GameHost.Simulation.TabEcs.Interfaces; | ||
using GameHost.Simulation.Utility.EntityQuery; | ||
using GameHost.Worlds.Components; | ||
using PataNext.Module.Simulation.BaseSystems; | ||
using PataNext.Module.Simulation.Components.GamePlay.Abilities; | ||
using PataNext.Simulation.mixed.Components.GamePlay.RhythmEngine; | ||
using PataNext.Simulation.mixed.Components.GamePlay.RhythmEngine.DefaultCommands; | ||
using StormiumTeam.GameBase.Roles.Components; | ||
|
||
namespace PataNext.Simulation.Mixed.Abilities.Defaults | ||
{ | ||
public struct DefaultPartyAbility : IComponentData | ||
{ | ||
public TimeSpan TickProgression; | ||
public TimeSpan TickPerSecond; | ||
public bool WasActive; | ||
|
||
public int EnergyPerTick; | ||
public int EnergyOnActivation; | ||
} | ||
|
||
public class DefaultPartyAbilityProvider : BaseRhythmAbilityProvider<DefaultPartyAbility> | ||
{ | ||
public DefaultPartyAbilityProvider(WorldCollection collection) : base(collection) | ||
{ | ||
} | ||
|
||
public override string MasterServerId => "party"; | ||
public override ComponentType GetChainingCommand() | ||
{ | ||
return GameWorld.AsComponentType<PartyCommand>(); | ||
} | ||
|
||
public override void SetEntityData(GameEntity entity, CreateAbility data) | ||
{ | ||
base.SetEntityData(entity, data); | ||
|
||
GameWorld.GetComponentData<DefaultPartyAbility>(entity) = new DefaultPartyAbility | ||
{ | ||
TickPerSecond = TimeSpan.FromSeconds(0.1), | ||
EnergyPerTick = 1, | ||
EnergyOnActivation = 30 | ||
}; | ||
} | ||
} | ||
|
||
public class DefaultPartyAbilitySystem : BaseAbilitySystem | ||
{ | ||
private IManagedWorldTime worldTime; | ||
|
||
public DefaultPartyAbilitySystem(WorldCollection collection) : base(collection) | ||
{ | ||
DependencyResolver.Add(() => ref worldTime); | ||
} | ||
|
||
private EntityQuery abilityQuery; | ||
public override void OnAbilityUpdate() | ||
{ | ||
var dt = worldTime.Delta; | ||
|
||
var abilityAccessor = GetAccessor<DefaultPartyAbility>(); | ||
var stateAccessor = GetAccessor<AbilityState>(); | ||
var engineSetAccessor = GetAccessor<AbilityEngineSet>(); | ||
var ownerAccessor = GetAccessor<Owner>(); | ||
foreach (var entity in (abilityQuery ??= CreateEntityQuery(new[] | ||
{ | ||
AsComponentType<DefaultPartyAbility>(), | ||
AsComponentType<AbilityState>(), | ||
AsComponentType<AbilityEngineSet>(), | ||
AsComponentType<Owner>() | ||
})).GetEntities()) | ||
{ | ||
ref var ability = ref abilityAccessor[entity]; | ||
|
||
ref readonly var state = ref stateAccessor[entity]; | ||
if (!state.IsActive) | ||
{ | ||
ability.TickProgression = default; | ||
ability.WasActive = false; | ||
return; | ||
} | ||
|
||
var isActivationFrame = false; | ||
if (!ability.WasActive) | ||
isActivationFrame = ability.WasActive = true; | ||
|
||
ref readonly var engineSet = ref engineSetAccessor[entity]; | ||
if (engineSet.ComboSettings.CanEnterFever(engineSet.ComboState)) | ||
{ | ||
ability.TickProgression += dt; | ||
if (ability.TickProgression > TimeSpan.Zero) | ||
{ | ||
var energy = (int) (ability.TickProgression / ability.TickPerSecond); | ||
if (energy > 0) | ||
{ | ||
ability.TickProgression = default; | ||
|
||
GetComponentData<RhythmSummonEnergy>(engineSet.Engine).Value += energy * ability.EnergyPerTick; | ||
} | ||
} | ||
|
||
if (isActivationFrame) | ||
GetComponentData<RhythmSummonEnergy>(engineSet.Engine).Value += ability.EnergyOnActivation; | ||
} | ||
else | ||
ability.TickProgression = default; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters