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

@@ -177,8 +177,10 @@ void put_pick_spell_graphics();
//mode; // 0 - prefab 1 - regular 2 - debug
// Note: mode 1 is never used
void init_party(short mode)
{
// TODO: Remove in favour of cParty constructor.
short i,j,k,l;
cVehicle null_boat;// = {{0,0},{0,0},{0,0},200,false};
@@ -252,6 +254,10 @@ void init_party(short mode)
for (j = 0; j < 8; j++)
univ.party.item_taken[i][j] = 0;
// Zero out campaign flags and pointers
univ.party.campaign_flags.clear();
univ.party.pointers.clear();
refresh_store_items();
@@ -814,6 +820,8 @@ void increase_light(short amt)
location where;
univ.party.light_level += amt;
if(univ.party.light_level < 0)
univ.party.light_level = 0;
if (is_combat()) {
for (i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE) {
@@ -941,13 +949,23 @@ void drain_pc(short which_pc,short how_much)
}
}
short mage_lore_total()
{
short total = 0,i;
// mode: 0 = total, 1 = mean, 2 = min, 3 = max
short check_party_stat(short which_stat, short mode) {
short total = mode == 2 ? std::numeric_limits<short>::max() : 0, num_pcs = 0;
for (i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE)
total += univ.party[i].skills[11];
for(short i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE) {
num_pcs++;
if(mode < 2)
total += univ.party[i].skills[which_stat];
else if(mode == 2)
total = max(univ.party[i].skills[which_stat], total);
else if(mode == 3)
total = min(univ.party[i].skills[which_stat], total);
}
if(mode == 1 && num_pcs > 0)
total /= num_pcs;
return total;
}
@@ -3122,20 +3140,38 @@ void take_ap(short num)
univ.party[current_pc].ap = max(0,univ.party[current_pc].ap - num);
}
short cave_lore_present()
{
// TODO: Enumify
// TODO: Use this to check cave lore and woodsman for the purpose of gaining food
// (It replaces cave_lore_present() and woodsman_present(), but the latter was never used,
// and the former was only used to help you lose less food when going over a waterfall.
short trait_present(short which_trait) {
short i,ret = 0;
for (i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].traits[4] > 0)
if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].traits[which_trait] > 0)
ret += 1;
return ret;
}
short woodsman_present()
{
short i,ret = 0;
for (i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].traits[5] > 0)
ret += 1;
return ret;
short wilderness_lore_present() {
// TODO: Add contional statement to choose between these
// (Probably requires something added to terrain types to specify that it's cave/surface wilderness.)
return trait_present(4); // Cave Lore
return trait_present(5); // Woodsman
}
short party_size(bool only_living) {
short num_pcs = 0;
for (short i = 0; i < 6; i++) {
if (!only_living) {
if (univ.party[i].main_status != eMainStatus::ABSENT)
num_pcs++;
}
else {
if (univ.party[i].main_status == eMainStatus::ALIVE)
num_pcs++;
}
}
return num_pcs;
}