| 30 | AgentSheet::AgentSheet(sp<Form> dstForm) : form(dstForm) {} |
| 31 | |
| 32 | void AgentSheet::display(const Agent &item, std::vector<sp<Image>> &ranks, bool turnBased) |
| 33 | { |
| 34 | clear(); |
| 35 | form->findControlTyped<TextEdit>("AGENT_NAME")->setText(item.name); |
| 36 | form->findControlTyped<Graphic>("SELECTED_PORTRAIT")->setImage(item.getPortrait().photo); |
| 37 | |
| 38 | form->findControlTyped<Graphic>("SELECTED_RANK") |
| 39 | ->setImage(item.type->displayRank ? ranks[(int)item.rank] : nullptr); |
| 40 | |
| 41 | form->findControlTyped<Label>("LABEL_1")->setText(tr("Health")); |
| 42 | form->findControlTyped<Graphic>("VALUE_1")->setImage( |
| 43 | createStatsBar(item.initial_stats.health, item.current_stats.health, |
| 44 | item.modified_stats.health, 100, healthColour, {88, 7})); |
| 45 | form->findControlTyped<Graphic>("VALUE_1")->ToolTipText = |
| 46 | form->findControlTyped<Label>("LABEL_1")->getText() + |
| 47 | format(": %d/%d", item.modified_stats.health, item.current_stats.health); |
| 48 | |
| 49 | form->findControlTyped<Label>("LABEL_2")->setText(tr("Accuracy")); |
| 50 | form->findControlTyped<Graphic>("VALUE_2")->setImage( |
| 51 | createStatsBar(item.initial_stats.accuracy, item.current_stats.accuracy, |
| 52 | item.modified_stats.accuracy, 100, accuracyColour, {88, 7})); |
| 53 | form->findControlTyped<Graphic>("VALUE_2")->ToolTipText = |
| 54 | form->findControlTyped<Label>("LABEL_2")->getText() + |
| 55 | format(": %d/%d", item.modified_stats.accuracy, item.current_stats.accuracy); |
| 56 | |
| 57 | form->findControlTyped<Label>("LABEL_3")->setText(tr("Reactions")); |
| 58 | form->findControlTyped<Graphic>("VALUE_3")->setImage( |
| 59 | createStatsBar(item.initial_stats.reactions, item.current_stats.reactions, |
| 60 | item.modified_stats.reactions, 100, reactionsColour, {88, 7})); |
| 61 | form->findControlTyped<Graphic>("VALUE_3")->ToolTipText = |
| 62 | form->findControlTyped<Label>("LABEL_3")->getText() + |
| 63 | format(": %d/%d", item.modified_stats.reactions, item.current_stats.reactions); |
| 64 | |
| 65 | form->findControlTyped<Label>("LABEL_4")->setText(turnBased ? tr("Time Units") : tr("Speed")); |
| 66 | form->findControlTyped<Graphic>("VALUE_4")->ToolTipText = |
| 67 | form->findControlTyped<Label>("LABEL_4")->getText(); |
| 68 | if (turnBased) |
| 69 | { |
| 70 | form->findControlTyped<Graphic>("VALUE_4")->setImage( |
| 71 | createStatsBar(item.initial_stats.time_units, item.current_stats.time_units, |
| 72 | item.modified_stats.time_units, 100, speedColour, {88, 7})); |
| 73 | form->findControlTyped<Graphic>("VALUE_4")->ToolTipText += |
| 74 | format(": %d/%d", item.modified_stats.time_units, item.current_stats.time_units); |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | form->findControlTyped<Graphic>("VALUE_4")->setImage(createStatsBar( |
| 79 | item.initial_stats.getDisplaySpeedValue(), item.current_stats.getDisplaySpeedValue(), |
| 80 | item.modified_stats.getDisplaySpeedValue(), 100, speedColour, {88, 7})); |
| 81 | form->findControlTyped<Graphic>("VALUE_4")->ToolTipText += |
| 82 | format("^ %d/%d", item.modified_stats.getDisplaySpeedValue(), |
| 83 | item.current_stats.getDisplaySpeedValue()); |
| 84 | } |
| 85 | |
| 86 | form->findControlTyped<Label>("LABEL_5")->setText(tr("Stamina")); |
| 87 | form->findControlTyped<Graphic>("VALUE_5")->setImage(createStatsBar( |
| 88 | item.initial_stats.getDisplayStaminaValue(), item.current_stats.getDisplayStaminaValue(), |
| 89 | item.modified_stats.getDisplayStaminaValue(), 100, staminaColour, {88, 7})); |
no test coverage detected