nathanwentworth / deck-dungeon

a randomly generated card-based dungeon crawling game
https://nathanwentworth.itch.io/deck-dungeon
SIL Open Font License 1.1
7 stars 0 forks source link

Game Balance #1

Open Icehawk78 opened 7 years ago

Icehawk78 commented 7 years ago

Some balancing is recommended, as there's currently a strategy that will appear to indefinitely win:

function pick_card() {
  if (player.turns % 6 == 0 && player.turns != 0) {
    cardAction(null, 0);
  } else if (cardContainer.childNodes.length < Object.values(cards).length) {
    // do nothing
  } else {
    var card_list = Object.values(cards).map((c, i) => {
      c.index = i;
      var disabled = cardContainer.childNodes[i].classList.contains("disabled");
      return disabled ? {type: 'disabled', health: -1, dmg: -1, index: i} : c;
    });
    var hearts = card_list.filter(c => c.type == 'heart' && c.health <= player.money);
    var weapons = card_list.filter(c => c.type == 'weapon' && c.dmg <= player.money).sort((a, b) => b.dmg - a.dmg);
    var coins = card_list.filter(c => c.type == 'coin').sort((a, b) => b.value - a.value);
    var insta_monsters = card_list.filter(c => c.type == 'monster' && c.health <= player.atk);
    var other_monsters = card_list.filter(c => c.type == 'monster' && c.health > player.atk);
    var max_dmg = Math.max.apply(null, card_list.map(c => c.dmg));
    if (hearts.length > 0 && (player.health < max_dmg * 2)) {
      cardAction(null, hearts[0].index);
    } else if (weapons.length > 0) {
      cardAction(null, weapons[0].index);
    } else if (insta_monsters.length > 0) {
      cardAction(null, insta_monsters[0].index);
    } else if (coins.length > 0) {
      cardAction(null, coins[0].index);
    } else if (other_monsters.length > 0) {
      cardAction(null, other_monsters[0].index);
    }
  }
}

var autoplay = setInterval(pick_card, 1000);

I'm currently at L2700 with over 16,000 turns from running the above.

nathanwentworth commented 7 years ago

Wow yeah, I didn't realize it was that bad. Thank you very much for this! I'll try to fix that as soon as possible.

Falnesio commented 5 years ago

image

Pretty much luck based after a certain point, how much you will get attacked with low health. Other than that it's just hit kill or miss.