1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-25 14:43:01 +00:00

ru:: cat/capybara morphs (do not unmorph correctly yet)

This commit is contained in:
Zeno Rogue 2025-05-24 18:12:01 +02:00
parent 6fa502c4e9
commit ec90291da5
4 changed files with 81 additions and 5 deletions

View File

@ -303,6 +303,7 @@ struct man : public entity {
int attack_facing;
int attack_when;
int on_floor_when;
entity *morphed = nullptr;
int last_action;
@ -319,9 +320,18 @@ struct man : public entity {
next.reset(); current.reset();
postfix();
}
xy siz() override { return {12, 12}; }
string glyph() override { return "@"; }
color_t color() override { return 0xFF8080FF; }
xy siz() override {
if(morphed) return morphed->siz();
return {12, 12};
}
string glyph() override {
if(morphed) return morphed->glyph();
return "@";
}
color_t color() override {
if(morphed) return morphed->color();
return 0xFF8080FF;
}
void act() override;
void draw() override;
virtual bool hurt_by_spikes() { return true; }
@ -446,6 +456,33 @@ struct vtrap : public entity {
string get_help() override { return "A deadly but invisible trap."; }
};
struct cat_color {
string name;
color_t col;
};
struct cat : public enemy {
cat_color col;
cat();
xy siz() override { return {5, 5}; }
string glyph() override { return "f"; }
color_t color() override { return col.col; }
string get_name() override { return col.name + " cat"; }
string get_help() override { return "Do not fight cats!"; }
int base_xp() { return 10; }
int max_hp() { return 20; }
};
struct capybara : public enemy {
xy siz() override { return {6, 6}; }
string glyph() override { return "C"; }
color_t color() override { return 0xC08040FF; }
string get_name() override { return "capybara"; }
string get_help() override { return "Do not fight capybaras!"; }
int base_xp() { return 15; }
int max_hp() { return 40; }
};
struct boar : public enemy {
xy siz() override { return {18, 18}; }
string glyph() override { return "B"; }

View File

@ -658,4 +658,14 @@ void bat::attacked(int dmg) {
if(where.y > m.where.y) vel.y = +abs(vel.y);
}
vector<cat_color> cat_colors = {
cat_color{"red", 0xC04040FF},
cat_color{"black", 0x505060FF},
cat_color{"white", 0xF0F0F0FF}
};
cat::cat() {
col = hrand_elt(cat_colors);
}
}

View File

@ -87,9 +87,35 @@ 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);
});
cat_color morph_cat_color;
// morph powers
randeff morph_cat("Cat", "Turns you into a cat.", "You turn into a cat!", [] (data &d) { });
randeff morph_capy("Capybara", "Turns you into a capybara.", "You turn into a capybara!", [] (data &d) { });
randeff morph_cat("Cat", "Turns you into a cat.", "You turn into a cat!", [] (data &d) {
if(d.mode == rev::start || (d.mode == rev::active && d.keystate == 1) || (d.mode == rev::stop && m.morphed)) {
if(m.morphed) {
delete(m.morphed), m.morphed = nullptr;
addMessage("You morph back into a human.");
}
else {
auto mcat = new cat;
mcat->col = morph_cat_color;
m.morphed = mcat;
addMessage("You morph into a " + m.morphed->get_name() + "!");
}
}
});
randeff morph_capy("Capybara", "Turns you into a capybara.", "You turn into a capybara!", [] (data &d) {
if(d.mode == rev::start || (d.mode == rev::active && d.keystate == 1) || (d.mode == rev::stop && m.morphed)) {
if(m.morphed) {
delete(m.morphed), m.morphed = nullptr;
addMessage("You morph back into a human.");
}
else {
m.morphed = new capybara;
addMessage("You morph into a lovely capybara!");
}
}
});
vector<power*> all_weapons() {
vector<power*> res;
@ -115,6 +141,7 @@ void assign_potion_powers() {
find_power("reach").randeffs = relist{ pick(&jump_double, &jump_high, &jump_bubble, &jump_light), random_powers[3] };
find_power("fire").randeffs = relist{ pick(&fire_spit, &fire_weapon), random_powers[4] };
find_power("mystery").randeffs = relist{ random_powers[5], random_powers[6], random_powers[7] };
morph_cat_color = hrand_elt(cat_colors);
}
}

View File

@ -209,6 +209,8 @@ void init_scales() {
letterscales[')'] = euscale(2.5, 1);
letterscales['('] = euscale(2.5, 1);
letterscales['F'] = euscale(2.1, 1.3);
letterscales['C'] = euscale(1.8, 1.3);
letterscales['f'] = euscale(2.5, 1.3);
}
void asciiletter(ld minx, ld miny, ld maxx, ld maxy, const string& ch, color_t col) {