23 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
25 if (dialog ==
null)
return false;
27 WeightedRandomPicker<PersonAPI> picker =
new WeightedRandomPicker<PersonAPI>();
31 for (PersonAPI person : dialog.getInteractionTarget().getMarket().getPeopleCopy()) {
32 if (person ==
null)
continue;
33 if (person.getMarket() ==
null)
continue;
34 if (person.getMarket().getCommDirectory() ==
null)
continue;
35 if (person.getMarket().getCommDirectory().getEntryForPerson(person.getId()) ==
null)
continue;
37 if (!person.getMarket().getCommDirectory().getEntryForPerson(person.getId()).isHidden()) {
48 int num = Misc.random.nextInt(2) + 2;
49 for (
int i = 0; i < num && !picker.isEmpty(); i++) {
50 PersonAPI person = picker.pickAndRemove();
51 CustomRepImpact custom =
new CustomRepImpact();
52 custom.delta = -RepRewards.TINY;
54 new RepActionEnvelope(RepActions.CUSTOM, custom,
55 null, dialog.getTextPanel(),
true,
true),