14
15:- include(prologmud(mud_header)). 16
18:-swi_module(mobPrey,[]). 19
20:- include(prologmud(mud_header)). 23
24ttAgentType(mobPrey).
25resultIsa(aPreyFn(ftInt),mobPrey).
26
30
31world_agent_plan(_World,Self,Act):-
32 isa(Self,mobPrey),
33 prey_idea(Self,Act).
34
36prey_idea(Self,actMove(Dir)) :-
37 mudGetPrecepts(Self,List),
38 list_agents(Agents),
39 obj_memb(NearAgnt,Agents),
40 list_object_dir_sensed(_,List,NearAgnt,OppDir),
41 reverse_dir(OppDir,Dir),
42 number_to_dir(Num,Dir,vHere),
43 nth1(Num,List,What),
44 What == [].
45prey_idea(Self,actTake(tNut)) :-
46 mudNearBody(Self,What),
47 member(tNut,What).
48prey_idea(Self,actEat(tNut)) :-
49 mudEnergy(Self,Charge),
50 Charge < 120,
51 mudPossess(Self,tNut).
52prey_idea(Self,actMove(Dir)) :-
53 mudGetPrecepts(Self,List),
54 list_object_dir_sensed(_,List,tNut,Dir).
55prey_idea(_Agent,_) :-
56 actSpawnPrey.
57
58prey_idea(Agent,Act) :- move_or_sit_memory_idea(Agent,Act,[tNut]).
59
60
61
64
65vtActionTemplate(actSpawn(tCol)).
66
67baseKB:agent_command(_Agent,actSpawn(mobPrey)):-actSpawnPrey.
68
69actSpawnPrey :-
70 71 spawn_prey(1),
72 !,
73 fail.
74
80spawn_prey(10) :-
81 !.
82spawn_prey(N) :-
83 Prey = aPreyFn(N),
84 assert_isa(Prey,mobPrey),
85 put_in_world(Prey),!.
86
87 103
104spawn_prey(N) :-
105 Ntemp is N + 1,
106 spawn_prey(Ntemp).
107
108
109:- include(prologmud(mud_footer)).