Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Weakness randomizer can select invalid class-locked weaknesses #658

Open
mikecheb opened this issue Apr 30, 2024 · 0 comments
Open

Comments

@mikecheb
Copy link
Contributor

mikecheb commented Apr 30, 2024

The Scarlet Keys introduced weaknesses which are only available to investigators of a specific class. The randomizer logic should be updated to prevent, for example, Pay Your Due (Rogue-only) from being selected for Agnes.

Presumably, this is where such logic would belong. Currently, the only filtering is for weaknesses in the user's collection:

ui.select_basic_weakness = function select_basic_weakness() {
// replace the random weakness card in the deck with a random weakness
var weaknesses = app.data.cards.find({"subtype_code" : "basicweakness"});
var filtered_weaknesses = [];
weaknesses.forEach(function (card){
//console.log(card);
if($("[name="+card.pack_code+"]").is(":checked") && card.code != "01000" && card.indeck < card.maxqty){
filtered_weaknesses.push(card);
}
});
if (filtered_weaknesses.length > 0){
var weakness = filtered_weaknesses[ Math.round(Math.random(0, 1) * (filtered_weaknesses.length-1)) ];
if ($(this) && $(this).data("random")){
ui.on_quantity_change($(this).data("random"), 0);
}
ui.on_quantity_change(weakness.code, weakness.indeck+1);
}
}

I might work on this if I find some time in the next week or two.

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

No branches or pull requests

1 participant