Exemplo n.º 1
0
void consumeAttr(optional<T>& mine, const optional<T>& his, vector<string>& adjectives, const string& adj) {
  if (consumeProb() && !mine && his) {
    mine = *his;
    if (!adj.empty())
      adjectives.push_back(adj);
  }
}
Exemplo n.º 2
0
void consumeAttr(T& mine, const T& his, vector<string>& adjectives, const string& adj) {
  if (consumeProb() && mine < his) {
    mine = his;
    if (!adj.empty())
      adjectives.push_back(adj);
  }
}
Exemplo n.º 3
0
void CreatureAttributes::consumeEffects(const EnumMap<LastingEffect, int>& permanentEffects) {
  for (LastingEffect effect : ENUM_ALL(LastingEffect))
    if (permanentEffects[effect] > 0 && !isAffectedPermanently(effect) && consumeProb() &&
        LastingEffects::canConsume(effect)) {
      addPermanentEffect(effect, 1);
    }
}
Exemplo n.º 4
0
void consumeAttr(T& mine, const T& his, vector<string>& adjectives, const string& adj, const int& cap) {
  int hisCapped = (his > cap) ? cap : his;
  if (consumeProb() && mine < hisCapped) {
    mine = hisCapped;
    if (!adj.empty())
      adjectives.push_back(adj);
  }
}
Exemplo n.º 5
0
void consumeAttr(Skillset& mine, const Skillset& his, vector<string>& adjectives) {
  bool was = false;
  for (SkillId id : his.getAllDiscrete())
    if (!mine.hasDiscrete(id) && Skill::get(id)->transferOnConsumption() && consumeProb()) {
      mine.insert(id);
      was = true;
    }
  for (SkillId id : ENUM_ALL(SkillId)) {
    if (!Skill::get(id)->isDiscrete() && mine.getValue(id) < his.getValue(id)) {
      mine.setValue(id, his.getValue(id));
      was = true;
    }
  }
  if (was)
    adjectives.push_back("more skillfull");
}
Exemplo n.º 6
0
void consumeAttr(Gender& mine, const Gender& his, vector<string>& adjectives) {
  if (consumeProb() && mine != his) {
    mine = his;
    adjectives.emplace_back(mine == Gender::male ? "more masculine" : "more feminine");
  }
}
Exemplo n.º 7
0
void consumeAttr(Gender& mine, const Gender& his, vector<string>& adjectives) {
  if (consumeProb() && mine != his) {
    mine = his;
    adjectives.emplace_back(get(mine, "more masculine", "more feminine", "more neuter"));
  }
}