This commit is contained in:
+1
-1
Submodule cards-json updated: 78a7282785...cc48d11ea1
+5
-9
@@ -53,9 +53,8 @@ function createEffectCondition(json, card) {
|
||||
return createdCondition;
|
||||
}
|
||||
|
||||
function createEffects(card, cardUUID) {
|
||||
if (card.effects) {
|
||||
return card.effects.map((e) => {
|
||||
function createEffects(effects, card, cardUUID) {
|
||||
return effects.map((e) => {
|
||||
const createdEffect = {
|
||||
card: cardUUID,
|
||||
effect: e.effect,
|
||||
@@ -66,7 +65,7 @@ function createEffects(card, cardUUID) {
|
||||
faction: card.faction,
|
||||
};
|
||||
if (e.sub_effects) {
|
||||
createdEffect.subEffects = createEffects(e.sub_effects, cardUUID);
|
||||
createdEffect.subEffects = createEffects(e.sub_effects, card, cardUUID);
|
||||
}
|
||||
|
||||
if (e.effect_type) {
|
||||
@@ -82,7 +81,6 @@ function createEffects(card, cardUUID) {
|
||||
return insertedId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createCard(json, pack, playerIndex) {
|
||||
const createdCard = {
|
||||
@@ -111,10 +109,8 @@ function createCard(json, pack, playerIndex) {
|
||||
const { insertedId } = db.cards.insertOne(createdCard);
|
||||
|
||||
if (json.effects) {
|
||||
db.cards.updateOne(
|
||||
{ _id: insertedId },
|
||||
{ $set: { effects: createEffects(json, insertedId) } }
|
||||
);
|
||||
const effects = createEffects(json.effects, json, insertedId);
|
||||
db.cards.updateOne({ _id: insertedId }, { $set: { effects } });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user