oEtG Forum
General Category => Game Bugs => Fixed Bugs => Topic started by: timpa on December 02, 2014, 08:30:16 pm
-
Sometimes the button works, sometimes it doesn't work at all.
-
It doesn't autoconvert account bound cards, iirc
-
Well, that would make no sense at all, since I can manually convert them.
-
It doesn't consider accountbound cards, so if you have 1 accountbound & 11 non accountbound, it'll not upgrade
It's a little sloppy, but useful for doing things mostly right
-
I suggest this change to upshall
exports.upshall = function(data, user) {
var pool = etgutil.deck2pool(user.pool);
for(var code in pool){
var card = Cards.Codes[code];
if (!card || pool[code] < 12 || card.rarity == 5 || card.rarity < 1 || (card.upped && card.shiny)) continue;
var upcode = etgutil.asUpped(code, true);
if (upcode != code){
if (!(upcode in pool)) pool[upcode] = 0;
while (pool[upcode] < 6 && pool[code] >= 12){
pool[upcode]++;
pool[code] -= 6;
}
}
upcode = etgutil.asShiny(code, true);
if (upcode != code){
if (!(upcode in pool)) pool[upcode] = 0;
while (pool[code] >= 12){
pool[upcode]++;
pool[code] -= 6;
}
}
code = upcode
upcode = etgutil.asUpped(code, true);
if (upcode != code){
if (!(upcode in pool)) pool[upcode] = 0;
while (pool[code] >= 12){
pool[upcode]++;
pool[code] -= 6;
}
}
}
var newpool = "";
for(var code in pool){
if (pool[code]) newpool = etgutil.addcard(newpool, code, pool[code]);
}
user.pool = newpool;
}
since keeping the conversion only if the target has less than 6 cards ends up accumulating the cards as unshiny and unnupped (rendering the button useless). This change should accumulate any excess as shiny upped. I had to open the loop though to make this.
DISCLAIMER:
I don't really know js and this was done entirelly assuming things are similar to python and C (whatever looked closer in each line), so double check my logic. For example, I don't know if those etgutil[] are needed or if that's a way to use a namespace or something like that, or if the line 'code = upcode' works as I think it does.
serpedit Improved etgutil member referencing
-
Overhauled algorithm (https://github.com/serprex/openEtG/commit/e06df17887896e71539f33e13026ac3a946fb02c)
It'll now downgrade cards, as it's output is predetermined by the effective number of unupped copies one owns
-
I'm having trouble understanding why the second loop over pool is safe, but if you tested it and it works I'll trust you.
nevermind, spotted the 'card.upped || card.shiny'