fix for https://github.com/Attnam/ivan/issues/119
[k8-i-v-a-n.git] / src / game / humans / humanoid_communist.cpp
blobdd792195dc30342dd8ee459416d1574a14b7243c
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"); }
21 void communist::BeTalkedTo () {
22 if (GetRelation(PLAYER) != HOSTILE && GetTeam() != PLAYER->GetTeam() && PLAYER->GetRelativeDanger(this, true) > 0.1) {
23 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());
24 for (std::list<character*>::const_iterator i = GetTeam()->GetMember().begin(); i != GetTeam()->GetMember().end();) {
25 if (*i != this) {
26 character* Char = *i++;
27 Char->ChangeTeam(PLAYER->GetTeam());
28 if (GetTeam()->GetMembers() == 1) break; // only Ivan left in Party
29 } else {
30 ++i;
33 ChangeTeam(PLAYER->GetTeam());
34 } else if (GetTeam() != PLAYER->GetTeam() && !(RAND() % 5)) {
35 ADD_MESSAGE("\"You weak. Learn killing and come back.\"");
36 } else {
37 character::BeTalkedTo();
42 truth communist::MoveRandomly () {
43 switch (RAND()%1000) {
44 case 0:
45 if (CanBeSeenByPlayer()) ADD_MESSAGE("%s engraves something to the ground.", CHAR_NAME(UNARTICLED));
46 Engrave(CONST_S("The bourgeois is a bourgeois -- for the benefit of the working class."));
47 return true;
48 case 1:
49 if (CanBeSeenByPlayer()) ADD_MESSAGE("%s engraves something to the ground.", CHAR_NAME(UNARTICLED));
50 Engrave(CONST_S("Proletarians of all countries, unite!"));
51 return true;
52 case 2:
53 if (CanBeSeenByPlayer()) ADD_MESSAGE("%s engraves something to the ground.", CHAR_NAME(UNARTICLED));
54 Engrave(CONST_S("Capital is therefore not only personal; it is a social power."));
55 return true;
56 default:
57 return character::MoveRandomly();
62 truth communist::BoundToUse (citem* Item, int I) const {
63 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);
71 #endif