23 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
24 if (dialog ==
null)
return false;
25 if (!(dialog.getInteractionTarget() instanceof CampaignFleetAPI))
return false;
28 CampaignFleetAPI other = (CampaignFleetAPI) dialog.getInteractionTarget();
30 MemoryAPI memory = memoryMap.get(MemKeys.LOCAL);
34 TextPanelAPI text = dialog.getTextPanel();
35 Color red = Misc.getNegativeHighlightColor();
37 for (CargoStackAPI stack : result.getIllegalFound().getStacksCopy()) {
38 playerFleet.getCargo().removeItems(stack.getType(), stack.getData(), stack.getSize());
39 if (stack.isCommodityStack()) {
42 text.setFontSmallInsignia();
43 text.addParagraph(
"Lost " + (
int) stack.getSize() + Strings.X +
" " + stack.getDisplayName(), red);
44 text.highlightLastInLastPara(
"" + (
int) stack.getSize() + Strings.X, Misc.getHighlightColor());
46 text.setFontInsignia();
49 for (FleetMemberAPI member : result.shipsToDamage) {
50 float crLost = Math.min(member.getRepairTracker().getBaseCR(), member.getDeployCost() * 0.5f);
51 crLost += 0.01f * (float)Misc.random.nextInt(10);
53 member.getRepairTracker().applyCREvent(-crLost,
"Vindictive cargo inspection");