View Issue Details

IDProjectCategoryView StatusLast Update
0002727EresseaKampfpublic2025-01-18 11:48
ReporterSolthar Assigned ToEnno  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.26 
Target Version27.2Fixed in Version27.1 
Summary0002727: Katzen können verbotene Plattenpanzer benutzen
Description

"Katzen benutzen keine Plattenpanzer."

Tun sie aber doch. Nicht getestet im Spiel, aber mit Test.

Steps To Reproduce
function test_catmail()
  eressea.settings.set("rules.food.flags", "4") -- 4: food is free

  local f1 = faction.create("cat", "cat@example.com", "de")
  local f2 = faction.create("human", "a@example.com", "de")
  local diff = {}
  for i, mode in ipairs({ 'control', 'chainmail', 'plate' }) do
    local r = region.create(i, 0, "plain")

    local def = unit.create(f1, r, 10000)
    local foe = unit.create(f2, r, 1000)

    def:set_skill("stamina", 20)
    def:add_item(mode, def.number)

    foe:set_skill("bow", 99)
    foe:add_item("greatbow", foe.number) -- 2d6+4
    foe:add_item("plate", foe.number)
    foe:add_item("shield", foe.number)

    for u in r.units do
      u.hp = u.hp_max * u.number
      u:add_order("KÄMPFE")
      foe:add_order("ATTACKIERE " .. itoa36(u.id))
    end

    local base = def.hp

    process_orders()

    local regen = def.hp_max * def.number * .05
    diff[mode] = base - def.hp + regen
  end
  assert_true(diff.control > diff.chainmail, "chain should work for cats")
  assert_true(diff.plate > diff.chainmail, "plate should not work for cats")
end
TagsNo tags attached.
Faction1wpy
GameE2
Report1207

Activities

Enno

Enno

2022-03-02 21:14

administrator   ~0009515

Solche statistischen Tests implementiere ich nicht, die machen nur alles langsam. Das sollte sich als unittest implementieren lassen, wenn es wirklich kaputt ist. Eventuell mit ein wenig Umbau in battle.c verbunden.

Enno

Enno

2022-03-02 21:20

administrator   ~0009516

In E3 steht in armor.xml: <item weight="400" score="150" deny="goblin">

Das "deny" Attribut scheint das zu kontrollieren, das sagt mir auch der Code. In E2 hat der Plattenpanzer seine eigene Datei, plate.xml, und dort steht nichts von Katzen.

Enno

Enno

2022-03-02 21:22

administrator   ~0009517

Ein unit-test scheitert leider daran, dass der Fehler in einer Konfigurationsdatei ist, und man von Lua keinen guten Test-Harness für rc_can_use oder make_fighter konstruieren kann.

Ich repariere den Bug also erstmal ohne einen Test.

Enno

Enno

2022-03-02 21:37

administrator   ~0009518

Gefixt, Test liefere ich irgendwann nach, wenn mir dazu etwas einfällt.

Issue History

Date Modified Username Field Change
2021-02-21 18:59 Solthar New Issue
2022-03-02 08:56 Enno Assigned To => Enno
2022-03-02 08:56 Enno Status new => assigned
2022-03-02 08:57 Enno Target Version => 27.2
2022-03-02 21:14 Enno Note Added: 0009515
2022-03-02 21:20 Enno Note Added: 0009516
2022-03-02 21:22 Enno Note Added: 0009517
2022-03-02 21:37 Enno Status assigned => resolved
2022-03-02 21:37 Enno Resolution open => fixed
2022-03-02 21:37 Enno Fixed in Version => 27.2
2022-03-02 21:37 Enno Note Added: 0009518
2022-03-06 14:01 Enno Fixed in Version 27.2 => 27.1
2023-05-28 12:25 Enno Category ATTACKIERE => Kampf
2025-01-18 11:48 Xolgrim Status resolved => closed