Skip to content

Commit

Permalink
bullet time: attempt to fix bypass mechanic
Browse files Browse the repository at this point in the history
  • Loading branch information
chucksellick committed Sep 30, 2024
1 parent 6bec596 commit 2bd7a51
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
4 changes: 2 additions & 2 deletions crawl-ref/source/attack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -999,8 +999,8 @@ int attack::calc_damage()

bullet_time_method bypass = bullet_time_method::none;

if (attacker->props[BULLET_TIME_TARGET_KEY].get_int64() == defender->mid
&& (bullet_time_method)attacker->props[BULLET_TIME_METHOD_KEY].get_byte()
if (attacker->props[BULLET_TIME_TARGET_KEY].get_int() == defender->mid
&& (bullet_time_method)attacker->props[BULLET_TIME_METHOD_KEY].get_int()
== bullet_time_method::armour)
{
ac_rule = ac_type::none;
Expand Down
20 changes: 11 additions & 9 deletions crawl-ref/source/mon-act.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3865,7 +3865,7 @@ static string _bullet_time_method_verb(bullet_time_method method)
return "bypassing";

default:
return "bugs";
return "bugging";
}
}

Expand All @@ -3883,6 +3883,7 @@ static string _bullet_time_method_name(bullet_time_method method)
return "shield";

default:
mprf("%i buggy method", (char)method);
return "bugs";
}
}
Expand All @@ -3907,8 +3908,8 @@ void bullet_time(monster &mons)
return;

const coord_def target_pos = target->pos();
mons.props[BULLET_TIME_TARGET_KEY] = (int64_t)target->mid;
mons.props[BULLET_TIME_METHOD_KEY] = (char)bullet_time_method::none;
mons.props[BULLET_TIME_TARGET_KEY] = (int)target->mid;
mons.props[BULLET_TIME_METHOD_KEY] = (int)bullet_time_method::none;

if (!handle_throw(&mons, beem, false, false)
// Killed by reflection etc
Expand All @@ -3919,7 +3920,7 @@ void bullet_time(monster &mons)
}

const bullet_time_method method =
(bullet_time_method)mons.props[BULLET_TIME_METHOD_KEY].get_byte();
(bullet_time_method)mons.props[BULLET_TIME_METHOD_KEY].get_int();

// XX: At this point could apply a status to the player to make the relevant
// stat appear as 0 briefly, but maybe it's overkill for such a transfient effect.
Expand All @@ -3939,12 +3940,13 @@ void bullet_time(monster &mons)
return;
}

if (you.see_cell(target_pos) && you.see_cell(mons.pos()))
if (method != bullet_time_method::none && you.see_cell(target_pos)
&& you.see_cell(mons.pos()))
{
mprf("%s catches %s off guard, %s %s %s", mons.name(DESC_THE),
target->name(DESC_THE), _bullet_time_method_verb(method),
target->pronoun(PRONOUN_POSSESSIVE),
_bullet_time_method_name(method));
mprf("%s catches %s off guard, %s %s %s", mons.name(DESC_THE).c_str(),
target->name(DESC_THE).c_str(), _bullet_time_method_verb(method).c_str(),
target->pronoun(PRONOUN_POSSESSIVE).c_str(),
_bullet_time_method_name(method).c_str());
}

// Fire second shot. The bypass is handled via the props.
Expand Down
4 changes: 2 additions & 2 deletions crawl-ref/source/mon-behv.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#define MON_SPELL_USABLE_KEY "mon_spell_usable"

#define BULLET_TIME_METHOD_KEY "bullet_time_bypass"
#define BULLET_TIME_TARGET_KEY "bullet_time_bypass_mid"
#define BULLET_TIME_METHOD_KEY "bullet_time_method"
#define BULLET_TIME_TARGET_KEY "bullet_time_target"

class actor;

Expand Down
2 changes: 1 addition & 1 deletion crawl-ref/source/monster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5855,7 +5855,7 @@ void monster::react_to_damage(const actor *oppressor, int damage,

// Rockfish schools disperse into individual fishies (if they're
// still alive at all after everything else processes)
if (type == MONS_ROCKFISH_SCHOOL)
if (type == MONS_ROCK_FISH_SCHOOL)
rockfish_disperse_fineff::schedule(oppressor, this, pos());

// Damage sharing from the spectral weapon to its owner
Expand Down
17 changes: 9 additions & 8 deletions crawl-ref/source/ranged-attack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ bool ranged_attack::attack()

bullet_time_method bypass = bullet_time_method::none;

if (attacker->props[BULLET_TIME_TARGET_KEY].get_int64() == defender->mid)
if ((mid_t)attacker->props[BULLET_TIME_TARGET_KEY].get_int() == defender->mid)
{
bypass = (bullet_time_method)
attacker->props[BULLET_TIME_METHOD_KEY].get_byte();
attacker->props[BULLET_TIME_METHOD_KEY].get_int();
}

ev_margin = bypass == bullet_time_method::evasion ? -1
Expand Down Expand Up @@ -213,9 +213,9 @@ bool ranged_attack::handle_phase_blocked()
maybe_trigger_jinxbite();
}

if (attacker->props[BULLET_TIME_TARGET_KEY].get_int64() == defender->mid)
if ((mid_t)attacker->props[BULLET_TIME_TARGET_KEY].get_int() == defender->mid)
{
attacker->props[BULLET_TIME_METHOD_KEY]
attacker->props[BULLET_TIME_METHOD_KEY].get_int()
= (char)bullet_time_method::shield;
}

Expand All @@ -226,9 +226,9 @@ bool ranged_attack::handle_phase_dodged()
{
did_hit = false;

if (attacker->props[BULLET_TIME_TARGET_KEY].get_int64() == defender->mid)
if ((mid_t)attacker->props[BULLET_TIME_TARGET_KEY].get_int() == defender->mid)
{
attacker->props[BULLET_TIME_METHOD_KEY]
attacker->props[BULLET_TIME_METHOD_KEY].get_int()
= (char)bullet_time_method::evasion;
}

Expand Down Expand Up @@ -285,9 +285,10 @@ static bool _jelly_eat_missile(const item_def& projectile, int damage_done)

bool ranged_attack::handle_phase_hit()
{
if (attacker->props[BULLET_TIME_TARGET_KEY].get_int64() == defender->mid)
mprf("Bullet time %i, %i", attacker->props[BULLET_TIME_TARGET_KEY].get_int(), defender->mid);
if ((mid_t)attacker->props[BULLET_TIME_TARGET_KEY].get_int() == defender->mid)
{
attacker->props[BULLET_TIME_METHOD_KEY]
attacker->props[BULLET_TIME_METHOD_KEY].get_int()
= (char)bullet_time_method::armour;
}

Expand Down

0 comments on commit 2bd7a51

Please sign in to comment.