1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-01-02 02:19:02 +00:00

ru:: unified potioon/jewelry flavors with cat colors under the common type name 'flavor'

This commit is contained in:
Zeno Rogue
2025-12-07 19:32:11 +01:00
parent 3641b523ca
commit cad0658675
6 changed files with 59 additions and 54 deletions

View File

@@ -34,13 +34,14 @@ struct power {
string name;
string desc;
string glyph;
flavor fl;
color_t color;
powerfun pf;
int id_status;
int qty_filled;
int qty_owned;
flagtype flags;
int random_flavor;
int random_value;
vector<struct randeff*> randeffs;
void init();
vector<pair<mod, int>> mods;
@@ -358,7 +359,7 @@ struct man : public entity {
int experience;
stat profession;
string backstory;
namedcolor hair, eye;
flavor hair, eye;
statarray<int> base_stats;
statdata current, next;
@@ -512,10 +513,10 @@ struct vtrap : public located_entity {
string get_help() override { return "A deadly but invisible trap."; }
};
void sact(stater& s, string t, namedcolor co) { s.act(t+".name", co.name, "black").act(t+".col", co.col, 0xFFFFFFFF); }
void sact(stater& s, string t, flavor co) { s.act(t+".name", co.name, "black").act(t+".col", co.col, 0xFFFFFFFF); }
struct cat : public enemy {
namedcolor col;
flavor col;
cat();
xy siz() override { return {5, 5}; }
string glyph() override { return "f"; }

44
rogueviz/ru/flavors.cpp Normal file
View File

@@ -0,0 +1,44 @@
namespace rogue_unlike {
struct flavor {
string name;
color_t col;
};
flavor
// cat colors
cc_red{"red", 0xC04040FF},
cc_black{"black", 0x505060FF},
cc_white{"white", 0xF0F0F0FF},
// hair colors
hc_blonde{"blonde", 0xF0F0D0FF},
hc_brownhair{"brown", 0x706030FF},
hc_red{"red", 0xC04040FF},
// eye colors
ec_green{"green", 0x40F040FF},
ec_blue{"green", 0x40F040FF},
ec_browneye{"brown", 0xA07030FF},
// potion colors
pc_bubbling{"bubbling", 0xC0C0C0FF},
pc_golden{"golden", 0xFFD500FF},
pc_red{"red", 0xC00000FF},
pc_blue{"blue", 0x0000C0FF},
pc_green{"green", 0x00C000FF},
pc_white{"white", 0xFFFFFFFF},
pc_black{"black", 0x303030FF},
// jewelry flavors
jc_steel{"steel", 0xA0A0C0FF},
jc_amethyst{"amethyst", 0xC060C0FF},
jc_ruby{"ruby", 0xC06060FF},
jc_sapphire{"sapphire", 0x6060C0FF},
jc_emerald{"emerald", 0x60C060FF};
vector<flavor> cat_colors = { cc_red, cc_black, cc_white };
vector<flavor> potion_colors = { pc_bubbling, pc_golden, pc_red, pc_blue, pc_green, pc_white, pc_black };
vector<flavor> jewelry_colors = { jc_steel, jc_amethyst, jc_ruby, jc_sapphire, jc_emerald };
}

View File

@@ -1,22 +0,0 @@
namespace rogue_unlike {
struct namedcolor {
string name;
color_t col;
};
namedcolor
// cat colors
nc_red{"red", 0xC04040FF},
nc_black{"red", 0x505060FF},
nc_white{"white", 0xF0F0F0FF},
// hair colors
nc_blonde{"blonde", 0xF0F0D0FF},
nc_brownhair{"brown", 0x706030FF},
// eye colors
nc_green{"green", 0x40F040FF},
nc_browneye{"brown", 0xA07030FF};
vector<namedcolor> cat_colors = { nc_red, nc_black, nc_white };
}

View File

@@ -52,33 +52,15 @@ power& power::be_resource(string s) {
return self;
}
using flavor = pair<string, color_t>;
int next_potion, next_jewelry;
vector<flavor> jewelry_colors = {
{"steel", 0xA0A0C0FF},
{"amethyst", 0xC060C0FF},
{"ruby", 0xC06060FF},
{"sapphire", 0x6060C0FF},
{"emerald", 0x60C060FF},
};
vector<flavor> potion_colors = {
{"bubbling", 0xC0C0C0FF},
{"golden", 0xFFD500FF},
{"red", 0xC00000FF},
{"blue", 0x0000C0FF},
{"green", 0x00C000FF},
{"white", 0xFFFFFFFF},
{"black", 0x303030FF},
};
power& power::be_jewelry(string jtype, string xdesc) {
int nj = next_jewelry++;
reshuffle = [this, nj] { fl = jewelry_colors[nj]; };
picked_up = [this] (int x) { qty_owned += x; qty_filled = max(qty_filled, x); };
get_color = [nj] { return jewelry_colors[nj].second; };
get_name = [nj, this, jtype] {
string fname = jewelry_colors[nj].first + " " + jtype;
get_color = [this] { return fl.col; };
get_name = [this, jtype] {
string fname = fl.name + " " + jtype;
if(flags & IDENTIFIED) fname = fname + " of " + name;
fname = addqof(fname, this);
return fname;
@@ -120,11 +102,11 @@ string replace_weapon(string s, power *wpn) {
power& power::be_potion() {
int np = next_potion++;
picked_up = [this] (int x) { qty_owned += x; qty_filled = max(qty_filled, x); };
get_color = [np] { return potion_colors[np].second; };
get_color = [this] { return fl.col; };
refill = [this] { qty_filled = qty_owned; };
reshuffle = [this] { random_flavor = rand() % 5040; flags &=~ IDENTIFIED; };
get_name = [np, this] {
string fname = potion_colors[np].first + " potion";
reshuffle = [this, np] { fl = potion_colors[np]; flags &=~ IDENTIFIED; };
get_name = [this] {
string fname = fl.name + " potion";
if(flags & (PARTIAL | IDENTIFIED)) fname = fname + " of " + name;
int insq = 0;
if(flags & IDENTIFIED)

View File

@@ -122,7 +122,7 @@ randeff fire_weapon("Fiery Weapon", "Attacks with your [weapon] set things on fi
m.next.mods.emplace_back(d.re->which_weapon, mod::burning, 2 * m.current.stats[stat::wis] + 1e-6);
});
namedcolor morph_cat_color;
flavor morph_cat_color;
// morph powers
randeff morph_cat("Cat", "Turns you into a cat.", "You turn into a cat!", [] (data &d) {

View File

@@ -24,7 +24,7 @@ Have fun!
*/
#include "globals.cpp"
#include "namedcolors.cpp"
#include "flavors.cpp"
#include "classes.cpp"
#include "staters.cpp"
#include "geometry.cpp"