From b91272c9531fa0a7f0c8a05ed59b943b2b5f0066 Mon Sep 17 00:00:00 2001 From: Alexander Puck Neuwirth Date: Fri, 15 Mar 2024 08:51:27 +0100 Subject: [PATCH] Allow enfeeble and protect on structures Closes: #68 --- sim.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sim.cpp b/sim.cpp index 5d550e70..ce795f8c 100644 --- a/sim.cpp +++ b/sim.cpp @@ -2290,12 +2290,25 @@ inline void perform_skill(Field* fd, CardStatus* src, CardStatus { dst->ext_hp(s.x); } + + template<> +inline void perform_skill(Field* fd, CardStatus* src, CardStatus* dst, const SkillSpec& s) +{ + _DEBUG_ASSERT(dst->m_card->m_type != CardType::assault); //only assaults + _DEBUG_ASSERT(dst->m_card->m_type != CardType::commander); //only assaults + // structure should not have enfeebled normally..., but let's allow it + unsigned siege_dmg = remove_absorption(fd,dst,s.x + dst->m_enfeebled); + // structure should not have protect normally..., but let's alow it too + siege_dmg = safe_minus(siege_dmg, src->m_overloaded ? 0 : dst->protected_value()); + remove_hp(fd, dst, siege_dmg); +} + template<> inline void perform_skill(Field* fd, CardStatus* src, CardStatus* dst, const SkillSpec& s) { if (dst->m_card->m_type == CardType::structure) { - remove_hp(fd, dst, remove_absorption(fd,dst,s.x)); + perform_skill(fd, src, dst, s); } else { @@ -2356,12 +2369,6 @@ inline void perform_skill(Field* fd, CardStatus* src, CardStatus* d } } - template<> -inline void perform_skill(Field* fd, CardStatus* src, CardStatus* dst, const SkillSpec& s) -{ - remove_hp(fd, dst, remove_absorption(fd,dst,s.x)); -} - template<> inline void perform_skill(Field* fd, CardStatus* src, CardStatus* dst, const SkillSpec& s) {