@ -220,11 +220,17 @@ class Board{
}
}
return false ;
return false ;
}
}
flipCard ( itemKey ) {
flipCard ( itemKey , direction = null ) {
if ( cardFace [ itemKey ] == 1 ) {
// TODO: Add a third param for 'triggerEffects', for instance
// flipping up from deck to hand, or shield to hand shouldn't trigger
// MOST TIMES
if ( cardFace [ itemKey ] == 1 && ( direction == null || direction == 0 ) ) {
cardFace [ itemKey ] = 0 ;
cardFace [ itemKey ] = 0 ;
} else {
return true ;
}
if ( cardFace [ itemKey ] == 0 && ( direction == null || direction == 1 ) ) {
cardFace [ itemKey ] = 1 ;
cardFace [ itemKey ] = 1 ;
return true ;
}
}
// TODO:Activate any flip effects, etc.
// TODO:Activate any flip effects, etc.
}
}
@ -842,7 +848,14 @@ class Board{
}
}
playMana ( fromPosition , fromElement , fromPlayer ) {
playMana ( fromPosition , fromElement , fromPlayer ) {
// TODO: getItemKey may be the best way to normalise other function calls instead of searching for item key within certain other funcs. (such as addFromBoardElement)
let itemKey = this . getItemKey ( fromElement , fromPosition , fromPlayer ) ;
console . log ( itemKey ) ;
// Now add to mana zone
this . addFromBoardElement ( fromPlayer , fromPosition , fromElement , 'mana' , null , null ) ;
this . addFromBoardElement ( fromPlayer , fromPosition , fromElement , 'mana' , null , null ) ;
// Flip the card face down (for now) TODO: just add colour atop
this . flipCard ( itemKey , 0 ) ; // Face down (TODO: Change to have spec. style)
}
}
// HELPER METHODS, to simplify code-base for me in the future
// HELPER METHODS, to simplify code-base for me in the future