2 CHARACTER(zombie
, humanoid
)
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;
14 virtual void PostConstruct();
15 virtual void AddPostFix(festring
&, int) const;
16 virtual void GetAICommand();
17 virtual truth
AllowExperience() const { return false; }
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)
41 ADD_MESSAGE("\"Need brain!!\"");
43 ADD_MESSAGE("\"Need head with brain!!\"");
46 ADD_MESSAGE("\"Redrum! Redrum! Redrum!\"");
49 ADD_MESSAGE("\"Need brain but you too stoopid!\"");
54 void zombie::CreateBodyParts(int SpecialFlags
)
57 if(GetConfig() == ZOMBIE_OF_KHAZ_ZADM
)
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()
76 for(stackiterator i
= GetLSquareUnder()->GetStack()->GetBottom(); i
.HasItem(); ++i
)
78 head
* Head
= i
->Behead();
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();
94 humanoid::GetAICommand();
99 void zombie::AddPostFix(festring
& String
, int Case
) const
101 if(!Description
.IsEmpty())
102 String
<< Description
;
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()
128 GainIntrinsic(LEPROSY
);