omenking/swap-n-pop

A certain 5 combo not being detected properly

jon12156 opened this issue · 9 comments

image

only the three panels horizontal are clearing.

image

Note: so far as I can tell, this only happens when the 5combo to be detected is in this particular configuration:
XXX
X00
X00

and not for example:
X00
X00
XXX

i have no clue why this doesnt work, since
XXX
00X
00X
works perfectly fine.

i suppose its something to do with the how the stack is updated and combo_and_chain is called but the stack updates all blocks and then goes through combo detection which is all done in the same tick so it should find it.

the stack is updated from left to right and goes downwards so:
X -> X -> X ... down
0 -> 0 -> X ... down etc
so

What I like about this ticket we can write test code to check in the l share for four corners.

In this example I have marked one panel as 1. Consider to be X.
When the stack scans left to right top to bottom it reaches this panel.
This panel is going to check above and below.
I bet when it checks above. It thinks there is no match, so the chain_and_combo might be failing in this case.

XOO
1OO
XOO

Its likely going to be a problem with this function that does the checking

  /**
   * In order for this panel to be valid for use in a combo it must:
   *   1. have support underneath (not falling, static visible panel, or static garbage)
   *   2. be swappable or...
   *   3. already have been marked for being cleared on first frame
   *
   * */
  get comboable() {
    // 1. check for support
    if (this.under.state === FALL) {return false}
    if (this.under.empty) { return false }
    if (this.under.state === GARBAGE && this.under.garbage.state !== STATIC) { return false }
    // 2. be comboable
    if (this.state === STATIC && this.kind !== null) { return true }
    if (this.state === LAND && this.counter < assets.spritesheets.panels.animations.land.length) { return true }
    // 3 already have been marked for being cleared on first frame
    if (this.state === CLEAR && this.playfield.clearing.indexOf(this) && this.state_timer === 0) { return true }
    return false
  }

yea i tried disabling some parameters or switching when things are called first but specs havent worked, ill try more tho

  • test for L
  • test for inverted L
  • test for upside down L
  • test for upside down and inverted L

i pushed the tests to my new branch all are working except upside down l or how i called it r5

ok i think i fixed it

in comboable()

this.playfield.clearing.indexOf(this) returns an index, and the theory behind this is good and should work but we arent comparing it to anything that we expect it to be, which is -1 as in it shouldnt equal -1. that means if clearing has the panel inside it shouldnt return -1 meaning it is actually getting cleared right now.