`NaturalTeam` for characters
[k8-i-v-a-n.git] / src / game / humans / humanoid_communist.cpp
blobb5af01c44967bb4c4752eb05adab6891525c071f
1 #ifdef HEADER_PHASE
2 CHARACTER(communist, humanoid)
4 public:
5 virtual truth MoveRandomly();
6 virtual void BeTalkedTo();
7 virtual truth BoundToUse(citem*, int) const;
8 //virtual truth MustBeRemovedFromBone() const;
9 protected:
10 virtual truth ShowClassDescription() const;
14 #else
17 truth communist::ShowClassDescription () const { return (GetAssignedName() != "Ivan"); }
20 void communist::BeTalkedTo () {
21 if (GetRelation(PLAYER) != HOSTILE && GetTeam() != PLAYER->GetTeam() && PLAYER->GetRelativeDanger(this, true) > 0.1) {
22 ADD_MESSAGE("%s seems to be very friendly. \"%s make good communist. %s go with %s!\"", CHAR_DESCRIPTION(DEFINITE), PLAYER->GetAssignedName().CStr(), CHAR_NAME(UNARTICLED), PLAYER->GetAssignedName().CStr());
23 for (std::list<character*>::const_iterator i = GetTeam()->GetMember().begin(); i != GetTeam()->GetMember().end();) {
24 if (*i != this) {
25 character* Char = *i++;
26 Char->ChangeTeam(PLAYER->GetTeam());
27 if (GetTeam()->GetMembers() == 1) break; // only Ivan left in Party
28 } else {
29 ++i;
32 ChangeTeam(PLAYER->GetTeam());
33 } else if (GetTeam() != PLAYER->GetTeam() && !(RAND() % 5)) {
34 ADD_MESSAGE("\"You weak. Learn killing and come back.\"");
35 } else {
36 character::BeTalkedTo();
41 truth communist::MoveRandomly () {
42 switch (RAND()%1000) {
43 case 0:
44 if (CanBeSeenByPlayer()) ADD_MESSAGE("%s engraves something to the ground.", CHAR_NAME(UNARTICLED));
45 Engrave(CONST_S("The bourgeois is a bourgeois -- for the benefit of the working class."));
46 return true;
47 case 1:
48 if (CanBeSeenByPlayer()) ADD_MESSAGE("%s engraves something to the ground.", CHAR_NAME(UNARTICLED));
49 Engrave(CONST_S("Proletarians of all countries, unite!"));
50 return true;
51 case 2:
52 if (CanBeSeenByPlayer()) ADD_MESSAGE("%s engraves something to the ground.", CHAR_NAME(UNARTICLED));
53 Engrave(CONST_S("Capital is therefore not only personal; it is a social power."));
54 return true;
55 default:
56 return character::MoveRandomly();
61 truth communist::BoundToUse (citem* Item, int I) const {
62 return (Item && Item->IsGorovitsFamilyRelic() && Item->IsInCorrectSlot(I));
67 truth communist::MustBeRemovedFromBone () const {
68 //return (!IsEnabled() || GetTeam()->GetID() != IVAN_TEAM || GetDungeon()->GetIndex() != ELPURI_CAVE || GetLevel()->GetIndex() != IVAN_LEVEL);
69 return (!IsEnabled() || GetTeam()->GetID() != IVAN_TEAM || IsHomeLevel(GetLevel()));
74 #endif