void CreatureAttributes::consume(Creature* self, const CreatureAttributes& other) { Debug() << name->bare() << " consume " << other.name->bare(); self->you(MsgType::CONSUME, other.name->the()); consumeBodyParts(self, other); if (other.isHumanoid() && !isHumanoid() && numBodyParts(BodyPart::ARM) >= 2 && numBodyParts(BodyPart::LEG) >= 2 && numBodyParts(BodyPart::HEAD) >= 1) { self->you(MsgType::BECOME, "a humanoid"); self->addPersonalEvent(getName().the() + " turns into a humanoid"); humanoid = true; } vector<string> adjectives; for (auto t : ENUM_ALL(AttrType)) consumeAttr(attr[t], other.attr[t], adjectives, getAttrNameMore(t)); consumeAttr(*size, *other.size, adjectives, "larger"); consumeAttr(*weight, *other.weight, adjectives, ""); consumeAttr(barehandedDamage, other.barehandedDamage, adjectives, "more dangerous"); consumeAttr(barehandedAttack, other.barehandedAttack, adjectives, ""); consumeAttr(attackEffect, other.attackEffect, adjectives, ""); consumeAttr(passiveAttack, other.passiveAttack, adjectives, ""); consumeAttr(gender, other.gender, adjectives); consumeAttr(skills, other.skills, adjectives); if (!adjectives.empty()) { self->you(MsgType::BECOME, combine(adjectives)); self->addPersonalEvent(getName().the() + " becomes " + combine(adjectives)); } consumeBodyParts(self,other); consumeEffects(other.permanentEffects); }
void CreatureAttributes::consume(Creature* self, CreatureAttributes& other) { INFO << name.bare() << " consume " << other.name.bare(); self->you(MsgType::CONSUME, other.name.the()); self->addPersonalEvent(self->getName().a() + " absorbs " + other.name.a()); vector<string> adjectives; body->consumeBodyParts(self, other.getBody(), adjectives); for (auto t : ENUM_ALL(AttrType)) consumeAttr(attr[t], other.attr[t], adjectives, getAttrNameMore(t), getAbsorbtionLevelCap(t)); consumeAttr(passiveAttack, other.passiveAttack, adjectives, ""); consumeAttr(gender, other.gender, adjectives); consumeAttr(skills, other.skills, adjectives); if (!adjectives.empty()) { self->you(MsgType::BECOME, combine(adjectives)); self->addPersonalEvent(getName().the() + " becomes " + combine(adjectives)); } consumeEffects(other.permanentEffects); }