Make more use of references to shorten long lines of code
This goes through just four files for unnecessary uses of univ.party[n].
This commit is contained in:
@@ -352,36 +352,38 @@ static void handle_pause(bool& did_something, bool& need_redraw) {
|
||||
check_fields(univ.current_pc().combat_pos,eSpecCtx::COMBAT_MOVE,univ.current_pc());
|
||||
} else {
|
||||
add_string_to_buf("Pause.");
|
||||
for(int k = 0; k < 6; k++)
|
||||
if(univ.party[k].main_status == eMainStatus::ALIVE && univ.party[k].status[eStatus::WEBS] > 0) {
|
||||
add_string_to_buf(univ.party[k].name + " cleans webs.");
|
||||
move_to_zero(univ.party[k].status[eStatus::WEBS]);
|
||||
move_to_zero(univ.party[k].status[eStatus::WEBS]);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE && pc.status[eStatus::WEBS] > 0) {
|
||||
add_string_to_buf(pc.name + " cleans webs.");
|
||||
move_to_zero(pc.status[eStatus::WEBS]);
|
||||
move_to_zero(pc.status[eStatus::WEBS]);
|
||||
}
|
||||
if(univ.party.in_horse >= 0) {
|
||||
cVehicle& horse = univ.party.horses[univ.party.in_horse];
|
||||
if(overall_mode == MODE_OUTDOORS) {
|
||||
univ.party.horses[univ.party.in_horse].which_town = 200;
|
||||
univ.party.horses[univ.party.in_horse].loc = global_to_local(univ.party.out_loc);
|
||||
univ.party.horses[univ.party.in_horse].sector.x = univ.party.outdoor_corner.x + univ.party.i_w_c.x;
|
||||
univ.party.horses[univ.party.in_horse].sector.y = univ.party.outdoor_corner.y + univ.party.i_w_c.y;
|
||||
horse.which_town = 200;
|
||||
horse.loc = global_to_local(univ.party.out_loc);
|
||||
horse.sector.x = univ.party.outdoor_corner.x + univ.party.i_w_c.x;
|
||||
horse.sector.y = univ.party.outdoor_corner.y + univ.party.i_w_c.y;
|
||||
univ.party.in_horse = -1;
|
||||
} else if(overall_mode == MODE_TOWN){
|
||||
univ.party.horses[univ.party.in_horse].loc = univ.party.town_loc;
|
||||
univ.party.horses[univ.party.in_horse].which_town = univ.party.town_num;
|
||||
horse.loc = univ.party.town_loc;
|
||||
horse.which_town = univ.party.town_num;
|
||||
univ.party.in_horse = -1;
|
||||
}
|
||||
}
|
||||
if(univ.party.in_boat >= 0) {
|
||||
// If you pause on a bridge or other passable terrain, leave boat.
|
||||
cVehicle& boat = univ.party.boats[univ.party.in_boat];
|
||||
if(overall_mode == MODE_OUTDOORS && !impassable(univ.out[univ.party.out_loc.x][univ.party.out_loc.y])) {
|
||||
univ.party.boats[univ.party.in_boat].which_town = 200;
|
||||
univ.party.boats[univ.party.in_boat].loc = global_to_local(univ.party.out_loc);
|
||||
univ.party.boats[univ.party.in_boat].sector.x = univ.party.outdoor_corner.x + univ.party.i_w_c.x;
|
||||
univ.party.boats[univ.party.in_boat].sector.y = univ.party.outdoor_corner.y + univ.party.i_w_c.y;
|
||||
boat.which_town = 200;
|
||||
boat.loc = global_to_local(univ.party.out_loc);
|
||||
boat.sector.x = univ.party.outdoor_corner.x + univ.party.i_w_c.x;
|
||||
boat.sector.y = univ.party.outdoor_corner.y + univ.party.i_w_c.y;
|
||||
univ.party.in_boat = -1;
|
||||
} else if(overall_mode == MODE_TOWN && !impassable(univ.town->terrain(univ.party.town_loc.x,univ.party.town_loc.y))) {
|
||||
univ.party.boats[univ.party.in_boat].loc = univ.party.town_loc;
|
||||
univ.party.boats[univ.party.in_boat].which_town = univ.party.town_num;
|
||||
boat.loc = univ.party.town_loc;
|
||||
boat.which_town = univ.party.town_num;
|
||||
univ.party.in_boat = -1;
|
||||
}
|
||||
} else {
|
||||
@@ -639,37 +641,39 @@ static void handle_bash_pick(location destination, bool& did_something, bool& ne
|
||||
}
|
||||
|
||||
static void handle_switch_pc(short which_pc, bool& need_redraw) {
|
||||
cPlayer& pc = univ.party[which_pc];
|
||||
if(!prime_time() && overall_mode != MODE_SHOPPING && overall_mode != MODE_TALKING)
|
||||
add_string_to_buf("Set active: Finish what you're doing first.");
|
||||
else if(is_combat()) {
|
||||
if(univ.party[which_pc].ap > 0) {
|
||||
if(pc.ap > 0) {
|
||||
draw_terrain();
|
||||
univ.cur_pc = which_pc;
|
||||
combat_next_step();
|
||||
set_stat_window_for_pc(univ.cur_pc);
|
||||
put_pc_screen();
|
||||
} else add_string_to_buf("Set active: PC has no APs.");
|
||||
} else if(univ.party[which_pc].main_status != eMainStatus::ALIVE && (overall_mode != MODE_SHOPPING || active_shop.getType() != eShopType::ALLOW_DEAD))
|
||||
} else if(pc.main_status != eMainStatus::ALIVE && (overall_mode != MODE_SHOPPING || active_shop.getType() != eShopType::ALLOW_DEAD))
|
||||
add_string_to_buf("Set active: PC must be here & active.");
|
||||
else {
|
||||
univ.cur_pc = which_pc;
|
||||
set_stat_window_for_pc(which_pc);
|
||||
add_string_to_buf("Now " + std::string(overall_mode == MODE_SHOPPING ? "shopping" : "active") + ": " + univ.party[which_pc].name);
|
||||
add_string_to_buf("Now " + std::string(overall_mode == MODE_SHOPPING ? "shopping" : "active") + ": " + pc.name);
|
||||
adjust_spell_menus();
|
||||
need_redraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_switch_pc_items(short which_pc, bool& need_redraw) {
|
||||
cPlayer& pc = univ.party[which_pc];
|
||||
if(!prime_time() && overall_mode != MODE_TALKING && overall_mode != MODE_SHOPPING)
|
||||
add_string_to_buf("Set active: Finish what you're doing first.");
|
||||
else {
|
||||
if(!is_combat()) {
|
||||
if(univ.party[which_pc].main_status != eMainStatus::ALIVE && (overall_mode != MODE_SHOPPING || active_shop.getType() != eShopType::ALLOW_DEAD))
|
||||
if(pc.main_status != eMainStatus::ALIVE && (overall_mode != MODE_SHOPPING || active_shop.getType() != eShopType::ALLOW_DEAD))
|
||||
add_string_to_buf("Set active: PC must be here & active.");
|
||||
else {
|
||||
univ.cur_pc = which_pc;
|
||||
add_string_to_buf("Now active: " + univ.party[which_pc].name);
|
||||
add_string_to_buf("Now active: " + pc.name);
|
||||
adjust_spell_menus();
|
||||
need_redraw = true;
|
||||
}
|
||||
@@ -740,6 +744,8 @@ static void handle_drop_item(short item_hit, bool& need_redraw) {
|
||||
|
||||
static void handle_item_shop_action(short item_hit) {
|
||||
long i = item_hit - item_sbar->getPosition();
|
||||
cPlayer& shopper = univ.party[stat_window];
|
||||
cItem& target = shopper.items[item_hit];
|
||||
switch(stat_screen_mode) {
|
||||
case MODE_IDENTIFY:
|
||||
if(!take_gold(shop_identify_cost,false))
|
||||
@@ -747,15 +753,15 @@ static void handle_item_shop_action(short item_hit) {
|
||||
else {
|
||||
play_sound(68);
|
||||
ASB("Your item is identified.");
|
||||
univ.party[stat_window].items[item_hit].ident = true;
|
||||
univ.party[stat_window].combine_things();
|
||||
target.ident = true;
|
||||
shopper.combine_things();
|
||||
}
|
||||
break;
|
||||
case MODE_SELL_WEAP: case MODE_SELL_ARMOR: case MODE_SELL_ANY:
|
||||
play_sound(-39);
|
||||
univ.party.gold += store_selling_values[i];
|
||||
ASB("You sell your item.");
|
||||
univ.party[stat_window].take_item(item_hit);
|
||||
shopper.take_item(item_hit);
|
||||
put_item_screen(stat_window);
|
||||
break;
|
||||
case MODE_ENCHANT:
|
||||
@@ -765,7 +771,7 @@ static void handle_item_shop_action(short item_hit) {
|
||||
play_sound(51);
|
||||
ASB("Your item is now enchanted.");
|
||||
eEnchant ench = eEnchant(shop_identify_cost);
|
||||
univ.party[stat_window].items[item_hit].enchant_weapon(ench,store_selling_values[i]);
|
||||
target.enchant_weapon(ench,store_selling_values[i]);
|
||||
}
|
||||
break;
|
||||
case MODE_INVEN: case MODE_SHOP:
|
||||
@@ -783,7 +789,7 @@ static void handle_alchemy(bool& need_redraw, bool& need_reprint) {
|
||||
}
|
||||
|
||||
static void handle_town_wait(bool& need_redraw, bool& need_reprint) {
|
||||
short store_hp[6];
|
||||
std::vector<short> store_hp;
|
||||
sf::Event dummy_evt;
|
||||
need_reprint = true;
|
||||
need_redraw = true;
|
||||
@@ -796,9 +802,9 @@ static void handle_town_wait(bool& need_redraw, bool& need_reprint) {
|
||||
play_sound(-20);
|
||||
draw_rest_screen();
|
||||
pause(10);
|
||||
for(int i = 0; i < 6; i++) {
|
||||
store_hp[i] = univ.party[i].cur_health;
|
||||
univ.party[i].status[eStatus::WEBS] = 0;
|
||||
for(cPlayer& pc : univ.party) {
|
||||
store_hp.push_back(pc.cur_health);
|
||||
pc.status[eStatus::WEBS] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,9 +933,9 @@ static void handle_victory() {
|
||||
}
|
||||
|
||||
static void handle_party_death() {
|
||||
for(int i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::FLED)
|
||||
univ.party[i].main_status = eMainStatus::ALIVE;
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::FLED)
|
||||
pc.main_status = eMainStatus::ALIVE;
|
||||
if(is_combat() && univ.party.is_alive()) {
|
||||
// TODO: Should this only happen in outdoor combat? Or should we allow fleeing town during combat?
|
||||
end_town_mode(0,univ.party.town_loc);
|
||||
@@ -1245,7 +1251,8 @@ bool handle_action(sf::Event event) {
|
||||
for(int i = 0; i < 6; i++)
|
||||
for(auto j : pc_buttons[i].keys())
|
||||
if(pc_area_button_active[i][j] && point_in_area.in(pc_buttons[i][j])) {
|
||||
if((j == PCBTN_HP || j == PCBTN_SP) && !univ.party[i].is_alive())
|
||||
cPlayer& pc = univ.party[i];
|
||||
if((j == PCBTN_HP || j == PCBTN_SP) && !pc.is_alive())
|
||||
break;
|
||||
rectangle button_rect = pc_buttons[i][j];
|
||||
button_rect.offset(pc_win_ul);
|
||||
@@ -1257,14 +1264,14 @@ bool handle_action(sf::Event event) {
|
||||
break;
|
||||
case PCBTN_HP:
|
||||
str.str("");
|
||||
str << univ.party[i].name << " has ";
|
||||
str << univ.party[i].cur_health << " health out of " << univ.party[i].max_health << '.';
|
||||
str << pc.name << " has ";
|
||||
str << pc.cur_health << " health out of " << pc.max_health << '.';
|
||||
add_string_to_buf(str.str());
|
||||
break;
|
||||
case PCBTN_SP:
|
||||
str.str("");
|
||||
str << univ.party[i].name << " has ";
|
||||
str << univ.party[i].cur_health << " spell pts. out of " << univ.party[i].max_health << '.';
|
||||
str << pc.name << " has ";
|
||||
str << pc.cur_health << " spell pts. out of " << pc.max_health << '.';
|
||||
add_string_to_buf(str.str());
|
||||
break;
|
||||
case PCBTN_INFO:
|
||||
@@ -1404,8 +1411,8 @@ bool handle_action(sf::Event event) {
|
||||
if(cartoon_happening) {
|
||||
need_redraw = true;
|
||||
if(!is_combat()) {
|
||||
for(int i = 0; i < 6; i++)
|
||||
univ.party[i].combat_pos = {-1,-1};
|
||||
for(cPlayer& pc : univ.party)
|
||||
pc.combat_pos.x = pc.combat_pos.y = -1;
|
||||
}
|
||||
}
|
||||
fog_lifted = false;
|
||||
@@ -1427,7 +1434,7 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) {
|
||||
play_ambient_sound();
|
||||
|
||||
if(is_combat() && overall_mode != MODE_LOOK_COMBAT) {
|
||||
if(no_pcs_left()) {
|
||||
if(!univ.party.is_alive()) {
|
||||
end_combat();
|
||||
if(which_combat_type == 0) {
|
||||
end_town_mode(0,univ.party.out_loc);
|
||||
@@ -1478,9 +1485,9 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) {
|
||||
}
|
||||
|
||||
bool someone_awake() {
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE &&
|
||||
univ.party[i].status[eStatus::ASLEEP] <= 0 && univ.party[i].status[eStatus::PARALYZED] <= 0)
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE &&
|
||||
pc.status[eStatus::ASLEEP] <= 0 && pc.status[eStatus::PARALYZED] <= 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -1790,14 +1797,13 @@ bool handle_keystroke(sf::Event& event){
|
||||
if(!univ.debug_mode) break;
|
||||
univ.party.gold += 100;
|
||||
univ.party.food += 100;
|
||||
for(short i = 0; i < 6; i++) {
|
||||
univ.party[i].main_status = eMainStatus::ALIVE;
|
||||
univ.party[i].cur_health = univ.party[i].max_health;
|
||||
univ.party[i].cur_sp = 100;
|
||||
for(cPlayer& pc : univ.party) {
|
||||
pc.main_status = eMainStatus::ALIVE;
|
||||
pc.cur_health = pc.max_health;
|
||||
pc.cur_sp = 100;
|
||||
}
|
||||
award_party_xp(25);
|
||||
for(short i = 0; i < 6; i++) {
|
||||
auto& who = univ.party[i];
|
||||
for(cPlayer& who : univ.party) {
|
||||
who.priest_spells.set();
|
||||
who.mage_spells.set();
|
||||
}
|
||||
@@ -1870,9 +1876,9 @@ bool handle_keystroke(sf::Event& event){
|
||||
if(!univ.debug_mode) break;
|
||||
univ.party.gold += 100;
|
||||
univ.party.food += 100;
|
||||
for(short i = 0; i < 6; i++) {
|
||||
if(isDead(univ.party[i].main_status))
|
||||
univ.party[i].main_status = eMainStatus::ALIVE;
|
||||
for(cPlayer& pc : univ.party) {
|
||||
if(isDead(pc.main_status))
|
||||
pc.main_status = eMainStatus::ALIVE;
|
||||
}
|
||||
univ.party.heal(250);
|
||||
univ.party.restore_sp(100);
|
||||
@@ -2252,8 +2258,8 @@ void do_rest(long length, int hp_restore, int mp_restore) {
|
||||
univ.party.status[ePartyStatus::DETECT_LIFE] = 0;
|
||||
univ.party.status[ePartyStatus::FIREWALK] = 0;
|
||||
univ.party.status[ePartyStatus::FLIGHT] = 0; // This one shouldn't be nonzero anyway, since you can't rest while flying.
|
||||
for(int i = 0; i < 6; i++)
|
||||
univ.party[i].status.clear();
|
||||
for(cPlayer& pc : univ.party)
|
||||
pc.status.clear();
|
||||
// Specials countdowns
|
||||
if((length > 500 || age_before / 500 < univ.party.age / 500) && univ.party.has_abil(eItemAbil::OCCASIONAL_STATUS)) {
|
||||
// TODO: There used to be a "display strings" here; should we hook in a special node call?
|
||||
@@ -2364,8 +2370,8 @@ void increase_age() {
|
||||
|
||||
if(is_town() && univ.town->lighting_type != LIGHT_NORMAL) {
|
||||
int radiance = 0;
|
||||
for(int i = 0; i < 6; i++)
|
||||
radiance += univ.party[i].get_prot_level(eItemAbil::RADIANT);
|
||||
for(cPlayer& pc : univ.party)
|
||||
radiance += pc.get_prot_level(eItemAbil::RADIANT);
|
||||
if(radiance > 0 && univ.party.light_level < radiance && get_ran(1,1,10) < radiance) {
|
||||
ASB("One of your items is glowing softly!");
|
||||
univ.party.light_level += radiance * 3;
|
||||
@@ -2397,27 +2403,27 @@ void increase_age() {
|
||||
}
|
||||
|
||||
// Protection, etc.
|
||||
for(short i = 0; i < 6; i++) { // Process some status things, and check if stats updated
|
||||
for(cPlayer& pc : univ.party) { // Process some status things, and check if stats updated
|
||||
|
||||
if(univ.party[i].status[eStatus::INVULNERABLE] == 1 || abs(univ.party[i].status[eStatus::MAGIC_RESISTANCE]) == 1
|
||||
|| univ.party[i].status[eStatus::INVISIBLE] == 1 || univ.party[i].status[eStatus::MARTYRS_SHIELD] == 1
|
||||
|| abs(univ.party[i].status[eStatus::ASLEEP]) == 1 || univ.party[i].status[eStatus::PARALYZED] == 1)
|
||||
move_to_zero(univ.party[i].status[eStatus::INVULNERABLE]);
|
||||
move_to_zero(univ.party[i].status[eStatus::MAGIC_RESISTANCE]);
|
||||
move_to_zero(univ.party[i].status[eStatus::INVISIBLE]);
|
||||
move_to_zero(univ.party[i].status[eStatus::MARTYRS_SHIELD]);
|
||||
move_to_zero(univ.party[i].status[eStatus::ASLEEP]);
|
||||
move_to_zero(univ.party[i].status[eStatus::PARALYZED]);
|
||||
if(univ.party.age % 40 == 0 && univ.party[i].status[eStatus::POISONED_WEAPON] > 0) {
|
||||
move_to_zero(univ.party[i].status[eStatus::POISONED_WEAPON]);
|
||||
if(pc.status[eStatus::INVULNERABLE] == 1 || abs(pc.status[eStatus::MAGIC_RESISTANCE]) == 1
|
||||
|| pc.status[eStatus::INVISIBLE] == 1 || pc.status[eStatus::MARTYRS_SHIELD] == 1
|
||||
|| abs(pc.status[eStatus::ASLEEP]) == 1 || pc.status[eStatus::PARALYZED] == 1)
|
||||
move_to_zero(pc.status[eStatus::INVULNERABLE]);
|
||||
move_to_zero(pc.status[eStatus::MAGIC_RESISTANCE]);
|
||||
move_to_zero(pc.status[eStatus::INVISIBLE]);
|
||||
move_to_zero(pc.status[eStatus::MARTYRS_SHIELD]);
|
||||
move_to_zero(pc.status[eStatus::ASLEEP]);
|
||||
move_to_zero(pc.status[eStatus::PARALYZED]);
|
||||
if(univ.party.age % 40 == 0 && pc.status[eStatus::POISONED_WEAPON] > 0) {
|
||||
move_to_zero(pc.status[eStatus::POISONED_WEAPON]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Food
|
||||
if((univ.party.age % 1000 == 0) && (overall_mode < MODE_COMBAT)) {
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
how_many_short++;
|
||||
how_many_short = take_food (how_many_short,false);
|
||||
if(how_many_short > 0) {
|
||||
@@ -2435,24 +2441,24 @@ void increase_age() {
|
||||
}
|
||||
|
||||
// Poison, acid, disease damage
|
||||
for(short i = 0; i < 6; i++) // Poison
|
||||
if(univ.party[i].status[eStatus::POISON] > 0) {
|
||||
i = 6;
|
||||
for(cPlayer& pc : univ.party) // Poison
|
||||
if(pc.status[eStatus::POISON] > 0) {
|
||||
if(((overall_mode == MODE_OUTDOORS) && (univ.party.age % 50 == 0)) || ((overall_mode == MODE_TOWN) && (univ.party.age % 20 == 0))) {
|
||||
do_poison();
|
||||
}
|
||||
break;
|
||||
}
|
||||
for(short i = 0; i < 6; i++) // Disease
|
||||
if(univ.party[i].status[eStatus::DISEASE] > 0) {
|
||||
i = 6;
|
||||
for(cPlayer& pc : univ.party) // Disease
|
||||
if(pc.status[eStatus::DISEASE] > 0) {
|
||||
if(((overall_mode == MODE_OUTDOORS) && (univ.party.age % 100 == 0)) || ((overall_mode == MODE_TOWN) && (univ.party.age % 25 == 0))) {
|
||||
handle_disease();
|
||||
}
|
||||
break;
|
||||
}
|
||||
for(short i = 0; i < 6; i++) // Acid
|
||||
if(univ.party[i].status[eStatus::ACID] > 0) {
|
||||
i = 6;
|
||||
for(cPlayer& pc : univ.party) // Acid
|
||||
if(pc.status[eStatus::ACID] > 0) {
|
||||
handle_acid();
|
||||
break;
|
||||
}
|
||||
|
||||
// Healing and restoration of spell pts.
|
||||
@@ -2463,40 +2469,40 @@ void increase_age() {
|
||||
}
|
||||
else {
|
||||
if(univ.party.age % 50 == 0) {
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].cur_health > univ.party[i].max_health)
|
||||
univ.party[i].cur_health--; // Bonus HP wears off
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE && pc.cur_health > pc.max_health)
|
||||
pc.cur_health--; // Bonus HP wears off
|
||||
univ.party.heal(1);
|
||||
}
|
||||
}
|
||||
if(is_out()) {
|
||||
if(univ.party.age % 80 == 0) {
|
||||
univ.party.restore_sp(2);
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].status[eStatus::DUMB] < 0)
|
||||
univ.party[i].status[eStatus::DUMB]++;
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.status[eStatus::DUMB] < 0)
|
||||
pc.status[eStatus::DUMB]++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(univ.party.age % 40 == 0) {
|
||||
for(short i = 0; i < 6; i++) {
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].cur_sp > univ.party[i].max_sp)
|
||||
univ.party[i].cur_sp--; // Bonus SP wears off
|
||||
if(univ.party[i].status[eStatus::DUMB] < 0)
|
||||
univ.party[i].status[eStatus::DUMB]++;
|
||||
for(cPlayer& pc : univ.party) {
|
||||
if(pc.main_status == eMainStatus::ALIVE && pc.cur_sp > pc.max_sp)
|
||||
pc.cur_sp--; // Bonus SP wears off
|
||||
if(pc.status[eStatus::DUMB] < 0)
|
||||
pc.status[eStatus::DUMB]++;
|
||||
}
|
||||
univ.party.restore_sp(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Recuperation and chronic disease disads
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE) {
|
||||
if(univ.party[i].traits[eTrait::RECUPERATION] && get_ran(1,0,10) == 1 && univ.party[i].cur_health < univ.party[i].max_health) {
|
||||
univ.party[i].heal(2);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE) {
|
||||
if(pc.traits[eTrait::RECUPERATION] && get_ran(1,0,10) == 1 && pc.cur_health < pc.max_health) {
|
||||
pc.heal(2);
|
||||
}
|
||||
if(univ.party[i].traits[eTrait::CHRONIC_DISEASE] && get_ran(1,0,110) == 1) {
|
||||
univ.party[i].disease(4);
|
||||
if(pc.traits[eTrait::CHRONIC_DISEASE] && get_ran(1,0,110) == 1) {
|
||||
pc.disease(4);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2553,10 +2559,10 @@ void handle_hunting() {
|
||||
if(trait == eTrait::PACIFIST)
|
||||
return;
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
if(univ.party[i].is_alive() && univ.party[i].traits[trait] && get_ran(1,0,12) == 5) {
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.is_alive() && pc.traits[trait] && get_ran(1,0,12) == 5) {
|
||||
univ.party.food += get_ran(univ.scenario.ter_types[ter].flag1,1,6);
|
||||
add_string_to_buf(univ.party[i].name + "hunts.");
|
||||
add_string_to_buf(pc.name + "hunts.");
|
||||
put_pc_screen();
|
||||
}
|
||||
}
|
||||
@@ -2673,9 +2679,9 @@ void start_new_game(bool force) {
|
||||
}
|
||||
|
||||
// everyone gets a weapon
|
||||
for(short i = 0; i < 6; i++) {
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE) {
|
||||
univ.party[i].finish_create();
|
||||
for(cPlayer& pc : univ.party) {
|
||||
if(pc.main_status == eMainStatus::ALIVE) {
|
||||
pc.finish_create();
|
||||
}
|
||||
}
|
||||
party_in_memory = true;
|
||||
@@ -3112,8 +3118,8 @@ bool town_move_party(location destination,short forced) {
|
||||
|
||||
|
||||
bool someone_poisoned() {
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE && (univ.party[i].status[eStatus::POISON] > 0))
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE && (pc.status[eStatus::POISON] > 0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@@ -298,23 +298,21 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu
|
||||
}
|
||||
|
||||
// place PCs
|
||||
univ.party[0].combat_pos = out_start_loc;
|
||||
update_explored(univ.party[0].combat_pos);
|
||||
if(get_blockage(univ.town->terrain(univ.party[0].combat_pos.x,univ.party[0].combat_pos.y)) > 0)
|
||||
univ.town->terrain(univ.party[0].combat_pos.x,univ.party[0].combat_pos.y) = univ.town->terrain(0,0);
|
||||
for(short i = 1; i < 6; i++) {
|
||||
univ.party[i].combat_pos = univ.party[0].combat_pos;
|
||||
univ.party[i].combat_pos.x = univ.party[i].combat_pos.x + hor_vert_place[i].x;
|
||||
univ.party[i].combat_pos.y = univ.party[i].combat_pos.y + hor_vert_place[i].y;
|
||||
if(get_blockage(univ.town->terrain(univ.party[i].combat_pos.x,univ.party[i].combat_pos.y)) > 0)
|
||||
univ.town->terrain(univ.party[i].combat_pos.x,univ.party[i].combat_pos.y) = univ.town->terrain(0,0);
|
||||
update_explored(univ.party[i].combat_pos);
|
||||
int pc_num = 0;
|
||||
for(cPlayer& pc : univ.party) {
|
||||
pc.combat_pos = out_start_loc;
|
||||
pc.combat_pos.x = pc.combat_pos.x + hor_vert_place[pc_num].x;
|
||||
pc.combat_pos.y = pc.combat_pos.y + hor_vert_place[pc_num].y;
|
||||
if(get_blockage(univ.town->terrain(pc.combat_pos.x,pc.combat_pos.y)) > 0)
|
||||
univ.town->terrain(pc.combat_pos.x,pc.combat_pos.y) = univ.town->terrain(0,0);
|
||||
update_explored(pc.combat_pos);
|
||||
|
||||
univ.party[i].status[eStatus::POISONED_WEAPON] = 0;
|
||||
univ.party[i].status[eStatus::BLESS_CURSE] = 0;
|
||||
univ.party[i].status[eStatus::HASTE_SLOW] = 0;
|
||||
univ.party[i].status[eStatus::INVULNERABLE] = 0;
|
||||
univ.party[i].status[eStatus::MAGIC_RESISTANCE] = 0;
|
||||
pc.status[eStatus::POISONED_WEAPON] = 0;
|
||||
pc.status[eStatus::BLESS_CURSE] = 0;
|
||||
pc.status[eStatus::HASTE_SLOW] = 0;
|
||||
pc.status[eStatus::INVULNERABLE] = 0;
|
||||
pc.status[eStatus::MAGIC_RESISTANCE] = 0;
|
||||
pc_num++;
|
||||
}
|
||||
|
||||
// place monsters, w. friendly monsts landing near PCs
|
||||
@@ -350,9 +348,9 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
univ.town.monst[i].target = 6;
|
||||
|
||||
for(short i = 0; i < 6; i++) {
|
||||
univ.party[i].parry = 0;
|
||||
univ.party[i].last_attacked = nullptr;
|
||||
for(cPlayer& pc : univ.party) {
|
||||
pc.parry = 0;
|
||||
pc.last_attacked = nullptr;
|
||||
}
|
||||
|
||||
univ.town.items.clear();
|
||||
@@ -561,7 +559,7 @@ void pc_attack(short who_att,iLiving* target) {
|
||||
combat_posing_monster = current_working_monster = who_att;
|
||||
|
||||
if(!weap1) {
|
||||
std::string create_line = univ.party[who_att].name + " punches.";
|
||||
std::string create_line = attacker.name + " punches.";
|
||||
add_string_to_buf(create_line);
|
||||
|
||||
r1 = get_ran(1,1,100) + hit_adj - 20;
|
||||
@@ -591,7 +589,7 @@ void pc_attack(short who_att,iLiving* target) {
|
||||
if(cCreature* m_target = dynamic_cast<cCreature*>(target))
|
||||
damage_monst(*m_target, who_att, r2, type,4);
|
||||
else if(cPlayer* pc_target = dynamic_cast<cPlayer*>(target))
|
||||
damage_pc(*pc_target, r2, type, univ.party[who_att].race, 4);
|
||||
damage_pc(*pc_target, r2, type, attacker.race, 4);
|
||||
}
|
||||
else {
|
||||
draw_terrain(2);
|
||||
@@ -873,7 +871,7 @@ void pc_attack_weapon(short who_att,iLiving& target,short hit_adj,short dam_adj,
|
||||
}
|
||||
else {
|
||||
draw_terrain(2);
|
||||
create_line = " " + univ.party[who_att].name + " misses.";
|
||||
create_line = " " + attacker.name + " misses.";
|
||||
add_string_to_buf(create_line);
|
||||
if(weap.weap_type == eSkill::POLE_WEAPONS)
|
||||
play_sound(19);
|
||||
@@ -1521,7 +1519,7 @@ void do_combat_cast(location target) {
|
||||
add_string_to_buf(" Monster resisted.");
|
||||
else {
|
||||
r1 = get_ran((spell_being_cast == eSpell::TURN_UNDEAD) ? 2 : 6, 1, 14);
|
||||
if(univ.party[spell_caster].traits[eTrait::ANAMA])
|
||||
if(caster.traits[eTrait::ANAMA])
|
||||
r1 += 15;
|
||||
if(cur_monst != nullptr)
|
||||
damage_monst(*cur_monst, univ.cur_pc, r1, eDamageType::UNBLOCKABLE, 0);
|
||||
@@ -1548,9 +1546,9 @@ void do_combat_cast(location target) {
|
||||
add_string_to_buf(" Demon resisted.");
|
||||
else {
|
||||
r1 = get_ran(8 + bonus * 2, 1, 11);
|
||||
if(univ.party[spell_caster].status[eStatus::DUMB] < 0)
|
||||
r1 += -25 * univ.party[spell_caster].status[eStatus::DUMB] / 3;
|
||||
else if(univ.party[spell_caster].traits[eTrait::ANAMA])
|
||||
if(caster.status[eStatus::DUMB] < 0)
|
||||
r1 += -25 * caster.status[eStatus::DUMB] / 3;
|
||||
else if(caster.traits[eTrait::ANAMA])
|
||||
r1 += 25;
|
||||
if(cur_monst != nullptr)
|
||||
damage_monst(*cur_monst, univ.cur_pc, r1, eDamageType::UNBLOCKABLE, 0);
|
||||
@@ -1601,10 +1599,10 @@ void do_combat_cast(location target) {
|
||||
}
|
||||
|
||||
void handle_marked_damage() {
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].marked_damage > 0) {
|
||||
damage_pc(univ.party[i],univ.party[i].marked_damage,eDamageType::MARKED,eRace::UNKNOWN,0);
|
||||
univ.party[i].marked_damage = 0;
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.marked_damage > 0) {
|
||||
damage_pc(pc,pc.marked_damage,eDamageType::MARKED,eRace::UNKNOWN,0);
|
||||
pc.marked_damage = 0;
|
||||
}
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if(univ.town.monst[i].marked_damage > 0) {
|
||||
@@ -1909,8 +1907,7 @@ static bool sync_force_cages() {
|
||||
bool was_change = false;
|
||||
// This goes through the list of creatures and places forcecage barriers on any spaces containing someone with forcecage status.
|
||||
// If anyone is on a forcecage barrier but doesn't have forcecage status, they are given it.
|
||||
for(int i = 0; i < 6; i++) {
|
||||
cPlayer& who = univ.party[i];
|
||||
for(cPlayer& who : univ.party) {
|
||||
location loc = who.get_loc();
|
||||
if(who.status[eStatus::FORCECAGE] > 0) {
|
||||
was_change = true;
|
||||
@@ -2038,8 +2035,8 @@ void combat_run_monst() {
|
||||
|
||||
if(is_town() && univ.town->lighting_type != LIGHT_NORMAL) {
|
||||
int radiance = 0;
|
||||
for(int i = 0; i < 6; i++)
|
||||
radiance += univ.party[i].get_prot_level(eItemAbil::RADIANT);
|
||||
for(cPlayer& pc : univ.party)
|
||||
radiance += pc.get_prot_level(eItemAbil::RADIANT);
|
||||
if(radiance > 0 && univ.party.light_level < radiance && get_ran(1,1,10) < radiance) {
|
||||
ASB("One of your items is glowing softly!");
|
||||
univ.party.light_level += radiance * 3;
|
||||
@@ -2743,8 +2740,8 @@ void do_monster_turn() {
|
||||
center = univ.party.town_loc;
|
||||
if(had_monst)
|
||||
put_pc_screen();
|
||||
for(short i = 0; i < 6; i++)
|
||||
univ.party[i].parry = 0;
|
||||
for(cPlayer& pc : univ.party)
|
||||
pc.parry = 0;
|
||||
|
||||
monsters_going = false;
|
||||
}
|
||||
@@ -3126,10 +3123,11 @@ void monst_fire_missile(short m_num,short bless,std::pair<eMonstAbil,uAbility> a
|
||||
// TODO: What if it's a monster with no sp?
|
||||
for(short i = 0; i < 8; i++) {
|
||||
int j = get_ran(1,0,5);
|
||||
if(univ.party[j].main_status == eMainStatus::ALIVE && univ.party[j].cur_sp > 4 &&
|
||||
(can_see_light(source,univ.party[j].combat_pos,sight_obscurity) < 5) && (dist(source,univ.party[j].combat_pos) <= 8)) {
|
||||
target = &univ.party[j];
|
||||
targ_space = univ.party[j].combat_pos;
|
||||
cPlayer& pc = univ.party[j];
|
||||
if(pc.main_status == eMainStatus::ALIVE && pc.cur_sp > 4 &&
|
||||
(can_see_light(source,pc.combat_pos,sight_obscurity) < 5) && (dist(source,pc.combat_pos) <= 8)) {
|
||||
target = &pc;
|
||||
targ_space = pc.combat_pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4034,10 +4032,10 @@ location find_fireball_loc(location where,short radius,short mode,short *m) {
|
||||
location closest_pc_loc(location where) {
|
||||
location pc_where(120,120);
|
||||
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if((dist(where,univ.party[i].combat_pos)) < (dist(where,pc_where)))
|
||||
pc_where = univ.party[i].combat_pos;
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if((dist(where,pc.combat_pos)) < (dist(where,pc_where)))
|
||||
pc_where = pc.combat_pos;
|
||||
return pc_where;
|
||||
}
|
||||
|
||||
@@ -4064,12 +4062,13 @@ short count_levels(location where,short radius) {
|
||||
|
||||
bool pc_near(short pc_num,location where,short radius) {
|
||||
// Assuming not looking
|
||||
cPlayer& pc = univ.party[pc_num];
|
||||
if(overall_mode >= MODE_COMBAT) {
|
||||
if(univ.party[pc_num].main_status == eMainStatus::ALIVE && vdist(univ.party[pc_num].combat_pos,where) <= radius)
|
||||
if(pc.main_status == eMainStatus::ALIVE && vdist(pc.combat_pos,where) <= radius)
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
if(univ.party[pc_num].main_status == eMainStatus::ALIVE && vdist(univ.party.town_loc,where) <= radius)
|
||||
if(pc.main_status == eMainStatus::ALIVE && vdist(univ.party.town_loc,where) <= radius)
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
@@ -4208,35 +4207,35 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho
|
||||
fast_bang = 2;
|
||||
|
||||
// Damage to pcs
|
||||
for(short k = 0; k < 6; k++)
|
||||
for(cPlayer& pc : univ.party)
|
||||
for(short i = minmax(0,univ.town->max_dim - 1,center.x - 4); i <= minmax(0,univ.town->max_dim - 1,center.x + 4); i++)
|
||||
for(short j = minmax(0,univ.town->max_dim - 1,center.y - 4); j <= minmax(0,univ.town->max_dim - 1,center.y + 4); j++) {
|
||||
spot_hit.x = i;
|
||||
spot_hit.y = j;
|
||||
if(sight_obscurity(i,j) < 5 && univ.party[k].main_status == eMainStatus::ALIVE
|
||||
&& (((is_combat()) && (univ.party[k].combat_pos == spot_hit)) ||
|
||||
if(sight_obscurity(i,j) < 5 && pc.main_status == eMainStatus::ALIVE
|
||||
&& (((is_combat()) && (pc.combat_pos == spot_hit)) ||
|
||||
((is_town()) && (univ.party.town_loc == spot_hit)))) {
|
||||
effect = pat.pattern[i - center.x + 4][j - center.y + 4];
|
||||
switch(effect) {
|
||||
case WALL_FORCE:
|
||||
r1 = get_ran(2,1,6);
|
||||
damage_pc(univ.party[k],r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
break;
|
||||
case WALL_FIRE:
|
||||
r1 = get_ran(1,1,6) + 1;
|
||||
damage_pc(univ.party[k],r1,eDamageType::FIRE,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::FIRE,eRace::UNKNOWN,0);
|
||||
break;
|
||||
case WALL_ICE:
|
||||
r1 = get_ran(2,1,6);
|
||||
damage_pc(univ.party[k],r1,eDamageType::COLD,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::COLD,eRace::UNKNOWN,0);
|
||||
break;
|
||||
case WALL_BLADES:
|
||||
r1 = get_ran(4,1,8);
|
||||
damage_pc(univ.party[k],r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
break;
|
||||
case OBJECT_BLOCK:
|
||||
r1 = get_ran(6,1,8);
|
||||
damage_pc(univ.party[k],r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
break;
|
||||
default:
|
||||
eDamageType type = eDamageType::MARKED;
|
||||
@@ -4272,7 +4271,7 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho
|
||||
}
|
||||
if(type == eDamageType::MARKED) break;
|
||||
r1 = get_ran(dice,1,6);
|
||||
damage_pc(univ.party[k],r1,type,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,type,eRace::UNKNOWN,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4414,10 +4413,10 @@ void modify_pattern(effect_pat_type *pat,unsigned short type) {
|
||||
|
||||
void do_shockwave(location target) {
|
||||
start_missile_anim();
|
||||
for(short i = 0; i < 6; i++)
|
||||
if((dist(target,univ.party[i].combat_pos) > 0) && (dist(target,univ.party[i].combat_pos) < 11)
|
||||
&& univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
damage_pc(univ.party[i], get_ran(2 + dist(target,univ.party[i].combat_pos) / 2, 1, 6), eDamageType::UNBLOCKABLE,eRace::UNKNOWN,0);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if((dist(target,pc.combat_pos) > 0) && (dist(target,pc.combat_pos) < 11)
|
||||
&& pc.main_status == eMainStatus::ALIVE)
|
||||
damage_pc(pc, get_ran(2 + dist(target,pc.combat_pos) / 2, 1, 6), eDamageType::UNBLOCKABLE,eRace::UNKNOWN,0);
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if((univ.town.monst[i].active != 0) && (dist(target,univ.town.monst[i].cur_loc) > 0)
|
||||
&& (dist(target,univ.town.monst[i].cur_loc) < 11)
|
||||
@@ -4431,10 +4430,10 @@ void do_shockwave(location target) {
|
||||
void radius_damage(location target,short radius, short dam, eDamageType type) {
|
||||
// TODO: Why no booms in town mode?
|
||||
if(is_town()) {
|
||||
for(short i = 0; i < 6; i++)
|
||||
for(cPlayer& pc : univ.party)
|
||||
if((dist(target,univ.party.town_loc) > 0) && (dist(target,univ.party.town_loc) <= radius)
|
||||
&& univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
damage_pc(univ.party[i], dam, type,eRace::UNKNOWN,0);
|
||||
&& pc.main_status == eMainStatus::ALIVE)
|
||||
damage_pc(pc, dam, type,eRace::UNKNOWN,0);
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if((univ.town.monst[i].active != 0) && (dist(target,univ.town.monst[i].cur_loc) > 0)
|
||||
&& (dist(target,univ.town.monst[i].cur_loc) <= radius)
|
||||
@@ -4444,10 +4443,10 @@ void radius_damage(location target,short radius, short dam, eDamageType type) {
|
||||
}
|
||||
|
||||
start_missile_anim();
|
||||
for(short i = 0; i < 6; i++)
|
||||
if((dist(target,univ.party[i].combat_pos) > 0) && (dist(target,univ.party[i].combat_pos) <= radius)
|
||||
&& univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
damage_pc(univ.party[i], dam, type,eRace::UNKNOWN,0);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if((dist(target,pc.combat_pos) > 0) && (dist(target,pc.combat_pos) <= radius)
|
||||
&& pc.main_status == eMainStatus::ALIVE)
|
||||
damage_pc(pc, dam, type,eRace::UNKNOWN,0);
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if((univ.town.monst[i].active != 0) && (dist(target,univ.town.monst[i].cur_loc) > 0)
|
||||
&& (dist(target,univ.town.monst[i].cur_loc) <= radius)
|
||||
@@ -4496,10 +4495,10 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit
|
||||
}
|
||||
|
||||
if(overall_mode >= MODE_COMBAT)
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE && !stop_hitting)
|
||||
if(univ.party[i].combat_pos == target) {
|
||||
damage_pc(univ.party[i],dam,type,eRace::UNKNOWN,0);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE && !stop_hitting)
|
||||
if(pc.combat_pos == target) {
|
||||
damage_pc(pc,dam,type,eRace::UNKNOWN,0);
|
||||
stop_hitting = (hit_all == 1) ? false : true;
|
||||
}
|
||||
if(overall_mode < MODE_COMBAT)
|
||||
@@ -4521,22 +4520,22 @@ void do_poison() {
|
||||
short r1 = 0;
|
||||
bool some_poison = false;
|
||||
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if(univ.party[i].status[eStatus::POISON] > 0)
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.status[eStatus::POISON] > 0)
|
||||
some_poison = true;
|
||||
if(some_poison) {
|
||||
add_string_to_buf("Poison:");
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if(univ.party[i].status[eStatus::POISON] > 0) {
|
||||
r1 = get_ran(univ.party[i].status[eStatus::POISON],1,6);
|
||||
damage_pc(univ.party[i],r1,eDamageType::POISON,eRace::UNKNOWN,0);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.status[eStatus::POISON] > 0) {
|
||||
r1 = get_ran(pc.status[eStatus::POISON],1,6);
|
||||
damage_pc(pc,r1,eDamageType::POISON,eRace::UNKNOWN,0);
|
||||
if(get_ran(1,0,8) < 6)
|
||||
move_to_zero(univ.party[i].status[eStatus::POISON]);
|
||||
move_to_zero(pc.status[eStatus::POISON]);
|
||||
if(get_ran(1,0,8) < 6)
|
||||
if(univ.party[i].traits[eTrait::GOOD_CONST])
|
||||
move_to_zero(univ.party[i].status[eStatus::POISON]);
|
||||
if(pc.traits[eTrait::GOOD_CONST])
|
||||
move_to_zero(pc.status[eStatus::POISON]);
|
||||
// TODO: Shouldn't the above two conditionals be swapped?
|
||||
}
|
||||
put_pc_screen();
|
||||
@@ -4593,45 +4592,33 @@ void handle_acid() {
|
||||
short r1 = 0;
|
||||
bool some_acid = false;
|
||||
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if(univ.party[i].status[eStatus::ACID] > 0)
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.status[eStatus::ACID] > 0)
|
||||
some_acid = true;
|
||||
|
||||
if(some_acid) {
|
||||
add_string_to_buf("Acid:");
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if(univ.party[i].status[eStatus::ACID] > 0) {
|
||||
r1 = get_ran(univ.party[i].status[eStatus::ACID],1,6);
|
||||
damage_pc(univ.party[i],r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
move_to_zero(univ.party[i].status[eStatus::ACID]);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.status[eStatus::ACID] > 0) {
|
||||
r1 = get_ran(pc.status[eStatus::ACID],1,6);
|
||||
damage_pc(pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
move_to_zero(pc.status[eStatus::ACID]);
|
||||
}
|
||||
if(overall_mode < MODE_COMBAT)
|
||||
boom_space(univ.party.out_loc,overall_mode,3,r1,8);
|
||||
}
|
||||
}
|
||||
|
||||
bool no_pcs_left() {
|
||||
short i = 0;
|
||||
|
||||
while(i < 6) {
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
return false;
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool hit_end_c_button() {
|
||||
bool end_ok = true;
|
||||
|
||||
if(which_combat_type == 0) {
|
||||
end_ok = out_monst_all_dead();
|
||||
}
|
||||
for(int i = 0; i < 6; i++) {
|
||||
if(univ.party[i].status[eStatus::FORCECAGE] > 0) {
|
||||
for(cPlayer& pc : univ.party) {
|
||||
if(pc.status[eStatus::FORCECAGE] > 0) {
|
||||
add_string_to_buf(" Someone trapped.");
|
||||
return false;
|
||||
}
|
||||
@@ -4653,13 +4640,13 @@ bool out_monst_all_dead() {
|
||||
}
|
||||
|
||||
void end_combat() {
|
||||
for(short i = 0; i < 6; i++) {
|
||||
if(univ.party[i].main_status == eMainStatus::FLED)
|
||||
univ.party[i].main_status = eMainStatus::ALIVE;
|
||||
univ.party[i].status[eStatus::POISONED_WEAPON] = 0;
|
||||
univ.party[i].status[eStatus::BLESS_CURSE] = 0;
|
||||
univ.party[i].status[eStatus::HASTE_SLOW] = 0;
|
||||
univ.party[i].combat_pos = {-1,-1};
|
||||
for(cPlayer& pc : univ.party) {
|
||||
if(pc.main_status == eMainStatus::FLED)
|
||||
pc.main_status = eMainStatus::ALIVE;
|
||||
pc.status[eStatus::POISONED_WEAPON] = 0;
|
||||
pc.status[eStatus::BLESS_CURSE] = 0;
|
||||
pc.status[eStatus::HASTE_SLOW] = 0;
|
||||
pc.combat_pos = {-1,-1};
|
||||
}
|
||||
if(which_combat_type == 0) {
|
||||
overall_mode = MODE_OUTDOORS;
|
||||
@@ -4759,28 +4746,30 @@ void combat_immed_mage_cast(short current_pc, eSpell spell_num, bool freebie) {
|
||||
short target, num_opp = 0, r1;
|
||||
snd_num_t store_sound = 0;
|
||||
miss_num_t store_m_type = 0;
|
||||
short bonus = freebie ? 1 : univ.party[current_pc].stat_adj(eSkill::INTELLIGENCE);
|
||||
short level = freebie ? store_item_spell_level : univ.party[current_pc].level;
|
||||
if(!freebie && (*spell_num).level <= univ.party[current_pc].get_prot_level(eItemAbil::MAGERY))
|
||||
cPlayer& caster = univ.party[current_pc];
|
||||
short bonus = freebie ? 1 : caster.stat_adj(eSkill::INTELLIGENCE);
|
||||
short level = freebie ? store_item_spell_level : caster.level;
|
||||
if(!freebie && (*spell_num).level <= caster.get_prot_level(eItemAbil::MAGERY))
|
||||
level++;
|
||||
cCreature* which_m;
|
||||
start_missile_anim();
|
||||
switch(spell_num) {
|
||||
case eSpell::SHOCKWAVE:
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
add_string_to_buf(" The ground shakes!");
|
||||
do_shockwave(univ.party[current_pc].combat_pos);
|
||||
do_shockwave(caster.combat_pos);
|
||||
break;
|
||||
|
||||
case eSpell::HASTE_MINOR: case eSpell::HASTE: case eSpell::STRENGTH: case eSpell::ENVENOM: case eSpell::RESIST_MAGIC:
|
||||
// target = select_pc(11,0);
|
||||
target = store_spell_target;
|
||||
if(target < 6) {
|
||||
cPlayer& target_pc = univ.party[target];
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
play_sound(4);
|
||||
std::string c_line = " " + univ.party[target].name;
|
||||
std::string c_line = " " + target_pc.name;
|
||||
switch(spell_num) {
|
||||
case eSpell::ENVENOM:
|
||||
c_line += " receives venom.";
|
||||
@@ -4790,30 +4779,30 @@ void combat_immed_mage_cast(short current_pc, eSpell spell_num, bool freebie) {
|
||||
|
||||
case eSpell::STRENGTH:
|
||||
c_line += " stronger.";
|
||||
univ.party[target].curse(-3);
|
||||
target_pc.curse(-3);
|
||||
store_m_type = 8;
|
||||
break;
|
||||
case eSpell::RESIST_MAGIC:
|
||||
c_line += " resistant.";
|
||||
univ.party[target].status[eStatus::MAGIC_RESISTANCE] += 5 + bonus;
|
||||
target_pc.status[eStatus::MAGIC_RESISTANCE] += 5 + bonus;
|
||||
store_m_type = 15;
|
||||
break;
|
||||
|
||||
default:
|
||||
univ.party[target].slow((spell_num == eSpell::HASTE_MINOR) ? -2 : -max(2,level / 2 + bonus));
|
||||
target_pc.slow((spell_num == eSpell::HASTE_MINOR) ? -2 : -max(2,level / 2 + bonus));
|
||||
c_line += " hasted.";
|
||||
store_m_type = 8;
|
||||
break;
|
||||
}
|
||||
add_string_to_buf(c_line);
|
||||
add_missile(univ.party[target].combat_pos,store_m_type,0,0,0);
|
||||
add_missile(target_pc.combat_pos,store_m_type,0,0,0);
|
||||
}
|
||||
break;
|
||||
|
||||
case eSpell::HASTE_MAJOR: case eSpell::BLESS_MAJOR:
|
||||
store_sound = 25;
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
|
||||
|
||||
for(short i = 0; i < 6; i++)
|
||||
@@ -4838,7 +4827,7 @@ void combat_immed_mage_cast(short current_pc, eSpell spell_num, bool freebie) {
|
||||
|
||||
case eSpell::SLOW_GROUP: case eSpell::FEAR_GROUP: case eSpell::PARALYSIS_MASS: case eSpell::SLEEP_MASS:
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
store_sound = 25;
|
||||
if(spell_num == eSpell::FEAR_GROUP)
|
||||
store_sound = 54;
|
||||
@@ -4854,8 +4843,8 @@ void combat_immed_mage_cast(short current_pc, eSpell spell_num, bool freebie) {
|
||||
}
|
||||
for(short i = 0; i < univ.town.monst.size(); i++) {
|
||||
if(univ.town.monst[i].active != 0 && !univ.town.monst[i].is_friendly()
|
||||
&& (dist(univ.party[current_pc].combat_pos,univ.town.monst[i].cur_loc) <= (*spell_num).range)
|
||||
&& (can_see_light(univ.party[current_pc].combat_pos,univ.town.monst[i].cur_loc,sight_obscurity) < 5)) {
|
||||
&& (dist(caster.combat_pos,univ.town.monst[i].cur_loc) <= (*spell_num).range)
|
||||
&& (can_see_light(caster.combat_pos,univ.town.monst[i].cur_loc,sight_obscurity) < 5)) {
|
||||
which_m = &univ.town.monst[i];
|
||||
switch(spell_num) {
|
||||
case eSpell::FEAR_GROUP:
|
||||
@@ -4888,17 +4877,17 @@ void combat_immed_mage_cast(short current_pc, eSpell spell_num, bool freebie) {
|
||||
break;
|
||||
|
||||
case eSpell::BLADE_AURA: // Pyhrrus effect
|
||||
place_spell_pattern(radius2,univ.party[current_pc].combat_pos,WALL_BLADES,6);
|
||||
place_spell_pattern(radius2,caster.combat_pos,WALL_BLADES,6);
|
||||
break;
|
||||
case eSpell::FLAME_AURA:
|
||||
place_spell_pattern(open_square, univ.party[current_pc].combat_pos, eDamageType::FIRE, 6, current_pc);
|
||||
place_spell_pattern(open_square, caster.combat_pos, eDamageType::FIRE, 6, current_pc);
|
||||
break;
|
||||
default:
|
||||
add_string_to_buf(" Error: Mage spell " + (*spell_num).name() + " not implemented for combat mode.", 4);
|
||||
break;
|
||||
}
|
||||
if(num_opp < 10)
|
||||
do_missile_anim((num_opp < 5) ? 50 : 25,univ.party[current_pc].combat_pos,store_sound);
|
||||
do_missile_anim((num_opp < 5) ? 50 : 25,caster.combat_pos,store_sound);
|
||||
else play_sound(store_sound);
|
||||
end_missile_anim();
|
||||
}
|
||||
@@ -4969,9 +4958,10 @@ void combat_immed_priest_cast(short current_pc, eSpell spell_num, bool freebie)
|
||||
short target = store_spell_target,num_opp = 0;
|
||||
snd_num_t store_sound = 0;
|
||||
miss_num_t store_m_type = 0;
|
||||
short bonus = freebie ? 1 : univ.party[current_pc].stat_adj(eSkill::INTELLIGENCE);
|
||||
short level = freebie ? store_item_spell_level : univ.party[current_pc].level;
|
||||
if(!freebie && univ.party[current_pc].traits[eTrait::ANAMA])
|
||||
cPlayer& caster = univ.party[current_pc];
|
||||
short bonus = freebie ? 1 : caster.stat_adj(eSkill::INTELLIGENCE);
|
||||
short level = freebie ? store_item_spell_level : caster.level;
|
||||
if(!freebie && caster.traits[eTrait::ANAMA])
|
||||
level++;
|
||||
cCreature *which_m;
|
||||
effect_pat_type protect_pat = {{
|
||||
@@ -4991,7 +4981,7 @@ void combat_immed_priest_cast(short current_pc, eSpell spell_num, bool freebie)
|
||||
if(target < 6) {
|
||||
store_sound = 4;
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
univ.party[target].curse(-(spell_num==eSpell::BLESS_MINOR ? 2 : max(2,(level * 3) / 4 + 1 + bonus)));
|
||||
add_missile(univ.party[target].combat_pos,8,0,0,0);
|
||||
}
|
||||
@@ -4999,31 +4989,31 @@ void combat_immed_priest_cast(short current_pc, eSpell spell_num, bool freebie)
|
||||
|
||||
case eSpell::BLESS_PARTY:
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE) {
|
||||
univ.party[i].curse(-(level / 3));
|
||||
add_missile(univ.party[i].combat_pos,8,0,0,0);
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE) {
|
||||
pc.curse(-(level / 3));
|
||||
add_missile(pc.combat_pos,8,0,0,0);
|
||||
}
|
||||
store_sound = 4;
|
||||
break;
|
||||
|
||||
case eSpell::AVATAR:
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
add_string_to_buf(" " + univ.party[current_pc].name + " is an avatar!");
|
||||
univ.party[current_pc].avatar();
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
add_string_to_buf(" " + caster.name + " is an avatar!");
|
||||
caster.avatar();
|
||||
break;
|
||||
|
||||
case eSpell::CURSE_ALL: case eSpell::CHARM_MASS: case eSpell::PESTILENCE:
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
store_sound = 24;
|
||||
for(short i = 0; i < univ.town.monst.size(); i++) {
|
||||
if(univ.town.monst[i].active != 0 && !univ.town.monst[i].is_friendly() &&
|
||||
(dist(univ.party[current_pc].combat_pos,univ.town.monst[i].cur_loc) <= (*spell_num).range)) {
|
||||
(dist(caster.combat_pos,univ.town.monst[i].cur_loc) <= (*spell_num).range)) {
|
||||
// TODO: Should this ^ also check that you can see each target? ie can_see_light(...) < 5
|
||||
// --> can_see_light(univ.party[current_pc].combat_pos,univ.town.monst[i].cur_loc,sight_obscurity)
|
||||
// --> can_see_light(caster.combat_pos,univ.town.monst[i].cur_loc,sight_obscurity)
|
||||
// (The item version of the spell used to check for this, but no longer does since it now defers to here.)
|
||||
which_m = &univ.town.monst[i];
|
||||
switch(spell_num) {
|
||||
@@ -5056,10 +5046,10 @@ void combat_immed_priest_cast(short current_pc, eSpell spell_num, bool freebie)
|
||||
|
||||
case eSpell::PROTECTIVE_CIRCLE:
|
||||
if(!freebie)
|
||||
univ.party[current_pc].cur_sp -= (*spell_num).cost;
|
||||
caster.cur_sp -= (*spell_num).cost;
|
||||
play_sound(24);
|
||||
add_string_to_buf(" Protective field created.");
|
||||
place_spell_pattern(protect_pat,univ.party[current_pc].combat_pos,6);
|
||||
place_spell_pattern(protect_pat,caster.combat_pos,6);
|
||||
break;
|
||||
case eSpell::AUGMENTATION:
|
||||
if(target < 6) {
|
||||
@@ -5082,7 +5072,7 @@ void combat_immed_priest_cast(short current_pc, eSpell spell_num, bool freebie)
|
||||
break;
|
||||
}
|
||||
if(num_opp < 10)
|
||||
do_missile_anim((num_opp < 5) ? 50 : 25,univ.party[current_pc].combat_pos,store_sound);
|
||||
do_missile_anim((num_opp < 5) ? 50 : 25,caster.combat_pos,store_sound);
|
||||
else play_sound(store_sound);
|
||||
end_missile_anim();
|
||||
}
|
||||
@@ -5232,9 +5222,9 @@ void spell_cast_hit_return() {
|
||||
}
|
||||
|
||||
void break_force_cage(location loc) {
|
||||
for(int j = 0; j < 6; j++) {
|
||||
if(univ.party[j].get_loc() == loc)
|
||||
univ.party[j].status[eStatus::FORCECAGE] = 0;
|
||||
for(cPlayer& pc : univ.party) {
|
||||
if(pc.get_loc() == loc)
|
||||
pc.status[eStatus::FORCECAGE] = 0;
|
||||
}
|
||||
for(int j = 0; j < univ.town.monst.size(); j++) {
|
||||
if(univ.town.monst[j].get_loc() == loc)
|
||||
@@ -5425,16 +5415,16 @@ void scloud_space(short m,short n) {
|
||||
univ.town.set_scloud(m,n,true);
|
||||
|
||||
if(overall_mode >= MODE_COMBAT)
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if(univ.party[i].combat_pos == target) {
|
||||
univ.party[i].curse(get_ran(1,1,2));
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.combat_pos == target) {
|
||||
pc.curse(get_ran(1,1,2));
|
||||
}
|
||||
if(overall_mode < MODE_COMBAT)
|
||||
if(target == univ.party.town_loc) {
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
univ.party[i].curse(get_ran(1,1,2));
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
pc.curse(get_ran(1,1,2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5444,15 +5434,15 @@ void web_space(short m,short n) {
|
||||
univ.town.set_web(m,n,true);
|
||||
|
||||
if(overall_mode >= MODE_COMBAT)
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if(univ.party[i].combat_pos == target) {
|
||||
univ.party[i].web(3);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.combat_pos == target) {
|
||||
pc.web(3);
|
||||
}
|
||||
if(overall_mode < MODE_COMBAT)
|
||||
if(target == univ.party.town_loc) {
|
||||
for(short i = 0; i < 6; i++)
|
||||
univ.party[i].web(3);
|
||||
for(cPlayer& pc : univ.party)
|
||||
pc.web(3);
|
||||
}
|
||||
}
|
||||
void sleep_cloud_space(short m,short n) {
|
||||
@@ -5461,10 +5451,10 @@ void sleep_cloud_space(short m,short n) {
|
||||
univ.town.set_sleep_cloud(m,n,true);
|
||||
|
||||
if(overall_mode >= MODE_COMBAT)
|
||||
for(short i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE)
|
||||
if(univ.party[i].combat_pos == target) {
|
||||
univ.party[i].sleep(eStatus::ASLEEP,3,0);
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.combat_pos == target) {
|
||||
pc.sleep(eStatus::ASLEEP,3,0);
|
||||
}
|
||||
if(overall_mode < MODE_COMBAT)
|
||||
if(target == univ.party.town_loc) {
|
||||
|
@@ -48,7 +48,6 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit
|
||||
void do_poison();
|
||||
void handle_disease();
|
||||
void handle_acid();
|
||||
bool no_pcs_left();
|
||||
bool hit_end_c_button();
|
||||
bool out_monst_all_dead();
|
||||
void end_combat();
|
||||
|
@@ -323,58 +323,59 @@ void display_alchemy() {
|
||||
alchemy.run();
|
||||
}
|
||||
|
||||
static void display_pc_info(cDialog& me, const short pc) {
|
||||
static void display_pc_info(cDialog& me, const short pc_num) {
|
||||
std::ostringstream to_draw;
|
||||
cPlayer& pc = univ.party[pc_num];
|
||||
|
||||
short hit_adj = 0, dam_adj = 0;
|
||||
|
||||
to_draw << univ.party[pc].name << " is carrying " << univ.party[pc].cur_weight() << " stones out of " << univ.party[pc].max_weight() << '.';
|
||||
to_draw << pc.name << " is carrying " << pc.cur_weight() << " stones out of " << pc.max_weight() << '.';
|
||||
me["weight"].setText(to_draw.str());
|
||||
to_draw.str("");
|
||||
|
||||
to_draw << univ.party[pc].cur_health << " out of " << univ.party[pc].max_health << '.';
|
||||
to_draw << pc.cur_health << " out of " << pc.max_health << '.';
|
||||
me["hp"].setText(to_draw.str());
|
||||
to_draw.str("");
|
||||
to_draw << univ.party[pc].cur_sp << " out of " << univ.party[pc].max_sp << '.';
|
||||
to_draw << pc.cur_sp << " out of " << pc.max_sp << '.';
|
||||
me["sp"].setText(to_draw.str());
|
||||
to_draw.str("");
|
||||
|
||||
for(short i = 0; i < 19; i++) {
|
||||
eSkill skill = eSkill(i);
|
||||
int bonus = univ.party[pc].get_prot_level(eItemAbil::BOOST_STAT, i);
|
||||
to_draw << univ.party[pc].skills[skill];
|
||||
int bonus = pc.get_prot_level(eItemAbil::BOOST_STAT, i);
|
||||
to_draw << pc.skills[skill];
|
||||
if(bonus > 0) to_draw << '+' << bonus;
|
||||
me[boost::lexical_cast<std::string>(skill)].setText(to_draw.str());
|
||||
to_draw.str("");
|
||||
}
|
||||
me["encumb"].setTextToNum(univ.party[pc].armor_encumbrance());
|
||||
me["name"].setText(univ.party[pc].name);
|
||||
me["lvl"].setTextToNum(univ.party[pc].level);
|
||||
me["xp"].setTextToNum(univ.party[pc].experience);
|
||||
me["skp"].setTextToNum(univ.party[pc].skill_pts);
|
||||
me["progress"].setTextToNum(univ.party[pc].level * univ.party[pc].get_tnl());
|
||||
pic_num_t pic = univ.party[pc].which_graphic;
|
||||
me["encumb"].setTextToNum(pc.armor_encumbrance());
|
||||
me["name"].setText(pc.name);
|
||||
me["lvl"].setTextToNum(pc.level);
|
||||
me["xp"].setTextToNum(pc.experience);
|
||||
me["skp"].setTextToNum(pc.skill_pts);
|
||||
me["progress"].setTextToNum(pc.level * pc.get_tnl());
|
||||
pic_num_t pic = pc.which_graphic;
|
||||
if(pic >= 100 && pic < 1000)
|
||||
dynamic_cast<cPict&>(me["pic"]).setPict(pic - 100,PIC_MONST);
|
||||
else dynamic_cast<cPict&>(me["pic"]).setPict(pic,PIC_PC);
|
||||
|
||||
// Fight bonuses
|
||||
auto weapons = univ.party[pc].get_weapons();
|
||||
auto weapons = pc.get_weapons();
|
||||
auto& weap1 = weapons.first;
|
||||
auto& weap2 = weapons.second;
|
||||
|
||||
hit_adj = univ.party[pc].stat_adj(eSkill::DEXTERITY) * 5 - (univ.party[pc].armor_encumbrance()) * 5
|
||||
+ 5 * minmax(-8,8,univ.party[pc].status[eStatus::BLESS_CURSE]);
|
||||
if(!univ.party[pc].traits[eTrait::AMBIDEXTROUS] && weap2)
|
||||
hit_adj = pc.stat_adj(eSkill::DEXTERITY) * 5 - (pc.armor_encumbrance()) * 5
|
||||
+ 5 * minmax(-8,8,pc.status[eStatus::BLESS_CURSE]);
|
||||
if(!pc.traits[eTrait::AMBIDEXTROUS] && weap2)
|
||||
hit_adj -= 25;
|
||||
|
||||
// TODO: Perhaps dam_adj and hit_adj calculation should be moved into a function somewhere?
|
||||
dam_adj = univ.party[pc].stat_adj(eSkill::STRENGTH) + minmax(-8,8,univ.party[pc].status[eStatus::BLESS_CURSE]);
|
||||
if(cInvenSlot skill_item = univ.party[pc].has_abil_equip(eItemAbil::SKILL)) {
|
||||
dam_adj = pc.stat_adj(eSkill::STRENGTH) + minmax(-8,8,pc.status[eStatus::BLESS_CURSE]);
|
||||
if(cInvenSlot skill_item = pc.has_abil_equip(eItemAbil::SKILL)) {
|
||||
hit_adj += 5 * (skill_item->abil_data[0] / 2 + 1);
|
||||
dam_adj += skill_item->abil_data[0] / 2;
|
||||
}
|
||||
if(cInvenSlot skill_item = univ.party[pc].has_abil_equip(eItemAbil::GIANT_STRENGTH)) {
|
||||
if(cInvenSlot skill_item = pc.has_abil_equip(eItemAbil::GIANT_STRENGTH)) {
|
||||
dam_adj += skill_item->abil_data[0];
|
||||
hit_adj += skill_item->abil_data[0] * 2;
|
||||
}
|
||||
|
Reference in New Issue
Block a user