/** * Describe stat sustains. */ static bool describe_sustains(textblock *tb, const bitflag flags[OF_SIZE]) { const char *descs[STAT_MAX]; int i, count = 0; for (i = 0; i < STAT_MAX; i++) { struct obj_property *prop = lookup_obj_property(OBJ_PROPERTY_STAT, i); if (of_has(flags, sustain_flag(prop->index))) descs[count++] = prop->name; } if (!count) return false; textblock_append(tb, "Sustains "); info_out_list(tb, descs, count); return true; }
/** * Special display, part 2c * * How to print out the modifications and sustains. * Positive mods with no sustain will be light green. * Positive mods with a sustain will be dark green. * Sustains (with no modification) will be a dark green 's'. * Negative mods (from a curse) will be red. * Huge mods (>9), like from MICoMorgoth, will be a '*' * No mod, no sustain, will be a slate '.' */ static void display_player_sust_info(void) { int i, row, col, stat; struct object *obj; bitflag f[OF_SIZE]; byte a; char c; /* Row */ row = 2; /* Column */ col = 26; /* Header */ c_put_str(COLOUR_WHITE, "abcdefghijkl@", row-1, col); /* Process equipment */ for (i = 0; i < player->body.count; ++i) { /* Get the object */ obj = slot_object(player, i); if (!obj) { col++; continue; } /* Get the "known" flags */ object_flags_known(obj, f); /* Initialize color based on sign of modifier. */ for (stat = OBJ_MOD_MIN_STAT; stat < OBJ_MOD_MIN_STAT + STAT_MAX; stat++) { /* Default */ a = COLOUR_SLATE; c = '.'; /* Boosted or reduced */ if (obj->modifiers[stat] > 0) { /* Good */ a = COLOUR_L_GREEN; /* Label boost */ if (obj->modifiers[stat] < 10) c = I2D(obj->modifiers[stat]); } else if (obj->modifiers[stat] < 0) { /* Bad */ a = COLOUR_RED; /* Label boost */ if (obj->modifiers[stat] > -10) c = I2D(-(obj->modifiers[stat])); } /* Sustain */ if (of_has(f, sustain_flag(stat))) { /* Dark green */ a = COLOUR_GREEN; /* Convert '.' to 's' */ if (c == '.') c = 's'; } if ((c == '.') && obj && !object_flag_is_known(obj, sustain_flag(stat))) c = '?'; /* Dump proper character */ Term_putch(col, row+stat, a, c); } /* Advance */ col++; } /* Player flags */ player_flags(player, f); /* Check stats */ for (stat = 0; stat < STAT_MAX; ++stat) { /* Default */ a = COLOUR_SLATE; c = '.'; /* Sustain */ if (of_has(f, sustain_flag(stat))) { /* Dark green "s" */ a = COLOUR_GREEN; c = 's'; } /* Dump */ Term_putch(col, row+stat, a, c); } /* Column */ col = 26; /* Footer */ c_put_str(COLOUR_WHITE, "abcdefghijkl@", row+6, col); /* Equippy */ display_player_equippy(row+7, col); }