Add EnemySpawnType - AfterAction
This commit is contained in:
parent
86f764aca3
commit
d7aa4243d7
@ -584,6 +584,7 @@
|
|||||||
"AutoOnEnterArea",
|
"AutoOnEnterArea",
|
||||||
"AfterInteraction",
|
"AfterInteraction",
|
||||||
"AfterItemUse",
|
"AfterItemUse",
|
||||||
|
"AfterAction",
|
||||||
"OverworldEnemies"
|
"OverworldEnemies"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -9,6 +9,7 @@ public sealed class EnemySpawnTypeConverter() : EnumConverter<EEnemySpawnType>(V
|
|||||||
{
|
{
|
||||||
{ EEnemySpawnType.AfterInteraction, "AfterInteraction" },
|
{ EEnemySpawnType.AfterInteraction, "AfterInteraction" },
|
||||||
{ EEnemySpawnType.AfterItemUse, "AfterItemUse" },
|
{ EEnemySpawnType.AfterItemUse, "AfterItemUse" },
|
||||||
|
{ EEnemySpawnType.AfterAction, "AfterAction" },
|
||||||
{ EEnemySpawnType.AutoOnEnterArea, "AutoOnEnterArea" },
|
{ EEnemySpawnType.AutoOnEnterArea, "AutoOnEnterArea" },
|
||||||
{ EEnemySpawnType.OverworldEnemies, "OverworldEnemies" },
|
{ EEnemySpawnType.OverworldEnemies, "OverworldEnemies" },
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,7 @@ public enum EEnemySpawnType
|
|||||||
None = 0,
|
None = 0,
|
||||||
AfterInteraction,
|
AfterInteraction,
|
||||||
AfterItemUse,
|
AfterItemUse,
|
||||||
|
AfterAction,
|
||||||
AutoOnEnterArea,
|
AutoOnEnterArea,
|
||||||
OverworldEnemies,
|
OverworldEnemies,
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,18 @@ internal static class Action
|
|||||||
|
|
||||||
ArgumentNullException.ThrowIfNull(step.Action);
|
ArgumentNullException.ThrowIfNull(step.Action);
|
||||||
|
|
||||||
var task = new UseOnObject(step.DataId, step.Action.Value, gameFunctions,
|
var task = OnObject(step.DataId, step.Action.Value);
|
||||||
loggerFactory.CreateLogger<UseOnObject>());
|
|
||||||
if (step.Action.Value.RequiresMount())
|
if (step.Action.Value.RequiresMount())
|
||||||
return [task];
|
return [task];
|
||||||
else
|
else
|
||||||
return [mountFactory.Unmount(), task];
|
return [mountFactory.Unmount(), task];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ITask OnObject(uint? dataId, EAction action)
|
||||||
|
{
|
||||||
|
return new UseOnObject(dataId, action, gameFunctions,
|
||||||
|
loggerFactory.CreateLogger<UseOnObject>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class UseOnObject(
|
private sealed class UseOnObject(
|
||||||
|
@ -18,6 +18,7 @@ internal static class Combat
|
|||||||
Interact.Factory interactFactory,
|
Interact.Factory interactFactory,
|
||||||
Mount.Factory mountFactory,
|
Mount.Factory mountFactory,
|
||||||
UseItem.Factory useItemFactory,
|
UseItem.Factory useItemFactory,
|
||||||
|
Action.Factory actionFactory,
|
||||||
QuestFunctions questFunctions) : ITaskFactory
|
QuestFunctions questFunctions) : ITaskFactory
|
||||||
{
|
{
|
||||||
public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step)
|
public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step)
|
||||||
@ -58,6 +59,19 @@ internal static class Combat
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case EEnemySpawnType.AfterAction:
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(step.DataId);
|
||||||
|
ArgumentNullException.ThrowIfNull(step.Action);
|
||||||
|
|
||||||
|
if (!step.Action.Value.RequiresMount())
|
||||||
|
yield return mountFactory.Unmount();
|
||||||
|
yield return actionFactory.OnObject(step.DataId.Value, step.Action.Value);
|
||||||
|
yield return new WaitAtEnd.WaitDelay(TimeSpan.FromSeconds(1));
|
||||||
|
yield return CreateTask(quest, sequence, step);
|
||||||
|
break;
|
||||||
|
} ;
|
||||||
|
|
||||||
case EEnemySpawnType.AutoOnEnterArea:
|
case EEnemySpawnType.AutoOnEnterArea:
|
||||||
if (step.CombatDelaySecondsAtStart == null)
|
if (step.CombatDelaySecondsAtStart == null)
|
||||||
yield return new WaitAtEnd.WaitDelay(TimeSpan.FromSeconds(1));
|
yield return new WaitAtEnd.WaitDelay(TimeSpan.FromSeconds(1));
|
||||||
|
Loading…
Reference in New Issue
Block a user