Skip to content

Commit

Permalink
Deflect Missiles rework
Browse files Browse the repository at this point in the history
  • Loading branch information
bhauth committed Jan 18, 2019
1 parent a95a5b9 commit 99e868d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -114,6 +114,7 @@ Pull requests for new content are welcome.
- v1.9.1: Song of Slaying starts at +1.
- v1.9.1: Force Lance is pure translocations, and removed from the Conjurer book.
- v1.9.2: Spectral Weapon lasts longer at high spell power.
- v1.9.2: Deflect Missiles is never dispelled by attacks, but can drain mana when it deflects missiles. It drains less mana at higher power.

#### Removed Spells
- Summon Guardian Golem
Expand Down
9 changes: 7 additions & 2 deletions crawl-ref/source/dat/descript/spells.txt
Expand Up @@ -389,8 +389,13 @@ Deflect Missiles spell

Protects the caster from all kinds of projectile attacks, making them
significantly easier to dodge. It is highly effective against both
single-target and penetrating attacks. Each time a missile is deflected the
spell has a chance of expiring, with a lower chance of expiry at high power.
single-target and penetrating attacks.

The spell is linked to the caster's magical reserves, and may drain
magic when a missile is deflected. The efficiency of the shield increases
at higher spell power.

To be cancelled, this spell must be carefully cast again in reverse.
%%%%
Dig spell

Expand Down
9 changes: 3 additions & 6 deletions crawl-ref/source/player.cc
Expand Up @@ -5788,7 +5788,8 @@ void player::shield_block_succeeded(actor *foe)

int player::missile_deflection() const
{
if (attribute[ATTR_DEFLECT_MISSILES])
if (attribute[ATTR_DEFLECT_MISSILES]
&& (you.magic_points || you.species == SP_DJINNI))
return 2;

if (get_mutation_level(MUT_DISTORTION_FIELD) == 3
Expand All @@ -5807,11 +5808,7 @@ void player::ablate_deflection()
if (attribute[ATTR_DEFLECT_MISSILES])
{
const int power = calc_spell_power(SPELL_DEFLECT_MISSILES, true);
if (one_chance_in(2 + power / 8))
{
attribute[ATTR_DEFLECT_MISSILES] = 0;
mprf(MSGCH_DURATION, "You feel less protected from missiles.");
}
dec_mp(div_rand_round(25, power));
}
}

Expand Down
13 changes: 11 additions & 2 deletions crawl-ref/source/spl-selfench.cc
Expand Up @@ -90,8 +90,17 @@ spret ice_armour(int pow, bool fail)
spret deflection(int pow, bool fail)
{
fail_check();
you.attribute[ATTR_DEFLECT_MISSILES] = 1;
mpr("You feel very safe from missiles.");

if(!you.attribute[ATTR_DEFLECT_MISSILES])
{
you.attribute[ATTR_DEFLECT_MISSILES] = 1;
mpr("You feel very safe from missiles.");
}
else
{
you.attribute[ATTR_DEFLECT_MISSILES] = 0;
mpr("You carefully dispel your deflective shield.");
}

return spret::success;
}
Expand Down
5 changes: 0 additions & 5 deletions crawl-ref/source/spl-util.cc
Expand Up @@ -1146,11 +1146,6 @@ string spell_uselessness_reason(spell_type spell, bool temp, bool prevent,
return "darkness is useless against divine light.";
break;

case SPELL_DEFLECT_MISSILES:
if (temp && you.attribute[ATTR_DEFLECT_MISSILES])
return "you're already deflecting missiles.";
break;

case SPELL_STATUE_FORM:
if (SP_GARGOYLE == you.species)
return "you're already a statue.";
Expand Down
15 changes: 8 additions & 7 deletions crawl-ref/source/status.cc
Expand Up @@ -1044,19 +1044,20 @@ static void _describe_terrain(status_info& inf)

static void _describe_missiles(status_info& inf)
{
const int level = you.missile_deflection();
if (!level)
return;
int level = you.missile_deflection();

if(you.attribute[ATTR_DEFLECT_MISSILES] && level == 0)
level = 2;

if (level > 1)
if (level == 2)
{
bool perm = false;
inf.light_colour = perm ? WHITE : LIGHTMAGENTA;
bool enough_mana = you.magic_points || you.species == SP_DJINNI;
inf.light_colour = enough_mana ? LIGHTMAGENTA : DARKGREY;
inf.light_text = "DMsl";
inf.short_text = "deflect missiles";
inf.long_text = "You deflect missiles.";
}
else
else if (level == 1)
{
bool perm = you.get_mutation_level(MUT_DISTORTION_FIELD) == 3
|| you.wearing_ego(EQ_ALL_ARMOUR, SPARM_REPULSION)
Expand Down

0 comments on commit 99e868d

Please sign in to comment.