import { updateGold } from "./functions.js";
export const handleKeyPress = (term, state) => {
return (name, matches, data) => {
let k = String.fromCharCode(data.code);
switch (k) {
case 'g':
state.gold++;
break;
case 'G':
state.gold++;
break;
case '1':
state.gold=state.gold-state.producers[0].cost;
state.producers[0].cost=state.producers[0].cost*state.producers[0].growthRate;
state.producers[0].count++
break;
case '2':
state.gold=state.gold-state.producers[1].cost;
state.producers[1].cost=state.producers[1].cost*state.producers[1].growthRate;
state.producers[1].count++
break;
case '3':
state.gold=state.gold-state.producers[2].cost;
state.producers[2].cost=state.producers[2].cost*state.producers[2].growthRate;
state.producers[2].count++
break;
default:
break;
}
// if (k =='g' || k == 'G') {
// }
updateGold(term,state);
}
}