Skip to content

Commit f6e1854

Browse files
committed
allow some smite-targeting summon auto spell
1 parent 44e1ba8 commit f6e1854

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

crawl-ref/source/player.cc

+19-1
Original file line numberDiff line numberDiff line change
@@ -9667,7 +9667,25 @@ bool player::auto_cast(const coord_def& target, int delay, auto_spell_phase phas
96679667
dec_mp(cost, false);
96689668
if (majin_charge_hp())
96699669
dec_hp(hp_cost, false);
9670-
spret cast_result = your_spells(cast_spell, 0, false, nullptr, (flags & spflag::selfench) ? you.pos() : target);
9670+
9671+
coord_def cast_target = target;
9672+
if (is_smite_targeting_summon(cast_spell))
9673+
{
9674+
vector<coord_def> spots;
9675+
for (adjacent_iterator ai(target); ai; ++ai)
9676+
{
9677+
if (!feat_is_solid(grd(*ai)) && !actor_at(*ai))
9678+
{
9679+
spots.push_back(*ai);
9680+
}
9681+
}
9682+
if (spots.size() <= 0)
9683+
return false;
9684+
9685+
cast_target = spots[random2(spots.size())]; //new summon position
9686+
}
9687+
9688+
spret cast_result = your_spells(cast_spell, 0, false, nullptr, (flags & spflag::selfench) ? you.pos() : cast_target);
96719689
if (cast_result == spret::abort)
96729690
{
96739691
inc_mp(cost, true);

crawl-ref/source/spl-util.cc

+28-1
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,6 @@ string spell_uselessness_reason(spell_type spell, bool temp, bool prevent,
12021202
switch (spell)
12031203
{
12041204
case SPELL_CONJURE_FLAME:
1205-
case SPELL_FULMINANT_PRISM:
12061205
case SPELL_CONFUSING_TOUCH:
12071206
case SPELL_APPORTATION:
12081207
case SPELL_TELEPORT_OTHER:
@@ -1839,6 +1838,20 @@ bool can_auto_cast_spell(spell_type spell, const coord_def& target, auto_spell_p
18391838
if (no_enemy)
18401839
return false;
18411840

1841+
if (is_smite_targeting_summon(spell))
1842+
{
1843+
vector<coord_def> spots;
1844+
for (adjacent_iterator ai(target); ai; ++ai)
1845+
{
1846+
if (!feat_is_solid(grd(*ai)) && !actor_at(*ai))
1847+
{
1848+
spots.push_back(*ai);
1849+
}
1850+
}
1851+
if (spots.size() <= 0)
1852+
return false;
1853+
}
1854+
18421855
switch (spell) {
18431856
//buf spell
18441857
case SPELL_FROZEN_RAMPARTS:
@@ -2431,6 +2444,7 @@ bool is_dangerous_auto_spell(spell_type spell)
24312444
case SPELL_LRD:
24322445
case SPELL_VIOLENT_UNRAVELLING:
24332446
case SPELL_OLGREBS_LAST_MERCY:
2447+
case SPELL_FULMINANT_PRISM:
24342448
return true;
24352449
default:
24362450
return false;
@@ -2498,6 +2512,19 @@ bool is_castable_null_target(spell_type spell)
24982512
return false;
24992513
}
25002514
}
2515+
bool is_smite_targeting_summon(spell_type spell)
2516+
{
2517+
switch (spell)
2518+
{
2519+
case SPELL_SUMMON_LIGHTNING_SPIRE:
2520+
case SPELL_SINGULARITY:
2521+
case SPELL_FULMINANT_PRISM:
2522+
return true;
2523+
default:
2524+
return false;
2525+
}
2526+
2527+
}
25012528

25022529

25032530

crawl-ref/source/spl-util.h

+1
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,6 @@ bool can_auto_cast_spell(spell_type spell, const coord_def& target, auto_spell_p
144144
bool is_currect_phase_auto_spell(spell_type spell, auto_spell_phase phase);
145145
bool is_dangerous_auto_spell(spell_type spell);
146146
bool is_castable_null_target(spell_type spell);
147+
bool is_smite_targeting_summon(spell_type spell);
147148

148149
bool is_can_spectrum(spell_type spell);

0 commit comments

Comments
 (0)