From 48ecbd4cbf6b58a7a75dbf269e81a7e5e4f835ee Mon Sep 17 00:00:00 2001 From: Xilmi Date: Mon, 15 Jul 2024 17:28:10 +0200 Subject: [PATCH] Threat in DangerHitMap Added new value threat to DangerHitMapAnalayzer. The purpose is to allow decisions to be less binary around enemy heros. --- AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp | 1 + AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp index 6d11d01ba..2f9662a62 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp @@ -96,6 +96,7 @@ void DangerHitMapAnalyzer::updateHitMap() newThreat.hero = path.targetHero; newThreat.turn = path.turn(); + newThreat.threat = path.getHeroStrength() * (1 - path.movementCost() / 2.0); newThreat.danger = path.getHeroStrength(); if(newThreat.value() > node.maximumDanger.value()) diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h index fc2890846..2bd39a2d8 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h @@ -22,6 +22,7 @@ struct HitMapInfo uint64_t danger; uint8_t turn; + float threat; HeroPtr hero; HitMapInfo() @@ -33,6 +34,7 @@ struct HitMapInfo { danger = 0; turn = 255; + threat = 0; hero = HeroPtr(); }