Skip to content

Commit

Permalink
Fixed RestrictionType.MY_SVT_OR_SUPPORT description
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Sep 21, 2023
1 parent 05af79b commit c701158
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 3 additions & 2 deletions packages/db/src/Descriptor/RestrictionDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import EntityReferenceDescriptor from "./EntityReferenceDescriptor";
import EventAllOutDescription from "./EventAllOutDescription";
import { MergeElementsOr, MultipleTraits } from "./MultipleDescriptors";
import ServantDescriptorId from "./ServantDescriptorId";
import TraitDescription from "./TraitDescription";

const RestrictionDescription = ({ region, restriction }: { region: Region; restriction: Restriction.Restriction }) => {
const { targetVals, targetVals2 } = restriction,
Expand Down Expand Up @@ -119,9 +120,9 @@ const RestrictionDescription = ({ region, restriction }: { region: Region; restr
case Restriction.RestrictionType.MY_SVT_OR_SUPPORT:
return (
<>
One of player's own or Support{" "}
One of player's own or Support with trait(s){" "}
{mergeElements(
targetVals.map((svtId) => <EntityReferenceDescriptor region={region} svtId={svtId} />),
targetVals.map((svtId) => <TraitDescription region={region} trait={svtId} />),
", "
)}{" "}
must be used at position {targetVals2[0]}
Expand Down
12 changes: 5 additions & 7 deletions packages/db/src/Descriptor/TraitDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ class TraitDescription extends React.Component<IProps, IState> {
.includes(this.state.id);

if (potentiallyServantId && !alreadyDescribedInOverride) {
const servantList = await Api.servantList();
for (const servant of servantList) {
if (servant.id === this.state.id) {
this.setState({ trait: { id: servant.id, name: servant.name } });
return;
}
}
try {
const entity = await Api.entityBasic(this.state.id);
this.setState({ trait: { id: entity.id, name: entity.name } });
return;
} catch {}
}

if (this.state.trait) return;
Expand Down

0 comments on commit c701158

Please sign in to comment.