|
|
|
|
@ -35,6 +35,18 @@ function openInteractionMenu(entity){
|
|
|
|
|
// Interact
|
|
|
|
|
|
|
|
|
|
// Attack
|
|
|
|
|
// Start Attack
|
|
|
|
|
if(entity in gameData.board && !(entity in gameData.cardStatus.tapped)){
|
|
|
|
|
|
|
|
|
|
// TODO: Make the object within each interationOption a function to return instead of duping
|
|
|
|
|
gameData.interactionOption['Attack'] = {
|
|
|
|
|
x: gameData.position[entity][0] + gameData.size[entity][0]*.1/2,
|
|
|
|
|
y: gameData.position[entity][1] + gameData.size[entity][1] - (35 * (Object.entries(gameData.interactionOption).length + 1)),
|
|
|
|
|
width: gameData.size[entity][0]*.9,
|
|
|
|
|
height: 30
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Target Attack Target
|
|
|
|
|
|
|
|
|
|
// Tap
|
|
|
|
|
// TAP (TEMP TODO: remove or add in a statement to hide)
|
|
|
|
|
@ -77,6 +89,28 @@ function openInteractionMenu(entity){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If selectable, give option to select. If selected, deselect
|
|
|
|
|
if(gameData.cardStatus.targetable[entity] !== undefined){
|
|
|
|
|
|
|
|
|
|
gameData.interactionOption['Target'] = {
|
|
|
|
|
x: gameData.position[entity][0] + gameData.size[entity][0]*.1/2,
|
|
|
|
|
y: gameData.position[entity][1] + gameData.size[entity][1] - (35 * (Object.entries(gameData.interactionOption).length + 1)),
|
|
|
|
|
width: gameData.size[entity][0]*.9,
|
|
|
|
|
height: 30
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(gameData.cardStatus.targetable[entity] !== undefined && gameData.cardStatus.targetted[entity] !== undefined){
|
|
|
|
|
|
|
|
|
|
gameData.interactionOption['Untarget'] = {
|
|
|
|
|
x: gameData.position[entity][0] + gameData.size[entity][0]*.1/2,
|
|
|
|
|
y: gameData.position[entity][1] + gameData.size[entity][1] - (35 * (Object.entries(gameData.interactionOption).length + 1)),
|
|
|
|
|
width: gameData.size[entity][0]*.9,
|
|
|
|
|
height: 30
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
drawGameBoard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -117,6 +151,19 @@ function doiMenuPressed(iMenuKey){
|
|
|
|
|
iMenuUntap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Attack
|
|
|
|
|
// Start Attack (Card that's to attack)
|
|
|
|
|
if(iMenuKey == 'Attack'){
|
|
|
|
|
iMenuStartAttack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Target
|
|
|
|
|
if(iMenuKey == 'Target'){
|
|
|
|
|
iMenuTarget();
|
|
|
|
|
}
|
|
|
|
|
if(iMenuKey == 'Untarget'){
|
|
|
|
|
iMenuUntarget();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function iMenuPlayToBoard(){
|
|
|
|
|
@ -143,4 +190,16 @@ function iMenuUntap(){
|
|
|
|
|
console.log(Object.keys(gameData.inInteractionMenu)[0]);
|
|
|
|
|
requestUntapCard(gameData.inInteractionMenu[Object.keys(gameData.inInteractionMenu)[0]]);
|
|
|
|
|
}
|
|
|
|
|
function iMenuStartAttack(){
|
|
|
|
|
requestStartAttack(Object.keys(gameData.inInteractionMenu)[0]);
|
|
|
|
|
}
|
|
|
|
|
function iMenuTarget(){
|
|
|
|
|
gameData.cardStatus.targetted[Object.keys(gameData.inInteractionMenu)[0]] = Object.keys(gameData.inInteractionMenu)[0];
|
|
|
|
|
clearInteractionMenu(); // Clears and redraws the board
|
|
|
|
|
console.log('target');
|
|
|
|
|
}
|
|
|
|
|
function iMenuUntarget(){
|
|
|
|
|
delete(gameData.cardStatus.targetted[Object.keys(gameData.inInteractionMenu)[0]]);
|
|
|
|
|
console.log('UNtarget');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|