Skip to content

Commit

Permalink
Fixed Flurry-On-Attacked-Target Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed Sep 21, 2017
1 parent d24e230 commit 653274c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ void evaluate_skills(Field* fd, CardStatus* status, const std::vector<SkillSpec>
{
_DEBUG_ASSERT(status);
unsigned num_actions(1);
for (unsigned action_index(0); action_index < num_actions; ++ action_index)
for (action_index = 0; action_index < num_actions; ++ action_index)
{
fd->prepare_action();
_DEBUG_ASSERT(fd->skill_queue.size() == 0);
Expand Down Expand Up @@ -774,6 +774,11 @@ inline bool skill_check<Skill::jam>(Field* fd, CardStatus* c, CardStatus* ref)
{ return is_active_next_turn(c); }

// inactive player performs Jam
if (is_active(c) && c->m_step == CardStep::attacking && c->has_skill(Skill::flurry) && action_index < c->skill_base_value(Skill::flurry))
{
_DEBUG_MSG(2,"**APN** targetable due to flurry\n")
return true;
}
return is_active(c) && (c->m_step == CardStep::none);
}

Expand Down Expand Up @@ -1056,6 +1061,10 @@ void turn_end_phase(Field* fd)
//---------------------- $50 attack by assault card implementation -------------
// Counter damage dealt to the attacker (att) by defender (def)
// pre-condition: only valid if m_card->m_counter > 0

// APN - Global Access to check if flurry is active for on attacked
unsigned action_index{0};

inline unsigned counter_damage(Field* fd, CardStatus* att, CardStatus* def)
{
_DEBUG_ASSERT(att->m_card->m_type == CardType::assault);
Expand Down Expand Up @@ -1741,8 +1750,15 @@ inline bool skill_predicate<Skill::weaken>(Field* fd, CardStatus* src, CardStatu
if (__builtin_expect((fd->tapi == src->m_player), true))
{ return is_active_next_turn(dst); }

// APN - On-Attacked/Death don't target the attacking card

// inactive player performs Weaken (inverted case (on-death activation))
return is_active(dst) && !has_attacked(dst);
if (is_active(dst) && dst->m_step == CardStep::attacking && dst->has_skill(Skill::flurry) && action_index < dst->skill_base_value(Skill::flurry))
{
_DEBUG_MSG(2,"**APN** targetable due to flurry\n")
return true;
}
return is_active(dst) && (dst->m_step == CardStep::none);
}

template<>
Expand Down
1 change: 1 addition & 0 deletions sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Field;
class Achievement;

extern unsigned turn_limit;
extern unsigned action_index;

//---------------------- Represent Simulation Results ----------------------------
template<typename result_type>
Expand Down

0 comments on commit 653274c

Please sign in to comment.