Skip to content

Remove dangling "and to" from 1st Spare the Target chat message#2120

Open
talia-storymaker wants to merge 4 commits intoSWU-Karabast:mainfrom
talia-storymaker:talia-storymaker/bounty-chat-fix
Open

Remove dangling "and to" from 1st Spare the Target chat message#2120
talia-storymaker wants to merge 4 commits intoSWU-Karabast:mainfrom
talia-storymaker:talia-storymaker/bounty-chat-fix

Conversation

@talia-storymaker
Copy link
Copy Markdown

The problem this addresses is that if someone uses Spare The Target, there is an "and to" at the end of the chat message (regardless of if the target has a Bounty or not; if it does have a Bounty, the bounty-collecting is still a separate message). This is because the code wants to put bounties in the same chat message as other actions, but bounties always have to be their own message. I assumed when making this that the latter is the desired behavior, so this simply removes the "and to" (regardless of if the target has a Bounty or not) with no other changes.

I know this may not be a very elegant fix and I'm obviously open to feedback.

Original This PR
Player 2 plays Spare The Target to return Mace Windu to Player 1's hand and to Order66 plays Spare The Target to return Blizzard Assault AT-AT to ThisIsTheWay's hand
Order66 plays Spare The Target to return Clone Deserter to ThisIsTheWay's hand and to (next message starts) Order66 collects the 'Draw a Card' Bounty on Clone Deserter to draw a card Order66 plays Spare The Target to return Clone Deserter to ThisIsTheWay's hand (next message starts) Order66 collects the 'Draw a Card' Bounty on Clone Deserter to draw a card

Comment thread server/game/gameSystems/SimultaneousSystem.ts
Comment on lines 18 to 26
const legalSystems = gameSystems.filter((system) => system.hasLegalTarget(context) && system.name !== 'collect bounty'); /* collecting a bounty always gets its own message */
const legalSystems = gameSystems.filter((system) => system.hasLegalTarget(context) && system.getEffectMessage(context)[0] !== '');
const message = ChatHelpers.formatWithLength(legalSystems.length, 'to ');
const legalSystemsMessages = legalSystems.map((system) => {
const [format, args] = system.getEffectMessage(context);
return {
format: format,
args: args
};
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty much correct! Can we just move the logic down to the legalSystemMessages below and perform the filter after the map there? That way, we've already generated the effectMessages and converted them to a proper object. So all we'd need to do is check that message.format !== ''.

Does that make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants