diff --git a/osx/Scenario Editor/scen.actions.cpp b/osx/Scenario Editor/scen.actions.cpp index c961c57d..cfafe510 100644 --- a/osx/Scenario Editor/scen.actions.cpp +++ b/osx/Scenario Editor/scen.actions.cpp @@ -1161,11 +1161,11 @@ Boolean handle_action(Point the_point,EventRecord event) //draw_frames(); } - if ((get_ran(1,0,100) == 50) && (!check_p2(user_given_password))) { + if ((get_ran(1,1,100) == 50) && (!check_p2(user_given_password))) { fancy_choice_dialog(868,0); return are_done; } - if ((get_ran(1,0,100) == 50) && (!check_p3(user_given_password))) { + if ((get_ran(1,1,100) == 50) && (!check_p3(user_given_password))) { fancy_choice_dialog(868,0); return are_done; } diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index 8d5c1b8e..b7fc3aac 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -902,21 +902,20 @@ Boolean handle_action(EventRecord event) did_something = TRUE; need_redraw = TRUE; if (univ.town.monst.dudes[i].attitude % 2 == 1) { - add_string_to_buf(" Creature is hostile. "); - } - else if ((univ.town.monst.dudes[i].summoned > 0)//// - || (univ.town.monst.dudes[i].monst_start.personality < 0)) - add_string_to_buf("Talk: No response. "); - else switch (univ.town.monst.dudes[i].monst_start.personality) { - default: - start_talk_mode(i,univ.town.monst.dudes[i].monst_start.personality,univ.town.monst.dudes[i].number, - univ.town.monst.dudes[i].monst_start.facial_pic); - did_something = FALSE; - need_redraw = FALSE; - break; - } + add_string_to_buf(" Creature is hostile. "); + } + else if ((univ.town.monst.dudes[i].summoned > 0)//// + || (univ.town.monst.dudes[i].monst_start.personality < 0)) + add_string_to_buf("Talk: No response. "); + else { + start_talk_mode(i,univ.town.monst.dudes[i].monst_start.personality,univ.town.monst.dudes[i].number, + univ.town.monst.dudes[i].monst_start.facial_pic); + did_something = FALSE; + need_redraw = FALSE; + break; } } + } if ((did_something == FALSE) && (overall_mode != MODE_TALKING)){ add_string_to_buf(" Nobody there"); need_reprint = TRUE; diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index e0ef3f05..69578061 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -588,7 +588,7 @@ void pc_attack(short who_att,short target)//// sprintf ((char *) create_line, "%s punches. ",(char *) ADVEN[who_att].name);//,hit_adj, dam_adj); add_string_to_buf((char *) create_line); - r1 = get_ran(1,0,100) + hit_adj - 20; + r1 = get_ran(1,1,100) + hit_adj - 20; r1 += 5 * (ADVEN[current_pc].status[6] / 3); r2 = get_ran(1,1,4) + dam_adj; @@ -614,7 +614,7 @@ void pc_attack(short who_att,short target)//// sprintf ((char *) create_line, "%s swings. ",(char *) ADVEN[who_att].name);//,hit_adj, dam_adj); add_string_to_buf((char *) create_line); - r1 = get_ran(1,0,100) - 5 + hit_adj + r1 = get_ran(1,1,100) - 5 + hit_adj - 5 * ADVEN[who_att].items[weap1].bonus; r1 += 5 * (ADVEN[current_pc].status[6] / 3); @@ -634,7 +634,7 @@ void pc_attack(short who_att,short target)//// ADVEN[who_att].items[weap1].ability_strength,which_m); // assassinate - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if ((ADVEN[who_att].level >= which_m->m_d.level - 1) && (ADVEN[who_att].skills[16] >= which_m->m_d.level / 2) && (which_m->m_d.spec_skill != 12)) // Can't assassinate splitters @@ -696,7 +696,7 @@ void pc_attack(short who_att,short target)//// sprintf ((char *) create_line, "%s swings. ",(char *) ADVEN[who_att].name);//,hit_adj, dam_adj); add_string_to_buf((char *) create_line); - r1 = get_ran(1,0,100) + hit_adj - 5 * ADVEN[who_att].items[weap2].bonus; + r1 = get_ran(1,1,100) + hit_adj - 5 * ADVEN[who_att].items[weap2].bonus; // Ambidextrous? if (ADVEN[who_att].traits[2] == FALSE) @@ -1311,7 +1311,7 @@ void do_combat_cast(location target)//// store_m_type = -1; break; } - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (r1 > hit_chance[minmax(0,19,level * 4 - cur_monst->m_d.level + 10)]) add_string_to_buf(" Demon resisted. "); else { @@ -1442,12 +1442,11 @@ void load_missile() //// else add_string_to_buf("Fire: Equip a missile. "); } -void fire_missile(location target) //// -{ +void fire_missile(location target) { short r1, r2, skill, dam, dam_bonus, hit_bonus, range, targ_monst, spec_dam = 0,poison_amt = 0; short skill_item,m_type = 0; cPopulation::cCreature *cur_monst; - Boolean exploding = FALSE; + bool exploding = false; skill = (overall_mode == MODE_FIRING) ? ADVEN[current_pc].skills[7] : ADVEN[current_pc].skills[6]; range = (overall_mode == MODE_FIRING) ? 12 : 8; @@ -1466,99 +1465,99 @@ void fire_missile(location target) //// hit_bonus += 2; if (ADVEN[current_pc].items[ammo_inv_slot].ability == 172) - exploding = TRUE; - if (ADVEN[current_pc].items[ammo_inv_slot].variety != 25) { - if (ADVEN[current_pc].items[ammo_inv_slot].ability != 170) - ADVEN[current_pc].items[ammo_inv_slot].charges--; - else ADVEN[current_pc].items[ammo_inv_slot].charges = 1; - if ((pc_has_abil_equip(current_pc,11) < 24) && (ADVEN[current_pc].items[ammo_inv_slot].ability != 170)) - ADVEN[current_pc].items[ammo_inv_slot].charges--; - if (ADVEN[current_pc].items[ammo_inv_slot].charges <= 0) - take_item(current_pc,ammo_inv_slot); - } - - // First, some missiles do special things - if (exploding == TRUE) { - take_ap((overall_mode == MODE_FIRING) ? 3 : 2); - add_string_to_buf(" The arrow explodes! "); - run_a_missile(pc_pos[current_pc],target,2,1,5, - 0,0,100); - start_missile_anim(); - add_missile(target,2,1, 0, 0); - do_missile_anim(100,pc_pos[current_pc], 5); - place_spell_pattern(rad2,target, - 50 + ADVEN[current_pc].items[ammo_inv_slot].ability_strength * 2,TRUE,current_pc); - do_explosion_anim(5,0); - end_missile_anim(); - handle_marked_damage(); - return; - } + exploding = true; if (dist(pc_pos[current_pc],target) > range) add_string_to_buf(" Out of range."); - else if (can_see(pc_pos[current_pc],target,0) == 5) - add_string_to_buf(" Can't see target. "); - else { - combat_posing_monster = current_working_monster = current_pc; - draw_terrain(2); - void_sanctuary(current_pc); - //play_sound((overall_mode == MODE_FIRING) ? 12 : 14); - take_ap((overall_mode == MODE_FIRING) ? 3 : 2); - missile_firer = current_pc; - r1 = get_ran(1,0,100) - 5 * hit_bonus - 10; - r1 += 5 * (ADVEN[current_pc].status[6] / 3); - r2 = get_ran(1,1,dam) + dam_bonus; - sprintf ((char *) create_line, "%s fires.",(char *) ADVEN[current_pc].name); // debug - add_string_to_buf((char *) create_line); - - switch (overall_mode) { - case MODE_THROWING: - switch (ADVEN[current_pc].items[ammo_inv_slot].item_level) { - case 7:m_type = 10;break; - case 4:m_type = 1;break; - case 8:m_type = 5;break; - case 9:m_type = 7;break; - default:m_type = 10;break; - } - break; - case MODE_FIRING: case MODE_FANCY_TARGET: - m_type = (ADVEN[current_pc].items[ammo_inv_slot].is_magic() == TRUE) ? 4 : 3; - break; + else if (can_see(pc_pos[current_pc],target,0) == 5) + add_string_to_buf(" Can't see target. "); + else { + // First, some missiles do special things + if (exploding) { + take_ap((overall_mode == MODE_FIRING) ? 3 : 2); + add_string_to_buf(" The arrow explodes! "); + run_a_missile(pc_pos[current_pc],target,2,1,5, + 0,0,100); + start_missile_anim(); + add_missile(target,2,1, 0, 0); + do_missile_anim(100,pc_pos[current_pc], 5); + place_spell_pattern(rad2,target, + 50 + ADVEN[current_pc].items[ammo_inv_slot].ability_strength * 2,TRUE,current_pc); + do_explosion_anim(5,0); + end_missile_anim(); + handle_marked_damage(); + } else { + combat_posing_monster = current_working_monster = current_pc; + draw_terrain(2); + void_sanctuary(current_pc); + //play_sound((overall_mode == MODE_FIRING) ? 12 : 14); + take_ap((overall_mode == MODE_FIRING) ? 3 : 2); + missile_firer = current_pc; + r1 = get_ran(1,1,100) - 5 * hit_bonus - 10; + r1 += 5 * (ADVEN[current_pc].status[6] / 3); + r2 = get_ran(1,1,dam) + dam_bonus; + sprintf ((char *) create_line, "%s fires.",(char *) ADVEN[current_pc].name); // debug + add_string_to_buf((char *) create_line); + + switch (overall_mode) { + case MODE_THROWING: + switch (ADVEN[current_pc].items[ammo_inv_slot].item_level) { + case 7:m_type = 10;break; + case 4:m_type = 1;break; + case 8:m_type = 5;break; + case 9:m_type = 7;break; + default:m_type = 10;break; } - run_a_missile(pc_pos[current_pc],target,m_type,1,(overall_mode == MODE_FIRING) ? 12 : 14, - 0,0,100); - - if (r1 > hit_chance[skill]) - add_string_to_buf(" Missed."); - else if ((targ_monst = monst_there(target)) < T_M) { - cur_monst = &univ.town.monst.dudes[targ_monst]; - spec_dam = calc_spec_dam(ADVEN[current_pc].items[ammo_inv_slot].ability, - ADVEN[current_pc].items[ammo_inv_slot].ability_strength,cur_monst); - if (ADVEN[current_pc].items[ammo_inv_slot].ability == 176) { - ASB(" There is a flash of light."); - cur_monst->m_d.health += r2; - } - else damage_monst(targ_monst, current_pc, r2, spec_dam, 1300); - - //if (ADVEN[current_pc].items[ammo_inv_slot].ability == 33) - // hit_space(cur_monst->m_loc,get_ran(3,1,6),1,1,1); - - // poison - if ((ADVEN[current_pc].status[0] > 0) && (ADVEN[current_pc].weap_poisoned == ammo_inv_slot)) { - poison_amt = ADVEN[current_pc].status[0]; - if (pc_has_abil_equip(current_pc,51) < 24) - poison_amt++; - poison_monst(cur_monst,poison_amt); - } - - } - else hit_space(target,r2,0,1,0); - - } - + break; + case MODE_FIRING: case MODE_FANCY_TARGET: + m_type = (ADVEN[current_pc].items[ammo_inv_slot].is_magic() == TRUE) ? 4 : 3; + break; + } + run_a_missile(pc_pos[current_pc],target,m_type,1,(overall_mode == MODE_FIRING) ? 12 : 14, + 0,0,100); + + if (r1 > hit_chance[skill]) + add_string_to_buf(" Missed."); + else if ((targ_monst = monst_there(target)) < T_M) { + cur_monst = &univ.town.monst.dudes[targ_monst]; + spec_dam = calc_spec_dam(ADVEN[current_pc].items[ammo_inv_slot].ability, + ADVEN[current_pc].items[ammo_inv_slot].ability_strength,cur_monst); + if (ADVEN[current_pc].items[ammo_inv_slot].ability == 176) { + ASB(" There is a flash of light."); + cur_monst->m_d.health += r2; + } + else damage_monst(targ_monst, current_pc, r2, spec_dam, 1300); + + //if (ADVEN[current_pc].items[ammo_inv_slot].ability == 33) + // hit_space(cur_monst->m_loc,get_ran(3,1,6),1,1,1); + + // poison + if ((ADVEN[current_pc].status[0] > 0) && (ADVEN[current_pc].weap_poisoned == ammo_inv_slot)) { + poison_amt = ADVEN[current_pc].status[0]; + if (pc_has_abil_equip(current_pc,51) < 24) + poison_amt++; + poison_monst(cur_monst,poison_amt); + } + + } + else hit_space(target,r2,0,1,0); + + } + + if (ADVEN[current_pc].items[ammo_inv_slot].variety != 25) { + if (ADVEN[current_pc].items[ammo_inv_slot].ability != 170) + ADVEN[current_pc].items[ammo_inv_slot].charges--; + else ADVEN[current_pc].items[ammo_inv_slot].charges = 1; + if ((pc_has_abil_equip(current_pc,11) < 24) && (ADVEN[current_pc].items[ammo_inv_slot].ability != 170)) + ADVEN[current_pc].items[ammo_inv_slot].charges--; + if (ADVEN[current_pc].items[ammo_inv_slot].charges <= 0) + take_item(current_pc,ammo_inv_slot); + } + } + combat_posing_monster = current_working_monster = -1; ADVEN[current_pc].status[0] = move_to_zero(ADVEN[current_pc].status[0]); - print_buf();//// + print_buf(); } // Select next active PC and, if necessary, run monsters @@ -2085,29 +2084,29 @@ void do_monster_turn() // Place fields for monsters that create them. Only done when monst sees foe if ((target != 6) && (can_see(cur_monst->m_loc,targ_space,0) < 5)) { //// - if ((cur_monst->m_d.radiate_1 == 1) && (get_ran(1,0,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->m_d.radiate_1 == 1) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) place_spell_pattern(square,cur_monst->m_loc,5,FALSE,7); - if ((cur_monst->m_d.radiate_1 == 2) && (get_ran(1,0,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->m_d.radiate_1 == 2) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) place_spell_pattern(square,cur_monst->m_loc,8,FALSE,7); - if ((cur_monst->m_d.radiate_1 == 3) && (get_ran(1,0,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->m_d.radiate_1 == 3) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) place_spell_pattern(square,cur_monst->m_loc,4,FALSE,7); - if ((cur_monst->m_d.radiate_1 == 4) && (get_ran(1,0,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->m_d.radiate_1 == 4) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) place_spell_pattern(square,cur_monst->m_loc,6,FALSE,7); - if ((cur_monst->m_d.radiate_1 == 5) && (get_ran(1,0,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->m_d.radiate_1 == 5) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) place_spell_pattern(square,cur_monst->m_loc,12,FALSE,7); - if ((cur_monst->m_d.radiate_1 == 6) && (get_ran(1,0,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->m_d.radiate_1 == 6) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) place_spell_pattern(square,cur_monst->m_loc,7,FALSE,7); - if ((cur_monst->m_d.radiate_1 == 10) && (get_ran(1,0,100) < 5)){ + if ((cur_monst->m_d.radiate_1 == 10) && (get_ran(1,1,100) < 5)){ if (summon_monster(cur_monst->m_d.radiate_2, cur_monst->m_loc,130,cur_monst->attitude) == TRUE) {monst_spell_note(cur_monst->number,33); play_sound(61);} } - if ((cur_monst->m_d.radiate_1 == 11) && (get_ran(1,0,100) < 20)){ + if ((cur_monst->m_d.radiate_1 == 11) && (get_ran(1,1,100) < 20)){ if (summon_monster(cur_monst->m_d.radiate_2, cur_monst->m_loc,130,cur_monst->attitude) == TRUE) {monst_spell_note(cur_monst->number,33); play_sound(61);} } - if ((cur_monst->m_d.radiate_1 == 12) && (get_ran(1,0,100) < 50)){ + if ((cur_monst->m_d.radiate_1 == 12) && (get_ran(1,1,100) < 50)){ if (summon_monster(cur_monst->m_d.radiate_2, cur_monst->m_loc,130,cur_monst->attitude) == TRUE) {monst_spell_note(cur_monst->number,33); play_sound(61);} @@ -2239,7 +2238,7 @@ void monster_attack_pc(short who_att,short target) // Check sanctuary if (ADVEN[target].status[8] > 0) { - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (r1 > hit_chance[attacker->m_d.level / 2]) { add_string_to_buf(" Can't find target! "); } @@ -2252,7 +2251,7 @@ void monster_attack_pc(short who_att,short target) // add_string_to_buf((char *) create_line); // Attack roll - r1 = get_ran(1,0,100) - 5 * min(8,attacker->m_d.status[1]) + 5 * ADVEN[target].status[1] + r1 = get_ran(1,1,100) - 5 * min(8,attacker->m_d.status[1]) + 5 * ADVEN[target].status[1] + 5 * stat_adj(target,1) - 15; r1 += 5 * (attacker->m_d.status[6] / 3); if (pc_parry[target] < 100) @@ -2431,7 +2430,7 @@ void monster_attack_monster(short who_att,short attackee) target->attitude = 2; // Attack roll - r1 = get_ran(1,0,100) - 5 * min(10,attacker->m_d.status[1]) + r1 = get_ran(1,1,100) - 5 * min(10,attacker->m_d.status[1]) + 5 * target->m_d.status[1] - 15; r1 += 5 * (attacker->m_d.status[6] / 3); @@ -2725,14 +2724,14 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location // Check sanctuary if (ADVEN[target].status[8] > 0) { - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (r1 > hit_chance[level]) { add_string_to_buf(" Can't find target! "); } return; } - r1 = get_ran(1,0,100) - 5 * min(10,bless) + 5 * ADVEN[target].status[1] + r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * ADVEN[target].status[1] - 5 * (can_see(source, pc_pos[target],0)); if (pc_parry[target] < 100) r1 += 5 * pc_parry[target]; @@ -2774,7 +2773,7 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location monst_spell_note(m_target->number,14); break; } - r1 = get_ran(1,0,100) - 5 * min(10,bless) + 5 * m_target->m_d.status[1] + r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * m_target->m_d.status[1] - 5 * (can_see(source, m_target->m_loc,0)); r2 = get_ran(dam[level],1,7) + min(10,bless); diff --git a/osx/boe.fields.cpp b/osx/boe.fields.cpp index d266bd6c..61abd7bc 100644 --- a/osx/boe.fields.cpp +++ b/osx/boe.fields.cpp @@ -402,7 +402,7 @@ void spread_sfx(short type,short prob) for (i = 0; i < town_size[town_type]; i++) for (j = 0; j < town_size[town_type]; j++) - if ((univ.town.town->terrain(i,j) < 5) && (get_ran(1,0,100) <= prob)) + if ((univ.town.town->terrain(i,j) < 5) && (get_ran(1,1,100) <= prob)) make_sfx(i,j,type); } \ No newline at end of file diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 9bf4c4a3..297670b3 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -1125,7 +1125,8 @@ remember_tiny_text = 300; void draw_text_bar(short mode) //short mode; // 0 - no redraw 1 - forced { - short i,num_rect[3] = {12,10,4}; + //short num_rect[3] = {12,10,4}; // Why? Just... why? + short i; location loc; char combat_string[100]; @@ -1152,7 +1153,7 @@ void draw_text_bar(short mode) } } if (is_town()) { - for (i = 0; i < num_rect[town_type]; i++) + for (i = 0; i < 16; i++) if (loc.in(univ.town.town->room_rect(i))) if ((remember_tiny_text == 200 + i) && (mode == 0)) return; @@ -1499,8 +1500,8 @@ void update_pc_graphics() if (party_in_memory == FALSE) return; - GetPort(&old_port); - SetPort(GetWindowPort(mainPtr)); + //GetPort(&old_port); + SetPortWindowPort(mainPtr); temp_gworld = load_pict(902); temp_gworld2 = load_pict(905); @@ -1539,7 +1540,7 @@ void update_pc_graphics() DisposeGWorld (temp_gworld); DisposeGWorld (temp_gworld2); - SetPort(old_port); + //SetPort(old_port); } diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index c4a7a3d9..673f0945 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -1454,7 +1454,7 @@ void place_treasure(location where,short level,short loot,short mode) place_item(new_item,where,FALSE); } for (j = 0; j < 5; j++) { - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if ((treas_chart[loot][j] >= 0) && (r1 <= treas_odds[loot][j] + luck_total())) { r1 = get_ran(1,0,9); min = min_chart[treas_chart[loot][j]][r1]; @@ -1505,7 +1505,7 @@ void place_treasure(location where,short level,short loot,short mode) if (new_item.variety != 0) { for (i = 0; i < 6; i++) if ((ADVEN[i].main_status == 1) - && (get_ran(1,0,100) < id_odds[ADVEN[i].skills[13]])) + && (get_ran(1,1,100) < id_odds[ADVEN[i].skills[13]])) new_item.item_properties = new_item.item_properties | 1; place_item(new_item,where,FALSE); } diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index 941366d1..dd990824 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -308,7 +308,7 @@ void Initialize(void) load_prefs(); set_pixel_depth(); mainPtr = GetNewCWindow(128,NIL,IN_FRONT); - SetPort(GetWindowPort(mainPtr)); /* set window to current graf port */ + SetPortWindowPort(mainPtr); /* set window to current graf port */ text_sbar = NewControl(mainPtr,&sbar_rect,tit,FALSE,58,0,58,scrollBarProc,1); item_sbar = NewControl(mainPtr,&item_sbar_rect,tit,FALSE,0,0,16,scrollBarProc,2); shop_sbar = NewControl(mainPtr,&shop_sbar_rect,tit,FALSE,0,0,16,scrollBarProc,3); diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index 48f4d2ef..a0fa292a 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -1068,7 +1068,7 @@ Boolean monst_check_special_terrain(location where_check,short mode,short which_ if (guts < 3) return FALSE; } if (is_fire_barrier(where_check.x,where_check.y)) { - if ((which_m->attitude % 2 == 1) && (get_ran(1,0,100) < (which_m->m_d.mu * 10 + which_m->m_d.cl * 4))) { + if ((which_m->attitude % 2 == 1) && (get_ran(1,1,100) < (which_m->m_d.mu * 10 + which_m->m_d.cl * 4))) { play_sound(60); add_string_to_buf("Monster breaks barrier."); take_fire_barrier(where_check.x,where_check.y); @@ -1081,7 +1081,7 @@ Boolean monst_check_special_terrain(location where_check,short mode,short which_ } } if (is_force_barrier(where_check.x,where_check.y)) { /// Not in big towns - if ((which_m->attitude % 2 == 1) && (get_ran(1,0,100) < (which_m->m_d.mu * 10 + which_m->m_d.cl * 4)) + if ((which_m->attitude % 2 == 1) && (get_ran(1,1,100) < (which_m->m_d.mu * 10 + which_m->m_d.cl * 4)) && (univ.town.num >= 20)) { play_sound(60); add_string_to_buf("Monster breaks barrier."); @@ -1271,7 +1271,7 @@ void charm_monst(cPopulation::cCreature *which_m,short penalty,short which_statu if ((which_status == 11) && ((which_m->m_d.m_type == 8) || (which_m->m_d.m_type == 10) || (which_m->m_d.m_type == 11))) return; - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (which_m->m_d.immunities & 1) r1 = r1 * 2; if (which_m->m_d.immunities & 2) @@ -1308,7 +1308,7 @@ void record_monst(cPopulation::cCreature *which_m) short r1; char str[60]; - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); r1 = (r1 * 7) / 10; if ((which_m->m_d.x_width > 1) || (which_m->m_d.y_width > 1)) { diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 456ac845..128775a6 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -688,7 +688,7 @@ void disease_pc(short which_pc,short how_much) if (ADVEN[which_pc].main_status != 1) return; - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (r1 < ADVEN[which_pc].level * 2) how_much -= 2; if (how_much <= 0) { @@ -730,7 +730,7 @@ void sleep_pc(short which_pc,short how_much,short what_type,short adjust) } - r1 = get_ran(1,0,100) + adjust; + r1 = get_ran(1,1,100) + adjust; if (r1 < 30 + ADVEN[which_pc].level * 2) how_much = -1; if ((what_type == 11) && ((ADVEN[which_pc].traits[7] > 0) || (ADVEN[which_pc].status[11] < 0))) @@ -884,7 +884,7 @@ void award_xp(short pc_num,short amt) else adjust = xp_percent[ADVEN[pc_num].level / 2]; if ((amt > 0) && (ADVEN[pc_num].level > 7)) { - if (get_ran(1,0,100) < xp_percent[ADVEN[pc_num].level / 2]) + if (get_ran(1,1,100) < xp_percent[ADVEN[pc_num].level / 2]) amt--; } if (amt <= 0) @@ -1262,14 +1262,14 @@ Boolean poison_weapon( short pc_num, short how_much,short safe) else { p_level = how_much; add_string_to_buf(" You poison your weapon. "); - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); // Nimble? if (ADVEN[pc_num].traits[TRAIT_NIMBLE]) r1 -= 6; if ((r1 > p_chance[ADVEN[pc_num].skills[17]]) && (safe == 0)) { add_string_to_buf(" Poison put on badly. "); p_level = p_level / 2; - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (r1 > p_chance[ADVEN[pc_num].skills[17]] + 10) { add_string_to_buf(" You nick yourself. "); ADVEN[pc_num].status[2] += p_level; @@ -1821,7 +1821,7 @@ void do_priest_spell(short pc_num,short spell_num) //// targ_damaged = ADVEN[target].max_health - ADVEN[target].cur_health; while ((targ_damaged > 0) && (ADVEN[pc_num].cur_health > 0)) { ADVEN[target].cur_health++; - r1 = get_ran(1,0,100) + ADVEN[pc_num].level / 2 + 3 * adj; + r1 = get_ran(1,1,100) + ADVEN[pc_num].level / 2 + 3 * adj; if (r1 < 100) ADVEN[pc_num].cur_health--; if (r1 < 50) @@ -1868,8 +1868,8 @@ void do_priest_spell(short pc_num,short spell_num) //// if ((item = pc_has_abil(pc_num,160)) == 24) { add_string_to_buf(" Need resurrection balm. "); spell_num = 500; - } - else take_item(pc_num,item); + } + else take_item(pc_num,item); if (spell_num == 40) { if (ADVEN[target].main_status == 2) if (get_ran(1,1,ADVEN[pc_num].level / 2) == 1) { @@ -1905,7 +1905,7 @@ void do_priest_spell(short pc_num,short spell_num) //// else sprintf ((char *) c_line," Was OK. "); } add_string_to_buf((char *) c_line); - put_pc_screen(); + put_pc_screen(); } break; @@ -2052,7 +2052,7 @@ void cast_town_spell(location where) //// case 20: switch (scenario.ter_types[ter].special) { //// case 9: case 10: - r1 = get_ran(1,0,100) - 5 * stat_adj(who_cast,2) + 5 * univ.town.difficulty; + r1 = get_ran(1,1,100) - 5 * stat_adj(who_cast,2) + 5 * univ.town.difficulty; r1 += scenario.ter_types[ter].flag2 * 7; if (scenario.ter_types[ter].flag2 == 10) r1 = 10000; @@ -2075,7 +2075,7 @@ void cast_town_spell(location where) //// case 41: if ((is_fire_barrier(where.x,where.y)) || (is_force_barrier(where.x,where.y))) { - r1 = get_ran(1,0,100) - 5 * stat_adj(who_cast,2) + 5 * (univ.town.difficulty / 10); + r1 = get_ran(1,1,100) - 5 * stat_adj(who_cast,2) + 5 * (univ.town.difficulty / 10); if (is_fire_barrier(where.x,where.y)) r1 -= 8; if (r1 < (120 - combat_percent[min(19,ADVEN[who_cast].level)])) { @@ -2143,7 +2143,7 @@ void do_mindduel(short pc_num,cPopulation::cCreature *monst) add_string_to_buf("Mindduel!"); while ((ADVEN[pc_num].main_status == 1) && (monst->active > 0) && (i < 10)) { play_sound(1); - r1 = get_ran(1,0,100) + adjust; + r1 = get_ran(1,1,100) + adjust; r1 += 5 * (monst->m_d.status[9] - ADVEN[pc_num].status[9]); r1 += 5 * balance; r2 = get_ran(1,1,6); @@ -2874,7 +2874,7 @@ void do_alchemy() //// if (ingred2_needed[which_p] > 0) remove_charge(pc_num,which_item2); - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (r1 < fail_chance[ADVEN[pc_num].skills[12] - difficulty[which_p]]) { add_string_to_buf("Alchemy: Failed. "); r1 = get_ran(1,0,1); @@ -3246,7 +3246,7 @@ Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_ if (ADVEN[which_pc].items[i].bonus < 0) { how_much = how_much - ADVEN[which_pc].items[i].bonus; } - r1 = get_ran(1,0,100); + r1 = get_ran(1,1,100); if (r1 < hit_chance[ADVEN[which_pc].skills[8]] - 20) how_much -= 1; } @@ -3273,7 +3273,7 @@ Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_ if (ADVEN[which_pc].traits[0] == TRUE) how_much--; // luck - if (get_ran(1,0,100) < 2 * (hit_chance[ADVEN[which_pc].skills[18]] - 20)) + if (get_ran(1,1,100) < 2 * (hit_chance[ADVEN[which_pc].skills[18]] - 20)) how_much -= 1; } @@ -3396,7 +3396,7 @@ void kill_pc(short which_pc,short type) i = pc_has_abil_equip(which_pc,48); if ((no_save == FALSE) && (type != 0) && (ADVEN[which_pc].skills[18] > 0) && - (get_ran(1,0,100) < hit_chance[ADVEN[which_pc].skills[18]])) { + (get_ran(1,1,100) < hit_chance[ADVEN[which_pc].skills[18]])) { add_string_to_buf(" But you luck out! "); ADVEN[which_pc].cur_health = 0; } diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index 031e9f9d..dffbb937 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -2085,9 +2085,11 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case 81: r1 = get_ran(spec.ex1a,1,spec.ex1b) + spec.ex2a; if (pc < 0) { - hit_party(r1,spec.ex2b); - } - else damage_pc(pc,r1,spec.ex2b,0); + if(spec.pic == 1 && overall_mode == MODE_COMBAT) + damage_pc(current_pc,r1,spec.ex2b,0); + else hit_party(r1,spec.ex2b); + } + else damage_pc(pc,r1,spec.ex2b,0); break; case 82: for (i = 0; i < 6; i++) diff --git a/osx/boe.startup.cpp b/osx/boe.startup.cpp index 87bc37c4..4fc2b752 100644 --- a/osx/boe.startup.cpp +++ b/osx/boe.startup.cpp @@ -31,6 +31,7 @@ extern Point ul; extern vector scen_headers; extern Boolean unreg_party_in_scen_not_check; extern std::vector scen_names;; +extern cUniverse univ; //void start_game(); @@ -118,9 +119,13 @@ Boolean handle_startup_press(Point the_point) void startup_load()//// { FSSpec* file_to_load = nav_get_party(); - load_party(*file_to_load); - update_pc_graphics(); - if (in_startup_mode == FALSE) { + if(file_to_load == NULL) return; + if(load_party(*file_to_load)){ + party_in_memory = true; + update_pc_graphics(); + in_startup_mode = strlen(univ.party.scen_name); + } + if (!in_startup_mode) { //end_anim(); end_startup(); post_load(); diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 7feba937..1478fb07 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -1164,12 +1164,12 @@ void pick_lock(location where,short pc_num) return; } - r1 = get_ran(1,0,100) + ADVEN[pc_num].items[which_item].ability_strength * 7; + r1 = get_ran(1,1,100) + ADVEN[pc_num].items[which_item].ability_strength * 7; if (r1 < 75) will_break = TRUE; - r1 = get_ran(1,0,100) - 5 * stat_adj(pc_num,1) + univ.town.difficulty * 7 + r1 = get_ran(1,1,100) - 5 * stat_adj(pc_num,1) + univ.town.difficulty * 7 - 5 * ADVEN[pc_num].skills[15] - ADVEN[pc_num].items[which_item].ability_strength * 7; // Nimble? @@ -1205,7 +1205,7 @@ void bash_door(location where,short pc_num) //// short r1,unlock_adjust; terrain = univ.town.town->terrain(where.x,where.y); - r1 = get_ran(1,0,100) - 15 * stat_adj(pc_num,0) + univ.town.difficulty * 4; + r1 = get_ran(1,1,100) - 15 * stat_adj(pc_num,0) + univ.town.difficulty * 4; if ((scenario.ter_types[terrain].special < 9) || (scenario.ter_types[terrain].special > 10)) { add_string_to_buf(" Wrong terrain type. "); diff --git a/osx/boe.townspec.cpp b/osx/boe.townspec.cpp index ef531477..ab935915 100644 --- a/osx/boe.townspec.cpp +++ b/osx/boe.townspec.cpp @@ -164,7 +164,7 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff) skill = minmax(0,20,ADVEN[pc_num].skills[SKILL_DISARM_TRAPS] + + ADVEN[pc_num].skills[SKILL_LUCK] / 2 + 1 - univ.town.difficulty + 2 * i); - r1 = get_ran(1,0,100) + diff; + r1 = get_ran(1,1,100) + diff; // Nimble? if (ADVEN[pc_num].traits[TRAIT_NIMBLE]) r1 -= 6;