feat: trigger fighter behavior from lobby action button
This commit is contained in:
@@ -33,6 +33,49 @@ namespace XWorld.Framework.ActorBehavior
|
||||
_actors[actor.ActorId] = actor;
|
||||
}
|
||||
|
||||
public bool RemoveActor(int actorId)
|
||||
{
|
||||
bool removed = _actors.Remove(actorId);
|
||||
if (_activeBehaviors.TryGetValue(actorId, out ActiveBehavior active))
|
||||
{
|
||||
_activeBehaviors.Remove(actorId);
|
||||
_events.Add(new BehaviorEvent
|
||||
{
|
||||
Kind = BehaviorEventKind.BehaviorStopped,
|
||||
ActorId = actorId,
|
||||
BehaviorId = active.Spec.Id,
|
||||
StopReason = BehaviorStopReason.ForcedSwitch
|
||||
});
|
||||
removed = true;
|
||||
}
|
||||
|
||||
if (_buffs.Remove(actorId))
|
||||
{
|
||||
removed = true;
|
||||
}
|
||||
var buffTargets = new List<int>(_buffs.Keys);
|
||||
for (int i = 0; i < buffTargets.Count; i++)
|
||||
{
|
||||
List<ActiveBuff> activeBuffs = _buffs[buffTargets[i]];
|
||||
int before = activeBuffs.Count;
|
||||
activeBuffs.RemoveAll(b => b.SourceActorId == actorId || b.TargetActorId == actorId);
|
||||
if (activeBuffs.Count != before)
|
||||
{
|
||||
removed = true;
|
||||
}
|
||||
if (activeBuffs.Count == 0)
|
||||
{
|
||||
_buffs.Remove(buffTargets[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (_projectiles.RemoveAll(p => p.SourceActorId == actorId || p.TargetActorId == actorId) > 0)
|
||||
{
|
||||
removed = true;
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
public bool SwitchActorCatalog(int actorId, string catalogType)
|
||||
{
|
||||
if (!_actors.TryGetValue(actorId, out BehaviorActorState actor)) return false;
|
||||
|
||||
Reference in New Issue
Block a user