ModernUO/Projects/UOContent/Mobiles/AI/BehaviorTreeAI.cs
Kamron Batman bb2999d3ab
WIP-broken
2021-10-16 19:22:19 -07:00

59 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// using Server.Mobiles.BT;
using Server.Targeting;
using Server.Mobiles.BehaviorAI;
using Server.Spells.Third;
namespace Server.Mobiles.AI
{
public class BehaviorTreeAI : BaseAI
{
private Blackboard blackboard;
private readonly BehaviorTree behaviorTree;
private readonly BehaviorTreeContext behaviorTreeContext;
public BehaviorTreeAI(BaseCreature m) : base(m)
{
// blackboard = new Blackboard();
blackboard = new Blackboard();
behaviorTreeContext = new BehaviorTreeContext(m, blackboard);
behaviorTree = new BehaviorTree();
behaviorTree.TryAddRoot(
new Selector(behaviorTree)
.AddChild(new MageCombat(behaviorTree))
.AddChild(new MagePassive(behaviorTree))
/*
new Sequence(behaviorTree)
.AddChild(new Condition(behaviorTree, (context) => context.Mobile.RawStr - context.Mobile.Str == 0))
.AddChild(new CastSpell(behaviorTree, (context) => new BlessSpell(context.Mobile)))
.AddChild(new WaitForTarget(behaviorTree))
.AddChild(new DynamicTarget(behaviorTree, (context) => context.Mobile))
*/
);
behaviorTree.Start(behaviorTreeContext);
}
public override bool Think()
{
if (m_Mobile.Deleted)
{
return false;
}
// MageBehaviorTree.Instance.RunBehavior(m_Mobile, blackboard);
behaviorTree.Tick(behaviorTreeContext);
return true;
}
public override bool DoActionWander()
{
return true;
}
}
}