本文整理汇总了C++中Object::AddAct方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::AddAct方法的具体用法?C++ Object::AddAct怎么用?C++ Object::AddAct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::AddAct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddMOB
void Object::AddMOB(const MOBType *type) {
Object *mob = new Object(this);
mob->Attach(get_mob_mind());
mob->Activate();
mob->SetPos(POS_STAND);
mob->SetAttribute(0, type->b + rand() % type->bm);
mob->SetAttribute(1, type->q + rand() % type->qm);
mob->SetAttribute(2, type->s + rand() % type->sm);
mob->SetAttribute(3, type->c + rand() % type->cm);
mob->SetAttribute(4, type->i + rand() % type->im);
mob->SetAttribute(5, type->w + rand() % type->wm);
typeof(type->skills.begin()) sk_it;
for(sk_it = type->skills.begin(); sk_it != type->skills.end(); ++sk_it) {
if(sk_it->second.first < 0) {
mob->SetSkill(sk_it->first, sk_it->second.second);
}
else {
mob->SetSkill(sk_it->first,
mob->Attribute(get_linked(sk_it->first))
* sk_it->second.first / 100
- rand() % sk_it->second.second
);
}
//fprintf(stderr, "DBG: %d %d %d\n", get_linked(sk_it->first), sk_it->second.first, sk_it->second.second);
}
mob->SetShortDesc(type->name.c_str());
mob->SetDesc(type->desc.c_str());
mob->SetLongDesc(type->long_desc.c_str());
if(type->genders.length() > 0) {
mob->SetGender(type->genders[rand() % type->genders.length()]);
}
mob->SetDesc(gender_proc(type->desc.c_str(), mob->Gender()).c_str());
mob->SetLongDesc(gender_proc(type->long_desc.c_str(), mob->Gender()).c_str());
if(type->g > 0 || type->gm > 1) give_gold(mob, type->g + rand() % type->gm);
if(type->armed) {
Object *obj = new Object(mob);
obj->SetSkill("WeaponType", type->armed->type);
obj->SetSkill("WeaponReach", type->armed->reach);
obj->SetSkill("WeaponForce",
type->armed->force + rand() % type->armed->forcem);
obj->SetSkill("WeaponSeverity",
type->armed->sev + rand() % type->armed->sevm);
obj->SetShortDesc(type->armed->name.c_str());
obj->SetDesc(type->armed->desc.c_str());
obj->SetLongDesc(type->armed->long_desc.c_str());
obj->SetWeight(type->armed->weight);
obj->SetVolume(type->armed->volume);
obj->SetValue(type->armed->value);
obj->SetPos(POS_LIE);
mob->AddAct(ACT_WIELD, obj);
if(two_handed(type->armed->type)) mob->AddAct(ACT_HOLD, obj);
}
typeof(type->armor.begin()) ar_it;
for(ar_it = type->armor.begin(); ar_it != type->armor.end(); ++ar_it) {
if(wear_attribs.size() <= 0) {
init_wear_attribs();
}
Object *obj = new Object(mob);
obj->SetAttribute(0, (*ar_it)->bulk + rand() %(*ar_it)->bulkm);
obj->SetSkill("ArmorB", (*ar_it)->bulk + rand() %(*ar_it)->bulkm);
obj->SetSkill("ArmorI", (*ar_it)->impact + rand() %(*ar_it)->impactm);
obj->SetSkill("ArmorT", (*ar_it)->thread + rand() %(*ar_it)->threadm);
obj->SetSkill("ArmorP", (*ar_it)->planar + rand() %(*ar_it)->planarm);
obj->SetShortDesc((*ar_it)->name.c_str());
obj->SetDesc((*ar_it)->desc.c_str());
obj->SetLongDesc((*ar_it)->long_desc.c_str());
obj->SetWeight((*ar_it)->weight);
obj->SetVolume((*ar_it)->volume);
obj->SetValue((*ar_it)->value);
obj->SetPos(POS_LIE);
typeof((*ar_it)->loc.begin()) l_it;
for(l_it = (*ar_it)->loc.begin(); l_it != (*ar_it)->loc.end(); ++l_it) {
obj->SetSkill(wear_attribs[*l_it], 1);
mob->AddAct(*l_it, obj);
}
}
}