mirror of
https://github.com/JonasHinterdorfer/TextAdventure.git
synced 2025-10-26 03:41:10 +00:00
Added objective system
This commit is contained in:
parent
142e2f3f2a
commit
bd5d9d9027
@ -35,6 +35,7 @@ init_game :-
|
|||||||
retractall(emp_used_in_combat(_)),
|
retractall(emp_used_in_combat(_)),
|
||||||
retractall(drone_cooldown(_, _)),
|
retractall(drone_cooldown(_, _)),
|
||||||
retractall(health_recovery_used(_, _)),
|
retractall(health_recovery_used(_, _)),
|
||||||
|
retractall(chapter(_)),
|
||||||
|
|
||||||
% Initialize random number generator
|
% Initialize random number generator
|
||||||
randomize,
|
randomize,
|
||||||
@ -48,6 +49,7 @@ init_game :-
|
|||||||
assertz(game_state(components_explained, false)),
|
assertz(game_state(components_explained, false)),
|
||||||
assertz(game_state(konami_unlocked, false)),
|
assertz(game_state(konami_unlocked, false)),
|
||||||
assertz(drone_cooldown(none, 0)),
|
assertz(drone_cooldown(none, 0)),
|
||||||
|
assertz(chapter(0)),
|
||||||
|
|
||||||
% Initialize obstacles
|
% Initialize obstacles
|
||||||
init_obstacles.
|
init_obstacles.
|
||||||
|
|||||||
@ -11,6 +11,7 @@ craft_item(emp_generator) :-
|
|||||||
assertz(player_inventory(emp_generator)),
|
assertz(player_inventory(emp_generator)),
|
||||||
retract(game_state(emp_built, false)),
|
retract(game_state(emp_built, false)),
|
||||||
assertz(game_state(emp_built, true)),
|
assertz(game_state(emp_built, true)),
|
||||||
|
advance_chapter_if(3),
|
||||||
!.
|
!.
|
||||||
|
|
||||||
craft_item(emp_generator) :-
|
craft_item(emp_generator) :-
|
||||||
@ -22,6 +23,9 @@ craft_item(emp_generator) :-
|
|||||||
write('Du kannst nur in der HTL Leonding Werkstatt bauen.'), nl,
|
write('Du kannst nur in der HTL Leonding Werkstatt bauen.'), nl,
|
||||||
!.
|
!.
|
||||||
|
|
||||||
|
craft_item(_) :-
|
||||||
|
write('Du kannst diesen Gegenstand nicht bauen.'), nl.
|
||||||
|
|
||||||
craft_item(kampfdrohne) :-
|
craft_item(kampfdrohne) :-
|
||||||
player_location(htl_werkstatt),
|
player_location(htl_werkstatt),
|
||||||
player_inventory(drohnen_motor),
|
player_inventory(drohnen_motor),
|
||||||
@ -30,6 +34,7 @@ craft_item(kampfdrohne) :-
|
|||||||
retract(player_inventory(drohnen_motor)),
|
retract(player_inventory(drohnen_motor)),
|
||||||
retract(player_inventory(steuerungsmodul)),
|
retract(player_inventory(steuerungsmodul)),
|
||||||
assertz(player_inventory(kampfdrohne)),
|
assertz(player_inventory(kampfdrohne)),
|
||||||
|
advance_chapter_if(2),
|
||||||
!.
|
!.
|
||||||
|
|
||||||
craft_item(kampfdrohne) :-
|
craft_item(kampfdrohne) :-
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
:- dynamic(health_recovery_used/2).
|
:- dynamic(health_recovery_used/2).
|
||||||
:- dynamic(konami_sequence/1).
|
:- dynamic(konami_sequence/1).
|
||||||
:- dynamic(konami_position/1).
|
:- dynamic(konami_position/1).
|
||||||
|
:- dynamic(chapter/1).
|
||||||
|
|
||||||
% ========== GAME STATE MANAGEMENT ==========
|
% ========== GAME STATE MANAGEMENT ==========
|
||||||
check_game_state :-
|
check_game_state :-
|
||||||
@ -28,19 +29,52 @@ check_game_state :-
|
|||||||
!, fail) ;
|
!, fail) ;
|
||||||
true).
|
true).
|
||||||
|
|
||||||
|
advance_chapter :-
|
||||||
|
chapter(Current),
|
||||||
|
Next is Current + 1,
|
||||||
|
retract(chapter(Current)),
|
||||||
|
assertz(chapter(Next)).
|
||||||
|
|
||||||
|
advance_chapter_if(TargetChapter) :-
|
||||||
|
(chapter(TargetChapter) ->
|
||||||
|
advance_chapter ;
|
||||||
|
true).
|
||||||
|
|
||||||
|
% ========== OBJECTIVE DEFINITIONS ==========
|
||||||
|
objective(0, 'Schaue dir das Video des Angriffs auf deinem Laptop an').
|
||||||
|
objective(1, 'Sprich mit Wren').
|
||||||
|
objective(2, 'Sammle alle Teile der Kampfdrohne und baue die in der HTL-Werkstatt zusammen').
|
||||||
|
objective(3, 'Sammle alle Teile des EMP-Generators und baue der in der HTL-Werkstatt zusammen').
|
||||||
|
objective(4, 'Sprich mit Wren').
|
||||||
|
objective(5, 'Besiege die Krähe').
|
||||||
|
|
||||||
|
|
||||||
|
% ========== SHOW STATUS ==========
|
||||||
|
show_current_objective :-
|
||||||
|
chapter(CurrentChapter),
|
||||||
|
objective(CurrentChapter, ObjectiveText),
|
||||||
|
write('Aktuelles Ziel: '), write(ObjectiveText), nl.
|
||||||
|
|
||||||
|
show_required_components :-
|
||||||
|
chapter(CurrentChapter),
|
||||||
|
% Show drone components only if collecting drone parts (chapter 3)
|
||||||
|
(CurrentChapter =:= 2 ->
|
||||||
|
(write('Kampfdrohne Komponenten:'), nl,
|
||||||
|
(player_inventory(drohnen_motor) -> write(' Drohnen-Motor: ✓') ; write(' Drohnen-Motor: ✗')), nl,
|
||||||
|
(player_inventory(steuerungsmodul) -> write(' Steuerungsmodul: ✓') ; write(' Steuerungsmodul: ✗')), nl) ;
|
||||||
|
true),
|
||||||
|
% Show EMP components only if collecting EMP parts (chapter 5)
|
||||||
|
(CurrentChapter =:= 3 ->
|
||||||
|
(write('EMP-Generator Komponenten:'), nl,
|
||||||
|
(player_inventory(spule) -> write(' Elektro-Spule: ✓') ; write(' Elektro-Spule: ✗')), nl,
|
||||||
|
(player_inventory(batterie) -> write(' Batterie: ✓') ; write(' Batterie: ✗')), nl,
|
||||||
|
(player_inventory(kondensator) -> write(' Kondensator: ✓') ; write(' Kondensator: ✗')), nl) ;
|
||||||
|
true).
|
||||||
|
|
||||||
show_status :-
|
show_status :-
|
||||||
player_health(Health),
|
player_health(Health),
|
||||||
write('=== STATUS ==='), nl,
|
write('=== STATUS ==='), nl,
|
||||||
write('Gesundheit: '), write(Health), nl,
|
write('Gesundheit: '), write(Health), nl,
|
||||||
(player_inventory(kampfdrohne) ->
|
show_current_objective,
|
||||||
write('Kampfdrohne: ✓ Gebaut'), nl ;
|
show_required_components,
|
||||||
(write('Kampfdrohne Komponenten:'), nl,
|
|
||||||
(player_inventory(drohnen_motor) -> write(' Drohnen-Motor: ✓') ; write(' Drohnen-Motor: ✗')), nl,
|
|
||||||
(player_inventory(steuerungsmodul) -> write(' Steuerungsmodul: ✓') ; write(' Steuerungsmodul: ✗')), nl)),
|
|
||||||
(game_state(emp_built, true) ->
|
|
||||||
write('EMP-Generator: ✓ Gebaut'), nl ;
|
|
||||||
(write('EMP-Generator Komponenten:'), nl,
|
|
||||||
(player_inventory(spule) -> write(' Elektro-Spule: ✓') ; write(' Elektro-Spule: ✗')), nl,
|
|
||||||
(player_inventory(batterie) -> write(' Batterie: ✓') ; write(' Batterie: ✗')), nl,
|
|
||||||
(player_inventory(kondensator) -> write(' Kondensator: ✓') ; write(' Kondensator: ✗')), nl)),
|
|
||||||
write('=============='), nl.
|
write('=============='), nl.
|
||||||
@ -27,6 +27,7 @@ execute_item_use(laptop) :-
|
|||||||
player_location(htl_labor),
|
player_location(htl_labor),
|
||||||
write('Du hackst dich in die Schulserver ein und analysierst die Drohnen-Aufnahmen.'), nl,
|
write('Du hackst dich in die Schulserver ein und analysierst die Drohnen-Aufnahmen.'), nl,
|
||||||
write('SCHOCKIERENDE ENTDECKUNG: Die Vögel sind Überwachungsdrohnen!'), nl,
|
write('SCHOCKIERENDE ENTDECKUNG: Die Vögel sind Überwachungsdrohnen!'), nl,
|
||||||
|
advance_chapter_if(0),
|
||||||
!.
|
!.
|
||||||
|
|
||||||
execute_item_use(heilspray) :-
|
execute_item_use(heilspray) :-
|
||||||
|
|||||||
@ -37,6 +37,7 @@ handle_conversation(wren) :-
|
|||||||
assertz(game_state(wren_met, true)),
|
assertz(game_state(wren_met, true)),
|
||||||
retract(game_state(components_explained, false)),
|
retract(game_state(components_explained, false)),
|
||||||
assertz(game_state(components_explained, true)),
|
assertz(game_state(components_explained, true)),
|
||||||
|
advance_chapter_if(1),
|
||||||
!.
|
!.
|
||||||
|
|
||||||
handle_conversation(wren) :-
|
handle_conversation(wren) :-
|
||||||
@ -51,6 +52,7 @@ handle_conversation(wren) :-
|
|||||||
game_state(emp_built, true),
|
game_state(emp_built, true),
|
||||||
write('Wren: "Perfekt! Mit dem EMP-Generator kannst du ins Aviary HQ eindringen!"'), nl,
|
write('Wren: "Perfekt! Mit dem EMP-Generator kannst du ins Aviary HQ eindringen!"'), nl,
|
||||||
write('Wren: "Pass auf die Krähe auf - schwäche sie mit EMP-Granaten, sonst kontrolliert sie dich!"'), nl,
|
write('Wren: "Pass auf die Krähe auf - schwäche sie mit EMP-Granaten, sonst kontrolliert sie dich!"'), nl,
|
||||||
|
advance_chapter_if(4),
|
||||||
!.
|
!.
|
||||||
|
|
||||||
handle_conversation(wren) :-
|
handle_conversation(wren) :-
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user