Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions scripts/scr_company_view/scr_company_view.gml
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ function other_manage_data() {
if ((_unit.company == 1) && (ma_exp[v] >= 140)) {
ma_promote[v] = 1;
}
if (ma_health[v] <= 10) {
ma_promote[v] = 10;
}
} else if ((_unit.role() == obj_ini.role[100][6]) && (ma_exp[v] >= 400)) {
ma_promote[v] = 1;
} else if ((_unit.role() == obj_ini.role[100][15]) || (ma_role[v] == obj_ini.role[100][14])) {
Expand Down Expand Up @@ -357,9 +354,6 @@ function other_manage_data() {
if (_unit.experience >= _promotion_limit && _promotion_limit > 0) {
ma_promote[v] = 1;
}
if (ma_health[v] <= 10) {
ma_promote[v] = 10;
}
}

if ((!obj_controller.command_set[2]) && (!ma_promote[v])) {
Expand Down
9 changes: 7 additions & 2 deletions scripts/scr_draw_management_unit/scr_draw_management_unit.gml
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,18 @@ function scr_draw_management_unit(selected, yy = 0, xx = 0, draw = true, click_l
var xpColor = c_gray;
// Draw EXP value and set up health color
if (man[selected] == "man") {
if (ma_promote[selected] >= 10) {
if (ma_health[selected] <= 0) {
hpColor = c_red;
array_push(health_tooltip, ["Critical Health State! Bionic augmentation is required!", [xx + 250, yy + 64, xx + 300, yy + 85]]);
} else if (ma_promote[selected] > 0 && !unit_specialist && obj_controller.command_set[2] != 0) {
} else if (ma_health[selected] <= 15) {
hpColor = c_yellow;
}

if (ma_promote[selected] > 0 && !unit_specialist && obj_controller.command_set[2] != 0) {
xpColor = c_yellow;
array_push(promotion_tooltip, ["Promotion Recommended", [xx + 335, yy + 64, xx + 385, yy + 85]]);
}

draw_text_color(xpText[0], xpText[1], xpText[2], xpColor, xpColor, xpColor, xpColor, 1);
}
// Draw the health value with the defined colors
Expand Down
160 changes: 89 additions & 71 deletions scripts/scr_marine_struct/scr_marine_struct.gml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {}
name: "",
};
religion = "none";
master_loyalty = 0;
job = "none";
psionic = 0;
corruption = 0;
Expand All @@ -99,13 +98,11 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {}
]; // [Techmarine, Librarian, Chaplain, Apothecary] // maybe add to list instead?
encumbered_ranged = false;
encumbered_melee = false;
home_world = "";
company = comp; //marine company
marine_number = mar; //marine number in company
squad = "none";
stat_point_exp_marker = 0;
bionics = 0;
favorite = false;
spawn_data = other_spawn_data;
unit_health = 0;
if (faction == "chapter" && !struct_exists(spawn_data, "recruit_data")) {
Expand All @@ -119,7 +116,6 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {}
powers_known = [];

personal_livery = {};
personal_culture = [];

manage_tags = [];

Expand Down Expand Up @@ -752,77 +748,99 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {}
return false;
};

static add_bionics = function(area = "none", bionic_quality = "any", from_armoury = true) {
if (from_armoury && scr_item_count("Bionics", bionic_quality) < 1) {
return "no bionics";
} else if (from_armoury) {
remove_quality = scr_add_item("Bionics", -1, bionic_quality);
} else {
remove_quality = choose("standard", "standard", "standard", "standard", "standard", "master_crafted", "artifact");
/// @param {string} area
/// @param {string} bionic_quality
/// @param {bool} from_armoury
static add_bionics = function(_area = "none", _quality = "any", _from_armoury = true) {
if (bionics >= 10) {
return false;
}
var new_bionic_pos,
part,
new_bionic = {
quality: scr_add_item,
};
if (bionics < 10) {
if (has_trait("flesh_is_weak")) {
add_or_sub_health(40);
} else {
add_or_sub_health(30);
}
var bionic_possible = [];
var _body_parts = UNIT_BODY_PARTS;
for (var body_part = 0; body_part < array_length(_body_parts); body_part++) {
part = _body_parts[body_part];
if (!get_body_data("bionic", part)) {
array_push(bionic_possible, part);
}
}
if (array_length(bionic_possible) > 0) {
if (area != "none") {
if (array_contains(bionic_possible, area)) {
new_bionic_pos = area;
} else {
return 0;
}
} else {
new_bionic_pos = bionic_possible[irandom(array_length(bionic_possible) - 1)];
}
bionics++;
alter_body(new_bionic_pos, "bionic", new_bionic);
if (array_contains(["left_leg", "right_leg"], new_bionic_pos)) {
constitution += 2;
strength++;
dexterity -= 2;
body[$ new_bionic_pos][$ "bionic"].variant = irandom(100);
} else if (array_contains(["left_eye", "right_eye"], new_bionic_pos)) {
body[$ new_bionic_pos][$ "bionic"].variant = irandom(100);
constitution += 1;
wisdom += 1;
dexterity++;
} else if (array_contains(["left_arm", "right_arm"], new_bionic_pos)) {
body[$ new_bionic_pos][$ "bionic"].variant = irandom(100);
constitution += 2;
strength += 2;
weapon_skill--;
} else if (new_bionic_pos == "torso") {
constitution += 4;
strength++;
dexterity--;
} else if (new_bionic_pos == "throat") {
charisma--;
} else {
constitution++;
}
if (has_trait("flesh_is_weak")) {
piety++;
}

// Identify eligible parts
var _eligible_parts = [];
var _body_parts = UNIT_BODY_PARTS;
for (var i = 0, _len = array_length(_body_parts); i < _len; i++) {
var _part_name = _body_parts[i];
if (!get_body_data("bionic", _part_name)) {
array_push(_eligible_parts, _part_name);
}
if (hp() > max_health()) {
update_health(max_health());
}

if (array_length(_eligible_parts) == 0) {
return false;
}

// Determine target part
var _target_part = _area;
if (_target_part == "none") {
_target_part = _eligible_parts[irandom(array_length(_eligible_parts) - 1)];
} else if (!array_contains(_eligible_parts, _target_part)) {
return false;
}

// Consume from armoury
if (_from_armoury) {
if (scr_item_count("Bionics", _quality) < 1) {
return false;
}
scr_add_item("Bionics", -1, _quality);
}

// Apply Health Bonus
var _hp_gain = has_trait("flesh_is_weak") ? 40 : 30;
add_or_sub_health(_hp_gain);

// Apply Bionic
var _bionic_data = {
quality: _quality,
variant: irandom(100),
};

alter_body(_target_part, "bionic", _bionic_data);
bionics++;

// Stat Modifications
switch (_target_part) {
case "left_leg":
case "right_leg":
constitution += 2;
strength += 1;
dexterity -= 2;
break;
case "left_eye":
case "right_eye":
constitution += 1;
wisdom += 1;
dexterity += 1;
break;
case "left_arm":
case "right_arm":
constitution += 2;
strength += 2;
weapon_skill -= 1;
break;
case "torso":
constitution += 4;
strength += 1;
dexterity -= 1;
break;
case "throat":
charisma -= 1;
break;
default:
constitution += 1;
break;
}

if (has_trait("flesh_is_weak")) {
piety++;
}

if (hp() > max_health()) {
update_health(max_health());
}

return true;
};

static age = function() {
Expand Down
1 change: 0 additions & 1 deletion scripts/scr_special_view/scr_special_view.gml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ function scr_special_view(command_group) {
unit = apothecaries[i];
array_push(_already_used, unit.marine_number);
add_man_to_manage_arrays(apothecaries[i]);
//if (unit.role()== obj_ini.role[0][v]=obj_ini.role[100][15]) then ma_promote[b]=1;
}
}

Expand Down
12 changes: 9 additions & 3 deletions scripts/scr_ui_manage/scr_ui_manage.gml
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ function scr_ui_manage() {
/// @mixin
function draw_manage_selection_buttons(xx, yy) {
var sel_loading = obj_controller.selecting_ship;
var _unit_focus = obj_controller.unit_focus;
var _non_control_loc = location_out_of_player_control(selecting_location);
//draws hover over tooltips
function gen_tooltip(tooltip_array) {
Expand Down Expand Up @@ -1286,9 +1287,8 @@ function draw_manage_selection_buttons(xx, yy) {

button.label = "Reload";
//button.keystroke = (keyboard_check(vk_shift) && (keyboard_check_pressed(ord("F"))));
if (instance_exists(obj_controller) && is_struct(obj_controller.unit_focus)) {
var selected_unit = obj_controller.unit_focus;
button.tooltip = $"{selected_unit.last_ship.name}"; //Press Shift F";
if (instance_exists(obj_controller) && is_struct(_unit_focus)) {
button.tooltip = $"{_unit_focus.last_ship.name}"; //Press Shift F";
}
reload_possible = man_size > 0 && sel_loading == -1;
if (reload_possible) {
Expand Down Expand Up @@ -1361,6 +1361,9 @@ function draw_manage_selection_buttons(xx, yy) {
if (button.draw()) {
if (bionics_possible) {
add_bionics_selection();
if (is_struct(_unit_focus)) {
reset_manage_unit_constants(_unit_focus);
}
}
}

Expand Down Expand Up @@ -1390,6 +1393,9 @@ function draw_manage_selection_buttons(xx, yy) {
button.alpha = 1;
if (button.draw()) {
reset_selection_equipment();
if (is_struct(_unit_focus)) {
reset_manage_unit_constants(_unit_focus);
}
}
} else {
button.alpha = 0.5;
Expand Down
38 changes: 21 additions & 17 deletions scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml
Original file line number Diff line number Diff line change
Expand Up @@ -561,25 +561,29 @@ function toggle_selection_borders() {
}
}

/// @mixin
function add_bionics_selection() {
var bionics_before = scr_item_count("Bionics");
if (bionics_before > 0) {
for (var p = 0; p < array_length(display_unit); p++) {
if (man_sel[p] != 0 && is_struct(display_unit[p])) {
var _unit = display_unit[p];
var comp = _unit.company;
var mar_id = _unit.marine_number;
if (_unit.controllable()) {
//TODO swap for tag method
if (string_count("Dread", ma_armour[p]) == 0) {
_unit.add_bionics();
if (ma_promote[p] == 10) {
ma_promote[p] = 0;
}
}
}
}
if (scr_item_count("Bionics") <= 0) {
return;
}

for (var i = 0, _len = array_length(display_unit); i < _len; i++) {
/// @type {Struct.TTRPG_stats}
var _unit = display_unit[i];

if (man_sel[i] == 0 || !is_struct(_unit)) {
continue;
}

if (!_unit.controllable()) {
continue;
}

if (string_pos("Dread", ma_armour[i]) > 0) {
continue;
}

_unit.add_bionics();
}
}

Expand Down
Loading