mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 13:17:45 +00:00
start of ai based on kjLotus's code on dsp
This commit is contained in:
parent
c70cf022b7
commit
04890660c0
9 changed files with 191 additions and 1 deletions
|
@ -85,6 +85,13 @@
|
||||||
<Compile Include="actors\area\PrivateAreaContent.cs" />
|
<Compile Include="actors\area\PrivateAreaContent.cs" />
|
||||||
<Compile Include="actors\area\SpawnLocation.cs" />
|
<Compile Include="actors\area\SpawnLocation.cs" />
|
||||||
<Compile Include="actors\area\Zone.cs" />
|
<Compile Include="actors\area\Zone.cs" />
|
||||||
|
<Compile Include="actors\chara\ai\AIContainer.cs" />
|
||||||
|
<Compile Include="actors\chara\ai\controllers\Controller.cs" />
|
||||||
|
<Compile Include="actors\chara\ai\controllers\MobController.cs" />
|
||||||
|
<Compile Include="actors\chara\ai\controllers\PlayerController.cs" />
|
||||||
|
<Compile Include="actors\chara\ai\state\AttackState.cs" />
|
||||||
|
<Compile Include="actors\chara\ai\state\State.cs" />
|
||||||
|
<Compile Include="actors\chara\ai\utils\AttackUtils.cs" />
|
||||||
<Compile Include="actors\chara\npc\ActorClass.cs" />
|
<Compile Include="actors\chara\npc\ActorClass.cs" />
|
||||||
<Compile Include="actors\chara\npc\NpcWork.cs" />
|
<Compile Include="actors\chara\npc\NpcWork.cs" />
|
||||||
<Compile Include="actors\chara\AetheryteWork.cs" />
|
<Compile Include="actors\chara\AetheryteWork.cs" />
|
||||||
|
@ -340,7 +347,6 @@
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="actors\chara\ai\" />
|
|
||||||
<Folder Include="navmesh\" />
|
<Folder Include="navmesh\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|
|
@ -5,6 +5,7 @@ using FFXIVClassic_Map_Server.actors.group;
|
||||||
using FFXIVClassic_Map_Server.Actors.Chara;
|
using FFXIVClassic_Map_Server.Actors.Chara;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using FFXIVClassic_Map_Server.utils;
|
using FFXIVClassic_Map_Server.utils;
|
||||||
|
using FFXIVClassic_Map_Server.actors.chara.ai;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
@ -62,6 +63,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
|
||||||
public DateTime lastAiUpdate;
|
public DateTime lastAiUpdate;
|
||||||
|
|
||||||
|
public AIContainer aiContainer;
|
||||||
|
|
||||||
public Character(uint actorID) : base(actorID)
|
public Character(uint actorID) : base(actorID)
|
||||||
{
|
{
|
||||||
//Init timer array to "notimer"
|
//Init timer array to "notimer"
|
||||||
|
|
32
FFXIVClassic Map Server/actors/chara/ai/AIContainer.cs
Normal file
32
FFXIVClassic Map Server/actors/chara/ai/AIContainer.cs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
|
using FFXIVClassic_Map_Server.actors.chara.ai.state;
|
||||||
|
using FFXIVClassic_Map_Server.actors.chara.ai.controllers;
|
||||||
|
|
||||||
|
// port of ai code in dsp by kjLotus
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||||
|
{
|
||||||
|
// todo: actually implement stuff
|
||||||
|
class AIContainer
|
||||||
|
{
|
||||||
|
private Character owner;
|
||||||
|
private Controller controller;
|
||||||
|
private List<State> states;
|
||||||
|
private DateTime latestUpdate;
|
||||||
|
private DateTime prevUpdate;
|
||||||
|
|
||||||
|
public AIContainer(Actors.Character actor)
|
||||||
|
{
|
||||||
|
this.owner = actor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeController(Controller controller)
|
||||||
|
{
|
||||||
|
this.controller = controller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||||
|
{
|
||||||
|
class Controller
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||||
|
{
|
||||||
|
class MobController : Controller
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||||
|
{
|
||||||
|
class PlayerController : Controller
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
43
FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs
Normal file
43
FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
||||||
|
{
|
||||||
|
class AttackState : State
|
||||||
|
{
|
||||||
|
public AttackState(Character owner, Character target) :
|
||||||
|
base(owner, target)
|
||||||
|
{
|
||||||
|
this.startTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnStart()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(ref DateTime time)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnInterrupt()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnComplete()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void TryInterrupt()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
FFXIVClassic Map Server/actors/chara/ai/state/State.cs
Normal file
48
FFXIVClassic Map Server/actors/chara/ai/state/State.cs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
|
using FFXIVClassic.Common;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
||||||
|
{
|
||||||
|
class State
|
||||||
|
{
|
||||||
|
protected Character owner;
|
||||||
|
protected Character target;
|
||||||
|
|
||||||
|
protected bool canInterrupt;
|
||||||
|
protected bool interrupt;
|
||||||
|
|
||||||
|
protected DateTime startTime;
|
||||||
|
|
||||||
|
protected BasePacket errorPacket;
|
||||||
|
|
||||||
|
public State(Character owner, Character target)
|
||||||
|
{
|
||||||
|
this.owner = owner;
|
||||||
|
this.target = target;
|
||||||
|
this.canInterrupt = true;
|
||||||
|
this.interrupt = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Update(ref DateTime time) { }
|
||||||
|
public virtual void OnStart() { }
|
||||||
|
public virtual void OnInterrupt() { }
|
||||||
|
public virtual void OnComplete() { }
|
||||||
|
|
||||||
|
public virtual void TryInterrupt() { }
|
||||||
|
|
||||||
|
public bool CanInterrupt()
|
||||||
|
{
|
||||||
|
return canInterrupt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetInterrupted(bool interrupt)
|
||||||
|
{
|
||||||
|
this.interrupt = interrupt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
FFXIVClassic Map Server/actors/chara/ai/utils/AttackUtils.cs
Normal file
22
FFXIVClassic Map Server/actors/chara/ai/utils/AttackUtils.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
|
||||||
|
{
|
||||||
|
static class AttackUtils
|
||||||
|
{
|
||||||
|
public static int CalculateDamage(ref Character attacker, ref Character defender)
|
||||||
|
{
|
||||||
|
int dmg = CalculateBaseDamage(ref attacker, ref defender);
|
||||||
|
|
||||||
|
return dmg;
|
||||||
|
}
|
||||||
|
public static int CalculateBaseDamage(ref Character attacker, ref Character defender)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue