Add a lot of stuff scraped from *i's version of the code, plus a couple of additional bits.

Adapted from *i:
- Show a confirm dialog when interrupting a special node sequence
- New monster special ability: call global special node (as an action, not on death)
- New item special ability: call global special node
- Check there's a monster death special before calling it (wasn't necessary before, might be now with the special queue changes)
- Queue specials that are triggered while another special is in progress, instead of ignoring them; they will be run after the current special in progress finishes.
- *i's version of petrification touch is currently active only for monster-on-monster combat; need to merge with my version for monster-on-pc combat.
- Pass party location to special in use special item context
- Fix set town visibility node (was checking wrong field and thus could not hide towns)
Special nodes:
- Town Hostile: change to Set Town Attitude
- Select PC node: option to select random PC
- Affect special nodes can now affect monsters
- Fix affect death node reviving non-existent PCs
- Affect Spells: Can remove spells, and can affect level 1-3 spells
- If Objects: Merged from If Barrels and If Crates
- If Species: Replaces If Cave Lore
- If Trait: Replaces If Woodsman
- If Statistic: Replaces If Enough Mage Lore
- Change Lighting: Can affect town's global lighting setting, player's light level, or both at once.
- Pointers! Actually, I'd already implemented the callbacks for setting and getting them, but they're now actually used, and the implementation has been tweaked a little.
- Campaign flags! Again, I'd already implemented them sorta, but I tweaked things and they ended up sort of halfway between the two implementations. Plus there's now a special node to set them.

Additional bits:
- Special queue now uses an std::queue instead of a basic array.
- Enum for town lighting levels
- Disease touch ability is now honoured for monster-on-monster combat
- See monster special context now passes the monster's location as the trigger location; also, removed the double-trigger from one circumstance.
- Along with the set town attitude change, there's now the possibility for making the town hostile to trigger a special node, which can cause the party to be slain.
- Select PC special node: option to select specific PC
- Spell IDs for use in shops and Affect Spell nodes have changed so that 0 is now the first level 1 spell, and so forth.
- add_string_to_buf can now auto-split the string over multiple lines, and the special node that uses it takes advantage of this
- Special node parser warns if a node type is missing a corresponding opcode
- Reserved "pointers" to access the special node's trigger location (this was *i's idea, but he never implemented it)
This commit is contained in:
2014-12-08 00:58:39 -05:00
parent 0d7ad2c718
commit 5249c6eef7
29 changed files with 796 additions and 193 deletions

View File

@@ -1787,6 +1787,7 @@ void do_monster_turn()
{
bool acted_yet, had_monst = false,printed_poison = false,printed_disease = false,printed_acid = false;
bool redraw_not_yet_done = true;
bool special_called = false;
location targ_space,move_targ,l;
short i,j,k,num_monst, target,r1,move_target;
cCreature *cur_monst;
@@ -2169,6 +2170,12 @@ void do_monster_turn()
cur_monst->cur_loc,130,cur_monst->attitude) == true)
{monst_spell_note(cur_monst->number,33); play_sound(61);}
}
if ((cur_monst->radiate_1 == 14) && !special_called && party_can_see_monst(i)) {
short s1, s2, s3;
special_called = true;
take_m_ap(1,cur_monst);
run_special(eSpecCtx::MONST_SPEC_ABIL,0,cur_monst->radiate_2,cur_monst->cur_loc,&s1,&s2,&s3);
}
}
combat_posing_monster = current_working_monster = -1;
@@ -2369,7 +2376,7 @@ void monster_attack_pc(short who_att,short target)
&& (get_ran(1,0,2) < 2)) {
add_string_to_buf(" Causes disease! ");
print_buf();
disease_pc(target,(attacker->spec_skill == 25) ? 6 : 2);
disease_pc(target,6);
}
// Petrification touch
@@ -2381,6 +2388,29 @@ void monster_attack_pc(short who_att,short target)
print_buf();
kill_pc(target,eMainStatus::STONE); // petrified, duh!
}
#if 0 // TODO: This is *i's version of the petrification touch ability.
// It seems better in some ways, like printing a message when you resist,
// but its calculation is very different, so I'm not sure what to with it.
// Note, his version has also been incorporated into monster_attack_monster.
// Petrify target
if (attacker->spec_skill == 30) {
add_string_to_buf(" Petrification touch! ");
r1 = max(0,(get_ran(1,0,100) - univ.party[target].level + 0.5*attacker->level));
// Equip petrify protection?
if (pc_has_abil_equip(target,49) < 24)
r1 = 0;
// Check if petrified.
if (r1 > 60) {
kill_pc(target,eMainStatus::STONE);
add_string_to_buf(" Turned to stone! ");
play_sound(43);
}
else {
add_string_to_buf(" Resists! ");
}
}
#endif
// Undead xp drain
if (((attacker->spec_skill == 16) || (attacker->spec_skill == 17))
@@ -2543,11 +2573,34 @@ void monster_attack_monster(short who_att,short attackee)
add_string_to_buf(" Dumbfounds! ");
dumbfound_monst(target,2);
}
// Disease target
if (((attacker->spec_skill == 25))
&& (get_ran(1,0,2) < 2)) {
add_string_to_buf(" Causes disease! ");
print_buf();
disease_monst(target,6);
}
// Paralyze target
if (attacker->spec_skill == 29) {
add_string_to_buf(" Paralysis touch! ");
charm_monst(target,-5,eStatus::PARALYZED,500);
}
// Petrify target
if (attacker->spec_skill == 30) {
add_string_to_buf(" Petrification touch! ");
r1 = max(0,(get_ran(1,0,100) - target->level + 0.5*attacker->level));
// Check if petrified.
if ((r1 < 60) || (target->immunities & 2)) {
add_string_to_buf(" Resists! ");
}
else {
kill_monst(target,7);
add_string_to_buf(" Turned to stone! ");
play_sound(43);
}
}
// Acid touch
if (attacker->spec_skill == 31) {
add_string_to_buf(" Acid touch! ");