refactored to use isDie if applicable

This commit is contained in:
Zeno Rogue 2021-05-30 13:48:24 +02:00
parent b63a70f279
commit be5194958e
8 changed files with 9 additions and 9 deletions

View File

@ -105,7 +105,7 @@ EX bool canAttack(cell *c1, eMonster m1, cell *c2, eMonster m2, flagtype flags)
if(m1 == moArrowTrap && arrow_stuns(m2)) return true;
if(among(m2, moAnimatedDie, moAngryDie) && !(flags & (AF_MAGIC | AF_CRUSH))) return false;
if(isDie(m2) && !(flags & (AF_MAGIC | AF_CRUSH))) return false;
if(among(m2, moAltDemon, moHexDemon, moPair, moCrusher, moNorthPole, moSouthPole, moMonk) && !(flags & (AF_EAT | AF_MAGIC | AF_BULL | AF_CRUSH)))
return false;

View File

@ -1601,7 +1601,7 @@ void celldrawer::draw_features() {
poly_outline = OUTLINE_DEFAULT;
}
else if(among(c->wall, waRichDie, waHappyDie)) {
else if(isDie(c->wall)) {
color_t col = darkena(winf[c->wall].color, 0, 0xFF);
ld footphase;

View File

@ -1120,7 +1120,7 @@ EX namespace dice {
}
EX bool on(cell *c) {
return among(c->wall, waRichDie, waHappyDie) || among(c->monst, moAnimatedDie, moAngryDie);
return isDie(c->wall) || isDie(c->monst);
}
EX void roll(movei mi) {

View File

@ -379,7 +379,7 @@ EX void pushThumper(const movei& mi) {
cto->wall = waCrateOnTarget;
th->wall = waCrateTarget;
}
else if(among(w, waRichDie, waHappyDie)) {
else if(isDie(w)) {
th->wall = waNone;
cto->wall = w;
dice::roll(mi);

View File

@ -2886,7 +2886,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
// golems, knights, and hyperbugs don't face the player (mondir-controlled)
// also whatever in the lineview mode, and whatever in the quotient geometry
else if(among(c->monst, moAnimatedDie, moAngryDie)) {
else if(isDie(c->monst)) {
transmatrix U = inverse_shift(Vparam, Vs);
U = rgpushxto0(tC0(U));
die_target = Vparam;

View File

@ -103,7 +103,7 @@ EX void moveEffect(const movei& mi, eMonster m) {
tortoise::move_baby(cf, ct);
}
if(among(m, moAnimatedDie, moAngryDie) && mi.proper())
if(isDie(m) && mi.proper())
dice::roll(mi);
}
@ -1157,7 +1157,7 @@ EX void groupmove2(const movei& mi, eMonster movtype, flagtype mf) {
onpath(from, 0);
if(among(mi.t->monst, moAnimatedDie, moAngryDie)) {
if(isDie(mi.t->monst)) {
/* other dice will not pathfind through the original cell */
/* this makes it easier for the player to roll dice correctly */
onpath(c, 0);

View File

@ -544,7 +544,7 @@ EX bool passable_for(eMonster m, cell *w, cell *from, flagtype extra) {
if(extra & P_ONPLAYER) {
if(isPlayerOn(w)) return true;
}
if(from && among(from->monst, moAnimatedDie, moAngryDie)) {
if(from && isDie(from->monst)) {
bool ok = false;
for(int i=0; i<from->type; i++) {
if(from->move(i) != w) continue;

View File

@ -2462,7 +2462,7 @@ void activateMonstersAt(cell *c) {
}
if(c->monst && isMimic(c->monst)) c->monst = moNone;
// mimics are awakened by awakenMimics
if(c->monst && !isIvy(c) && !isWorm(c) && !isMutantIvy(c) && !isKraken(c->monst) && c->monst != moPrincess && c->monst != moHunterGuard && !among(c->monst, moAnimatedDie, moAngryDie)) {
if(c->monst && !isIvy(c) && !isWorm(c) && !isMutantIvy(c) && !isKraken(c->monst) && c->monst != moPrincess && c->monst != moHunterGuard && !isDie(c->monst)) {
// awaken as a monster
monster *enemy = new monster;
enemy->at = Id;