typos
[k8-i-v-a-n.git] / src / game / humans / humanoid_zombie.cpp
blob8e53699a6c7a74340d8fefc95a94512d6e3a7ac0
1 #ifdef HEADER_PHASE
2 CHARACTER(zombie, humanoid)
4 public:
5 virtual void BeTalkedTo();
6 virtual truth BodyPartIsVital(int) const;
7 virtual void CreateBodyParts(int);
8 virtual truth AllowSpoil() const { return true; }
9 void SetDescription(cfestring What) { Description = What; }
10 virtual void Save(outputfile&) const;
11 virtual void Load(inputfile&);
12 virtual festring GetZombieDescription() const;
13 protected:
14 virtual void PostConstruct();
15 virtual void AddPostFix(festring&, int) const;
16 virtual void GetAICommand();
17 virtual truth AllowExperience() const { return false; }
18 festring Description;
22 #else
26 truth zombie::BodyPartIsVital(int I) const { return I == GROIN_INDEX || I == TORSO_INDEX; }
30 festring zombie::GetZombieDescription() const { return Description; }
34 void zombie::BeTalkedTo()
36 if(GetRelation(PLAYER) == HOSTILE && PLAYER->GetAttribute(INTELLIGENCE) > 5)
38 if(RAND() % 5)
40 if(GetHead())
41 ADD_MESSAGE("\"Need brain!!\"");
42 else
43 ADD_MESSAGE("\"Need head with brain!!\"");
45 else
46 ADD_MESSAGE("\"Redrum! Redrum! Redrum!\"");
48 else
49 ADD_MESSAGE("\"Need brain but you too stoopid!\"");
54 void zombie::CreateBodyParts(int SpecialFlags)
56 bool Anyway = false;
57 if(GetConfig() == ZOMBIE_OF_KHAZ_ZADM)
59 Anyway = true;
60 } // Khaz-Zadm needs his hands...
62 for(int c = 0; c < BodyParts; ++c)
63 if(Anyway || BodyPartIsVital(c) || RAND_N(3) || (c == HEAD_INDEX && !RAND_N(3)))
65 bodypart* BodyPart = CreateBodyPart(c, SpecialFlags|NO_PIC_UPDATE);
66 BodyPart->GetMainMaterial()->SetSpoilCounter(2000 + RAND_N(1000));
72 void zombie::GetAICommand()
74 if(!GetHead())
76 for(stackiterator i = GetLSquareUnder()->GetStack()->GetBottom(); i.HasItem(); ++i)
78 head* Head = i->Behead();
80 if(Head)
82 if(CanBeSeenByPlayer())
83 ADD_MESSAGE("%s takes %s and attaches it to its torso.", CHAR_NAME(DEFINITE), Head->CHAR_NAME(INDEFINITE));
85 Head->RemoveFromSlot();
86 AttachBodyPart(Head);
87 Head->SetHP(1);
88 DexterityAction(10);
89 return;
94 humanoid::GetAICommand();
99 void zombie::AddPostFix(festring& String, int Case) const
101 if(!Description.IsEmpty())
102 String << Description;
103 else
104 humanoid::AddPostFix(String, Case);
109 void zombie::Save(outputfile& SaveFile) const
111 humanoid::Save(SaveFile);
112 SaveFile << Description;
117 void zombie::Load(inputfile& SaveFile)
119 humanoid::Load(SaveFile);
120 SaveFile >> Description;
125 void zombie::PostConstruct()
127 if(!RAND_N(3))
128 GainIntrinsic(LEPROSY);
130 #endif