$my_count = $t->keywordCount($t->myData()->Hand, 'Burning');
$his_count = $t->keywordCount($t->hisData()->Hand, 'Burning');
$res = ['Bricks', 'Gems', 'Recruits'];
$my_dmg = $his_dmg = 0;
if ($my_count <= $his_count) {
foreach ($res as $resource) {
$lowered = $t->myData()->$resource - max($t->myData()->$resource - 7, 0);
$t->myData()->$resource-= $lowered;
$my_dmg+= $lowered;
}
}
if ($my_count >= $his_count) {
foreach ($res as $resource) {
$lowered = $t->hisData()->$resource - max($t->hisData()->$resource - 7, 0);
$t->hisData()->$resource-= $lowered;
$his_dmg+= $lowered;
}
}
if ($my_dmg > 0) {
$t->myData()->attack($my_dmg);
}
if ($his_dmg > 0) {
$t->hisData()->attack($his_dmg);
}