From 4ac0bf423a40fa586aebfcad57ea1f8ebd5deb29 Mon Sep 17 00:00:00 2001
From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Date: Sat, 7 Nov 2026 17:39:27 -0800
Subject: [PATCH] ai/default: Make the city site defence bonus reward defence

result_defense_bonus() returned 100 / (total + 1) * (100 / defense_bonus
* DEFENSE_EMPHASIS): the first factor is 0 in integer arithmetic for
any site worth more than 99, and the second shrinks as the terrain
defence grows, the opposite of the comment above it. Hills and
mountains scored at or below grassland. Price it the way naval_bonus()
prices the coast: a share of the site's total that grows with the
defence bonus, DEFENSE_EMPHASIS percent of the total at +100%.

Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
---
 ai/default/daisettler.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ai/default/daisettler.c b/ai/default/daisettler.c
index 3ac6646ed4..5c3604c85f 100644
--- a/ai/default/daisettler.c
+++ b/ai/default/daisettler.c
@@ -615,7 +615,8 @@ static adv_want result_defense_bonus(struct player *pplayer,
 
   defense_bonus += (defense_bonus * extra_bonus) / 100;
 
-  return 100 / (result->total + 1) * (100 / defense_bonus * DEFENSE_EMPHASIS);
+  /* defense_bonus is 10 at no bonus, 20 at +100%. */
+  return result->total * DEFENSE_EMPHASIS * (defense_bonus - 10) / 1000.0;
 }
 
 /*************************************************************************//**
-- 
2.55.0

