2 CHARACTER(playerkind
, humanoid
)
6 playerkind(const playerkind
&);
7 virtual void Save(outputfile
&) const;
8 virtual void Load(inputfile
&);
9 virtual void SetSoulID(feuLong
);
10 virtual truth
SuckSoul(character
*);
11 virtual truth
TryToRiseFromTheDead();
12 virtual void FinalProcessForBone();
13 virtual void BeTalkedTo();
14 virtual truth
IsHuman() const { return true; }
15 virtual col16
GetHairColor() const { return HairColor
; }
16 virtual col16
GetEyeColor() const { return EyeColor
; }
17 virtual v2
GetHeadBitmapPos() const;
18 virtual v2
GetRightArmBitmapPos() const;
19 virtual v2
GetLeftArmBitmapPos() const;
20 virtual int GetNaturalSparkleFlags() const;
21 virtual truth
IsPlayerKind() const { return true; }
22 virtual double GetNaturalExperience(int) const;
24 virtual bodypart
* MakeBodyPart(int) const;
25 virtual void PostConstruct();
39 static cint TalentOfAttribute
[ATTRIBUTES
] = { TALENT_HEALTHY
, TALENT_FAST_N_ACCURATE
, TALENT_CLEVER
, TALENT_CLEVER
, TALENT_CLEVER
, TALENT_CLEVER
, TALENT_CLEVER
, TALENT_STRONG
, TALENT_STRONG
, TALENT_FAST_N_ACCURATE
, TALENT_FAST_N_ACCURATE
};
40 static const double TalentBonusOfAttribute
[ATTRIBUTES
] = { 1.1, 1.25, 1.25, 1.25, 1.25, 1.25, 1.25, 1.25, 1.25, 1.25, 1.25 };
43 playerkind::playerkind() : SoulID(0), IsBonePlayer(false), IsClone(false)
49 void playerkind::Save(outputfile
& SaveFile
) const
51 humanoid::Save(SaveFile
);
52 SaveFile
<< SoulID
<< HairColor
<< EyeColor
<< Talent
<< Weakness
<< IsBonePlayer
<< IsClone
;
57 void playerkind::Load(inputfile
& SaveFile
)
59 humanoid::Load(SaveFile
);
60 SaveFile
>> SoulID
>> HairColor
>> EyeColor
>> Talent
>> Weakness
>> IsBonePlayer
>> IsClone
;
65 void playerkind::SetSoulID(feuLong What
)
69 if(GetPolymorphBackup())
70 GetPolymorphBackup()->SetSoulID(What
);
75 truth
playerkind::SuckSoul(character
* Soul
)
77 if(Soul
->GetID() == SoulID
)
88 truth
playerkind::TryToRiseFromTheDead()
90 if(humanoid::TryToRiseFromTheDead())
92 if(IsEnabled() && SoulID
)
94 ADD_MESSAGE("The soulless body of %s wobbles for a moment.", CHAR_NAME(DEFINITE
));
106 void playerkind::FinalProcessForBone()
108 humanoid::FinalProcessForBone();
113 boneidmap::iterator BI
= game::GetBoneCharacterIDMap().find(SoulID
);
115 if(BI
!= game::GetBoneCharacterIDMap().end())
124 playerkind::playerkind(const playerkind
& Char
) : mybase(Char
), SoulID(Char
.SoulID
), HairColor(Char
.HairColor
), EyeColor(Char
.EyeColor
), Talent(Char
.Talent
), Weakness(Char
.Weakness
), IsBonePlayer(Char
.IsBonePlayer
), IsClone(true)
130 void playerkind::BeTalkedTo()
132 if(IsClone
&& IsBonePlayer
)
134 if(GetRelation(PLAYER
) == HOSTILE
)
136 ADD_MESSAGE("Oh no, you too! Why does everyone bully me!");
142 switch(RandomizeReply(Said
, 4))
145 ADD_MESSAGE("\"I'd like to write a memoir, but alas I doubt anyone would believe it.\"");
148 ADD_MESSAGE("\"Then that damned clone appeared, took all my equipment and claimed I was his slave...\"");
151 ADD_MESSAGE("\"The level was a catastrophe for the party, but luckily you saved the day.\"");
154 ADD_MESSAGE("\"Oh, how I hate bananas. I Hate Them! I HATE THEM SO MUCH!!!\"");
160 if(GetRelation(PLAYER
) == HOSTILE
)
162 ADD_MESSAGE("%s seems extremely irritated. \"Vanish, you foul mirror image!\"", CHAR_DESCRIPTION(DEFINITE
));
168 switch(RandomizeReply(Said
, 4))
171 ADD_MESSAGE("\"Hey, those clothes are mine! Give them back!\"");
174 ADD_MESSAGE("\"What, you summoned me? What a coincidence, I remember summoning you, too.\"");
177 ADD_MESSAGE("\"I'm leading this party, not you, Mr. copy guy!\"");
180 ADD_MESSAGE("\"Oh, how I hate bananas. I Hate Them! I HATE THEM SO MUCH!!!\"");
186 if(GetRelation(PLAYER
) == HOSTILE
)
188 ADD_MESSAGE("Let's finish what my ghost failed to do!");
194 switch(RandomizeReply(Said
, 4))
197 ADD_MESSAGE("\"What was it like? Death, you mean? Well, just like New Attnam. Very hot and whips everywhere.\"");
200 ADD_MESSAGE("\"Stop it already! I *don't* want to know how my corpse smelled!\"");
203 ADD_MESSAGE("\"I'm sorry about that ghost thing. That YASD was just a bit too much to handle, so I lost myself.\"");
206 ADD_MESSAGE("\"Oh, how I hate bananas. I Hate Them! I HATE THEM SO MUCH!!!\"");
214 bodypart
* playerkind::MakeBodyPart(int I
) const
218 case TORSO_INDEX
: return playerkindtorso::Spawn(0, NO_MATERIALS
);
219 case HEAD_INDEX
: return playerkindhead::Spawn(0, NO_MATERIALS
);
220 case RIGHT_ARM_INDEX
: return playerkindrightarm::Spawn(0, NO_MATERIALS
);
221 case LEFT_ARM_INDEX
: return playerkindleftarm::Spawn(0, NO_MATERIALS
);
222 case GROIN_INDEX
: return playerkindgroin::Spawn(0, NO_MATERIALS
);
223 case RIGHT_LEG_INDEX
: return playerkindrightleg::Spawn(0, NO_MATERIALS
);
224 case LEFT_LEG_INDEX
: return playerkindleftleg::Spawn(0, NO_MATERIALS
);
227 ABORT("Weird bodypart to make for a playerkind. It must be your fault!");
233 void playerkind::PostConstruct()
235 int R
= 0, G
= 0, B
= 0;
239 case 0: R
= 195; G
= 165; B
= 40; break;
240 case 1: R
= 130; G
= 30; B
= 0; break;
241 case 2: R
= 30; G
= 30; B
= 15; break;
242 case 3: R
= 50; G
= 30; B
= 5; break;
245 HairColor
= MakeRGB16(R
+ RAND_N(41), G
+ RAND_N(41), B
+ RAND_N(41));
249 case 0: R
= 25; G
= 0; B
= 70; break;
250 case 1: R
= 5; G
= 0; B
= 50; break;
251 case 2: R
= 10; G
= 10; B
= 10; break;
252 case 3: R
= 60; G
= 20; B
= 0; break;
255 EyeColor
= MakeRGB16(R
+ RAND_N(41), G
+ RAND_N(41), B
+ RAND_N(41));
256 Talent
= RAND_N(TALENTS
);
257 Weakness
= RAND_N(TALENTS
);
262 v2
playerkind::GetHeadBitmapPos() const
264 int Sum
= GetAttribute(INTELLIGENCE
, false) + GetAttribute(WISDOM
, false);
276 v2
playerkind::GetRightArmBitmapPos() const
278 if(GetRightArm()->GetAttribute(ARM_STRENGTH
, false) >= 20)
286 v2
playerkind::GetLeftArmBitmapPos() const
288 if(GetLeftArm()->GetAttribute(ARM_STRENGTH
, false) >= 20)
296 int playerkind::GetNaturalSparkleFlags() const
298 return GetAttribute(CHARISMA
) >= 30 ? SKIN_COLOR
: 0;
303 double playerkind::GetNaturalExperience(int Identifier
) const
305 double NE
= DataBase
->NaturalExperience
[Identifier
];
307 if(Talent
== TalentOfAttribute
[Identifier
])
308 NE
*= TalentBonusOfAttribute
[Identifier
];
310 if(Weakness
== TalentOfAttribute
[Identifier
])
311 NE
/= TalentBonusOfAttribute
[Identifier
];