Fix monsters behind glass walls being autotargetted for spells that need a path.
Fix spacing in spl-data.h, and add some comments about commenting to coding_conventions.txt.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5148 c06c8d41-db1a-0410-9941-cceddc491573
CHO4U5JC3RNTLXVIDXXJYZMOBZJ4VXW2GVJWDOTBRKK3AJ36LDLQC TXENGSZD2F6LFYQVN3MGWO2LH4H6F4756NIMQZL2B3MXIAGN5AQAC YP6ID3SV4JYHXAUHRDAIMIGDHYQFAKP4BFLBE66MWGBLVTZWSHIAC V73UY2UF3CK5QP2QDAUT3XCNFIW767YAOHE3XERUB2JXKXEINYVQC FEQ5JZXDHM2SCZGWVJO76HQBYZRKRNR5DYXACUMQYOG3X3TIFO6QC 7KVPF74ACO6Q5FXS2YBBJTJT4Y4YN2M3ZNIPXFI3QSQNGNTHD7AAC KHVK7HH7OIYOBZY52WQGGLC2O4SXTWQS2XAHNJZZ7JZ3QTOUTLNAC ZBPS5ZTPF3DVTR5WET4XEFHYXU26CRHU2OHX3YO6PD4MTM2DUXAQC R3ZUGT5VJ2DG5NFPG4RBWDWTULDE7L4REYSGVPHJPDXFG6OBIXYAC ARP25R4B66WPY56X77RRYLHDTIVGZCG2GQGV5WX2UX3DUAS2SAAQC DDU4A3JGN5IUIPP5IASOODKPR2WBHSDSV4FITZ6HNXNSXXQACWAQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC V5N2KDMZB26TLLIRDLICRM3CNOMHKYHAIZ5HCGDOWF57GDAY7JCAC T6TL6NTIOBYNUIONGK3JFZJ5ONWV6S4CTIRDC5JMKMCBGG5IY3EAC FCL7KOWXA5O3GLMDR22JCGMTHMZ57C4WQIJKBIIUQV3LI2CI3X7AC PFEJ4LMDNEKLMGRCMWQ7EIRVU4JMYGICI4G7X4WVWOROVXQCBZ7QC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC PR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LC46EAO67DPBH5KEG2FQTPBLGU62HIRWA3UQ7XQC 45QV77UI6QFW4234P365LD3FGJYRVWTT5455DPB324NG2NFQMKTQC YAAJ6PTN6QUSWE52URI5AENOGD366FIHOIFUOXFUJLVZYE4OG6HQC XLLXDEUCIHZOCZVXPNUIXAA5MIT7T7YRDMXKRMTO43UEFNVQ77FQC ASLW3Z5PAVZSWJEMMMVZT226P44EKSAD47QS72JIFJESAI3RPN3AC ECUYJLVGW6ADRLLF2WOMRG464VHOVDPP5OK5SAX2PHBUUC5FD4TQC 4PBRMB7TK2TXL7VSDKMUQMT4QFK3SGRU4TUVMEM7V2VS7KKKILAQC 45EMD3KLQPMERNMIKU5G76H6556XOMIW352TSBP7VLWJX2YYGS7AC 6TEISZD7HYSSL24EOKIBNURU66KGSQX7B7SNAHBP4DQSAOTGH2MQC RVST2QHYJ757ZHK4AUJ5NGPDZ44AD6RVFVXYPKQIBJXZBDNUCHXQC PKPOPYZ5XE6XOLFRAGUDRU6DQBZJUAKCYKUJHU7L5B2GGHCXY25QC Many spells use magic from two types. These spells are equallyavailable to either type; a conjurer is no worse at a fire/conjuration thanat a pure conjuration. I guess a spell could be of three types, but theywould have to be types with short names (limited space in the spellwindows).- Note : this is no longer true, with the implementation of magic skills.Your skill for a spell is effectively the average of all types used in it.Poison has no skills, but still has a staff
Your skill for a spell is effectively the average of all schools used in it.
SPELL_SWAP, "Swap",SPTYP_TRANSLOCATION,SPFLAG_NONE,4,0,NULL,false,false
SPELL_SWAP, "Swap",SPTYP_TRANSLOCATION,SPFLAG_NONE,4,0,NULL,false,false
SPELL_APPORTATION, "Apportation",SPTYP_TRANSLOCATION,SPFLAG_NONE,1,1000,NULL,false,false
SPELL_APPORTATION, "Apportation",SPTYP_TRANSLOCATION,SPFLAG_NONE,1,1000,NULL,false,false
SPELL_FAR_STRIKE, "Far Strike",SPTYP_TRANSLOCATION,SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF,3,100,NULL,true
SPELL_FAR_STRIKE, "Far Strike",SPTYP_TRANSLOCATION,SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF,3,100,NULL,true
SPELL_STRIKING, "Striking",0,SPFLAG_DIR_OR_TARGET,1,25,NULL,true
SPELL_STRIKING, "Striking",0,SPFLAG_DIR_OR_TARGET,1,25,NULL,true
// and Swiftness is level 2 (and gives a similar effect). It's also// not that much better than Invisibility. -- bwr
// and Swiftness is level 2 (and gives a similar effect). It's also// not that much better than Invisibility. -- bwr
SPELL_STONESKIN, "Stoneskin",SPTYP_EARTH | SPTYP_TRANSMIGRATION, // was ench -- bwrSPFLAG_NONE,2,200,
SPELL_STONESKIN, "Stoneskin",SPTYP_EARTH | SPTYP_TRANSMIGRATION, // was ench -- bwrSPFLAG_NONE,2,200,
SPELL_SIMULACRUM, "Simulacrum",SPTYP_ICE | SPTYP_NECROMANCY,SPFLAG_NONE,6,200,
SPELL_SIMULACRUM, "Simulacrum",SPTYP_ICE | SPTYP_NECROMANCY,SPFLAG_NONE,6,200,
SPELL_CONJURE_BALL_LIGHTNING, "Conjure Ball Lightning",SPTYP_AIR | SPTYP_CONJURATION,SPFLAG_NONE,7,200,
SPELL_CONJURE_BALL_LIGHTNING, "Conjure Ball Lightning",SPTYP_AIR | SPTYP_CONJURATION,SPFLAG_NONE,7,200,
SPELL_CHAIN_LIGHTNING, "Chain Lightning",SPTYP_AIR | SPTYP_CONJURATION,SPFLAG_NONE,8,200,
SPELL_CHAIN_LIGHTNING, "Chain Lightning",SPTYP_AIR | SPTYP_CONJURATION,SPFLAG_NONE,8,200,
SPTYP_SUMMONING,SPFLAG_UNHOLY,4,0,NULL,false
SPTYP_SUMMONING,SPFLAG_UNHOLY,4,0,NULL,false
SPTYP_CONJURATION | SPTYP_NECROMANCY,SPFLAG_DIR_OR_TARGET,6,0,NULL,true
SPTYP_CONJURATION | SPTYP_NECROMANCY,SPFLAG_DIR_OR_TARGET,6,0,NULL,true
beem.name = "glob of lava";beem.range = 4;beem.rangeMax = 13;beem.damage = dice_def( 3, 10 );beem.colour = RED;beem.type = dchar_glyph(DCHAR_FIRED_ZAP);beem.flavour = BEAM_LAVA;beem.hit = 20;
beem.name = "glob of lava";beem.aux_source = "glob of lava";beem.range = 4;beem.rangeMax = 13;beem.damage = dice_def( 3, 10 );beem.hit = 20;beem.colour = RED;beem.type = dchar_glyph(DCHAR_FIRED_ZAP);beem.flavour = BEAM_LAVA;
beem.name = "bolt of electricity";beem.damage = dice_def( 3, 6 );beem.colour = LIGHTCYAN;beem.type = dchar_glyph(DCHAR_FIRED_ZAP);beem.flavour = BEAM_ELECTRICITY;beem.hit = 50;
beem.name = "bolt of electricity";beem.aux_source = "bolt of electricity";beem.range = 4;beem.rangeMax = 13;beem.damage = dice_def( 3, 6 );beem.hit = 50;beem.colour = LIGHTCYAN;beem.type = dchar_glyph(DCHAR_FIRED_ZAP);beem.flavour = BEAM_ELECTRICITY;
CE_NOCORPSE, // 0CE_CLEAN, // 1CE_CONTAMINATED, // 2CE_POISONOUS, // 3CE_HCL, // 4CE_MUTAGEN_RANDOM, // 5CE_MUTAGEN_GOOD, // 6 - may be worth implementing {dlb}CE_MUTAGEN_BAD, // 7 - may be worth implementing {dlb}CE_RANDOM, // 8 - not used, but may be worth implementing {dlb}CE_ROTTEN = 50 // 50 - must remain at 50 for now {dlb}
CE_NOCORPSE, // 0CE_CLEAN, // 1CE_CONTAMINATED, // 2CE_POISONOUS, // 3CE_HCL, // 4CE_MUTAGEN_RANDOM, // 5CE_MUTAGEN_GOOD, // 6 - may be worth implementing {dlb}CE_MUTAGEN_BAD, // 7 - may be worth implementing {dlb}CE_RANDOM, // 8 - not used, but may be worth implementing {dlb}CE_ROTTEN = 50 // 50 - must remain at 50 for now {dlb}
}// used to determine whether or not a monster should always// fire this spell if selected. If not, we should use a// tracer.// note - this function assumes that the monster is "nearby"// its target!bool ms_requires_tracer(spell_type monspell){return (spell_needs_tracer(monspell));
// These eyes only need LOS, as well. (The other eyes use spells.)if (mclass == MONS_GIANT_EYEBALL || mclass == MONS_EYE_OF_DRAINING)return (true);// Although not using spells, these are exceedingly dangerous.if (mclass == MONS_SILVER_STATUE || mclass == MONS_ORANGE_STATUE)return (true);// Beholding just needs LOS.if (mclass == MONS_MERMAID)return (true);return (false);}
static bool find_object( int x, int y, int mode, int range );static bool find_monster( int x, int y, int mode, int range );static bool find_feature( int x, int y, int mode, int range );
static bool find_object( int x, int y, int mode, bool need_path, int range );static bool find_monster( int x, int y, int mode, bool need_path, int range );static bool find_feature( int x, int y, int mode, bool need_path, int range );
bool (*targ)(int, int, int, int),int mode = TARG_ANY, int range = -1,bool wrap = false,
bool (*targ)(int, int, int, bool, int),bool need_path = false, int mode = TARG_ANY,int range = -1, bool wrap = false,
bool (*targ)(int, int, int, int),int mode = TARG_ANY, int range = -1,bool wrap = false,int los = LOS_ANY);
bool (*targ)(int, int, int, bool, int),bool need_path, int mode = TARG_ANY, int range = -1,bool wrap = false, int los = LOS_ANY);
find_feature, thing_to_find, range, true,Options.target_los_first ?LOS_FLIPVH : LOS_ANY))
find_feature, needs_path, thing_to_find,range, true, Options.target_los_first ?LOS_FLIPVH : LOS_ANY))
find_object, 0, range, true,Options.target_los_first? (dir == 1? LOS_FLIPVH : LOS_FLIPHV): LOS_ANY))
find_object, needs_path, TARG_ANY, range,true, Options.target_los_first ?(dir == 1? LOS_FLIPVH : LOS_FLIPHV): LOS_ANY))
return find_square(ctrx, ctry, mfp, direction, find_targ, mode,range, false, next_los(direction, los, wrap));
return find_square(ctrx, ctry, mfp, direction, find_targ,need_path, mode, range, false,next_los(direction, los, wrap));
return find_square(minx, maxy, mfp, direction, find_targ, mode,range, false, next_los(direction, los, wrap));
return find_square(minx, maxy, mfp, direction, find_targ,need_path, mode, range, false,next_los(direction, los, wrap));
find_square(ctrx, ctry, mfp, direction, find_targ, mode, range, false,next_los(direction, los, wrap)): find_square(minx, maxy, mfp, direction, find_targ, mode, range, false,next_los(direction, los, wrap)));
find_square(ctrx, ctry, mfp, direction, find_targ, need_path, mode,range, false, next_los(direction, los, wrap)): find_square(minx, maxy, mfp, direction, find_targ, need_path, mode,range, false, next_los(direction, los, wrap)));
Note that monsters have their own reasonings for which items theymay need, and when they feel safe enough to pick them up. Exceptfor "none", these options won't let you override this behaviour.
Note that this only works for permanent allies (such as you canget when worshipping Beogh or the Shining One), and that monstershave their own reasonings for which items they may need, and whenthey feel safe enough to pick them up. Except for "none", theseoptions won't let you override these restrictions.
static void replace_area( int sx, int sy, int ex, int ey,dungeon_feature_type replace,dungeon_feature_type feature, unsigned mapmask){[...]}
static void replace_area( int sx, int sy, int ex, int ey,dungeon_feature_type replace,dungeon_feature_type feature, unsigned mapmask){[...]}
// - Functions use underscores_as_spaces, but there are currently// a lot of mixedCase functions.void destroy_item(item_def* item){// - Variables use underscores too.int item_weight = /* ... */;
void destroy_item(item_def* item){// - Variables use underscores too.int item_weight = /* ... */;}
D) Commenting-------------If you feel that a method is complicated enough to be difficult to understand,or has restrictions or effects that might not be obvious, add explanatorycomments before it. You may sign your comments if you wish to.// note that this function *completely* blocks messaging for monsters// distant or invisible to the player ... look elsewhere for a function// permitting output of "It" messages for the invisible {dlb}// Intentionally avoids info and str_pass now. -- bwrbool simple_monster_message(const monsters *monster, const char *event,msg_channel_type channel, int param,description_level_type descrip)[...]Adding explanatory comments to somewhat complicated, already existing methodsis very much welcome, as long as said comments are correct. :)Suboptimal code should be marked for later revision using the keywords "XXX","FIXME" or "TODO", so that other coders can easily find it by searching thesource. Also, some editors will highlight such keywords. Don't forget to adda comment about what should be changed, or to remove said comment if you fixthe issue.// XXX Unbelievably hacky. And to think that my goal was to clean up the code.// Identical to find_square, except that input (tx, ty) and output// (mfp) are in grid coordinates rather than view coordinates.static char find_square_wrapper( int tx, int ty,[...]if (death_type == KILLED_BY_LEAVING|| death_type == KILLED_BY_WINNING){// TODO: strcat "after reaching level %d"; for LEAVING[...]// FIXME: implement this for tilesvoid update_monster_pane() {}