feat: NPC reactions gated by conditions, applying effects
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -155,6 +155,8 @@ public class ReferenceResolver {
|
||||
.consumes(consumes)
|
||||
.gives(gives)
|
||||
.response(r.response())
|
||||
.requires(ConditionDto.toModelList(r.requires()))
|
||||
.effects(EffectDto.toModelList(r.effects()))
|
||||
.build();
|
||||
npc.putReaction(r.onReceive(), reaction);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thb.jeanluc.adventure.loader.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* YAML representation of a single NPC reaction.
|
||||
*
|
||||
@@ -7,11 +9,19 @@ package thb.jeanluc.adventure.loader.dto;
|
||||
* @param response text the NPC says after the exchange
|
||||
* @param gives id of the item handed back; nullable
|
||||
* @param consumes id of the item taken from the player; nullable
|
||||
* @param requires conditions that must hold; nullable
|
||||
* @param effects effects applied after a successful exchange; nullable
|
||||
*/
|
||||
public record ReactionDto(
|
||||
String onReceive,
|
||||
String response,
|
||||
String gives,
|
||||
String consumes
|
||||
String consumes,
|
||||
List<ConditionDto> requires,
|
||||
List<EffectDto> effects
|
||||
) {
|
||||
/** Backward-compatible constructor without requires/effects. */
|
||||
public ReactionDto(String onReceive, String response, String gives, String consumes) {
|
||||
this(onReceive, response, gives, consumes, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user