Skip to content

Commit

Permalink
Allow (barrier) protect on structures
Browse files Browse the repository at this point in the history
Closes: #68
Closes: #67
  • Loading branch information
APN-Pucky committed Mar 15, 2024
1 parent adb0222 commit ca68e26
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,8 @@ void turn_end_phase(Field* fd)
{
continue;
}
// reset the structure's (barrier) protect
status.m_protected = 0;
status.m_evaded = 0; // so far only useful in Inactive turn
}
}
Expand Down Expand Up @@ -2290,12 +2292,24 @@ inline void perform_skill<Skill::fortify>(Field* fd, CardStatus* src, CardStatus
{
dst->ext_hp(s.x);
}

template<>
inline void perform_skill<Skill::siege>(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
unsigned siege_dmg = remove_absorption(fd,dst,s.x);
// structure should not have protect normally..., but let's allow it for barrier support
siege_dmg = safe_minus(siege_dmg, src->m_overloaded ? 0 : dst->protected_value());
remove_hp(fd, dst, siege_dmg);
}

template<>
inline void perform_skill<Skill::mortar>(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<Skill::siege>(fd, src, dst, s);
}
else
{
Expand Down Expand Up @@ -2356,12 +2370,6 @@ inline void perform_skill<Skill::rush>(Field* fd, CardStatus* src, CardStatus* d
}
}

template<>
inline void perform_skill<Skill::siege>(Field* fd, CardStatus* src, CardStatus* dst, const SkillSpec& s)
{
remove_hp(fd, dst, remove_absorption(fd,dst,s.x));
}

template<>
inline void perform_skill<Skill::strike>(Field* fd, CardStatus* src, CardStatus* dst, const SkillSpec& s)
{
Expand Down

0 comments on commit ca68e26

Please sign in to comment.