game: try to make less wandering monters' preference works
game[legacy]: try to allow missile spell to triger specials
This commit is contained in:
@@ -2695,7 +2695,7 @@ void start_new_game(bool force) {
|
||||
party_in_memory = true;
|
||||
// use user's easy mode and less wandering mode
|
||||
univ.party.easy_mode=get_bool_pref("EasyMode", false);
|
||||
univ.party.less_wm=get_bool_pref("lesswm", false);
|
||||
univ.party.less_wm=get_bool_pref("LessWanderingMonsters", false);
|
||||
if(force) return;
|
||||
fs::path file = nav_put_party();
|
||||
if(!file.empty()) save_party(file, univ);
|
||||
|
@@ -249,6 +249,18 @@ effect_pat_type field[8] = {
|
||||
|
||||
bool center_on_monst;
|
||||
|
||||
std::set<eSpell> spell_missile_map =
|
||||
{
|
||||
// magic spell
|
||||
eSpell::DUMBFOUND, eSpell::FEAR,
|
||||
eSpell::FLAME, eSpell::GOO,
|
||||
eSpell::ICE_BOLT, eSpell::KILL, eSpell::POISON,
|
||||
eSpell::POISON_MINOR, eSpell::SCARE, eSpell::SCRY_MONSTER,
|
||||
eSpell::SLOW, eSpell::SPARK, eSpell::WRACK,
|
||||
// priest spell
|
||||
eSpell::CHARM_FOE, eSpell::CURSE, eSpell::DISPEL_UNDEAD, eSpell::HOLY_SCOURGE,
|
||||
eSpell::STUMBLE, eSpell::TURN_UNDEAD, eSpell::WOUND,
|
||||
};
|
||||
|
||||
void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short num_walls) {
|
||||
short how_many,num_tries = 0;
|
||||
@@ -544,8 +556,8 @@ void pc_attack(short who_att,iLiving* target) {
|
||||
|
||||
// TODO: These don't stack?
|
||||
if(cInvenSlot skill_item = attacker.has_abil_equip(eItemAbil::SKILL)) {
|
||||
hit_adj += 5 * (skill_item->abil_data[0] / 2 + 1);
|
||||
dam_adj += skill_item->abil_data[0] / 2;
|
||||
hit_adj += 5 * (short(skill_item->abil_data[0]) / 2 + 1);
|
||||
dam_adj += short(skill_item->abil_data[0]) / 2;
|
||||
}
|
||||
if(cInvenSlot skill_item = attacker.has_abil_equip(eItemAbil::GIANT_STRENGTH)) {
|
||||
dam_adj += skill_item->abil_data[0];
|
||||
@@ -1028,21 +1040,7 @@ void do_combat_cast(location target) {
|
||||
iLiving* victim;
|
||||
cPlayer& caster = univ.current_pc();
|
||||
bool allow_obstructed = false, allow_antimagic = false;
|
||||
static std::set<eSpell> const oneHitSpell =
|
||||
{
|
||||
// dispell barrier
|
||||
eSpell::DISPEL_BARRIER,
|
||||
// magic spell
|
||||
eSpell::DUMBFOUND, eSpell::FEAR,
|
||||
eSpell::FLAME, eSpell::GOO,
|
||||
eSpell::ICE_BOLT, eSpell::KILL, eSpell::POISON,
|
||||
eSpell::POISON_MINOR, eSpell::SCARE, eSpell::SCRY_MONSTER,
|
||||
eSpell::SLOW, eSpell::SPARK, eSpell::WRACK,
|
||||
// priest spell
|
||||
eSpell::CHARM_FOE, eSpell::CURSE, eSpell::DISPEL_UNDEAD, eSpell::HOLY_SCOURGE,
|
||||
eSpell::STUMBLE, eSpell::TURN_UNDEAD, eSpell::WOUND,
|
||||
};
|
||||
if(oneHitSpell.find(spell_being_cast)!=oneHitSpell.end() || (spell_being_cast == eSpell::NONE && spec_target_options % 10 == 1))
|
||||
if(spell_being_cast==eSpell::DISPEL_BARRIER || spell_missile_map.count(spell_being_cast)!=0 || (spell_being_cast == eSpell::NONE && spec_target_options % 10 == 1))
|
||||
allow_obstructed = true;
|
||||
if(spell_being_cast == eSpell::NONE && spec_target_options / 10 == 2)
|
||||
allow_antimagic = false; // checkme: make no sense, allow_antimagic is always false
|
||||
@@ -4067,8 +4065,8 @@ short count_levels(location where,short radius) {
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if(monst_near(i,where,radius,0)) {
|
||||
if(!univ.town.monst[i].is_friendly())
|
||||
store = store - univ.town.monst[i].level;
|
||||
else store = store + univ.town.monst[i].level;
|
||||
store = store - int(univ.town.monst[i].level);
|
||||
else store = store + int(univ.town.monst[i].level);
|
||||
}
|
||||
if(is_combat()) {
|
||||
for(short i = 0; i < 6; i++)
|
||||
|
@@ -59,7 +59,7 @@ void finish_load_party(){
|
||||
|
||||
// use user's easy mode and less wandering mode
|
||||
univ.party.easy_mode=get_bool_pref("EasyMode", false);
|
||||
univ.party.less_wm=get_bool_pref("lesswm", false);
|
||||
univ.party.less_wm=get_bool_pref("LessWanderingMonsters", false);
|
||||
|
||||
// now if not in scen, this is it.
|
||||
if(!in_scen) {
|
||||
|
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "universe.hpp"
|
||||
|
||||
@@ -1349,14 +1350,15 @@ void cast_town_spell(location where) {
|
||||
}
|
||||
|
||||
// TODO: Currently, the node is called before any spell-specific behaviour (eg missiles) occurs.
|
||||
extern std::set<eSpell> spell_missile_map;
|
||||
bool cast_spell_on_space(location where, eSpell spell) {
|
||||
short s1 = 0;
|
||||
|
||||
for(auto const &spec_loc : univ.town->special_locs) {
|
||||
if(where != spec_loc) continue;
|
||||
bool need_redraw = false;
|
||||
// TODO: Is there a way to skip this condition without breaking compatibility?
|
||||
if(univ.town->get_special(spec_loc.spec).type == eSpecType::IF_CONTEXT)
|
||||
eSpecType specType=univ.town->get_special(spec_loc.spec).type;
|
||||
if (specType==eSpecType::IF_CONTEXT && (!univ.scenario.is_legacy || spell_missile_map.count(spell)==0))
|
||||
run_special(eSpecCtx::TARGET, eSpecCtxType::TOWN, spec_loc.spec, where, &s1, nullptr, &need_redraw);
|
||||
if(need_redraw) redraw_terrain();
|
||||
return !s1;
|
||||
|
Reference in New Issue
Block a user