5 moneybag () : moneyAmount(1+RAND_N(300)) {
6 if (RAND_N(100) < 10) moneyAmount
+= 1000;
8 virtual truth
Apply (character
*beggar
);
9 virtual void Save (outputfile
&) const;
10 virtual void Load (inputfile
&);
11 virtual truth
IsConsumable () const { return false; }
12 virtual truth
IsAppliable (ccharacter
*beggar
) const;
13 virtual truth
CanBeHardened (ccharacter
*) const { return false; }
14 virtual truth
IsMoneyBag () const { return true; }
16 virtual sLong
GetTruePrice () const { return moneyAmount
; }
27 truth
moneybag::IsAppliable (ccharacter
*beggar
) const {
28 return beggar
->IsPlayer();
33 truth
moneybag::Apply (character
*beggar
) {
34 if (!beggar
->IsPlayer()) return false;
35 if (!game::TruthQuestion(CONST_S("Are you sure you want to open ")+GetName(DEFINITE
)+"? [y/N]")) return false;
36 ADD_MESSAGE("You opens %s and found %i gold coins", CHAR_NAME(DEFINITE
), moneyAmount
);
37 beggar
->EditMoney(moneyAmount
);
45 void moneybag::Save (outputfile
&saveFile
) const {
47 saveFile
<< moneyAmount
;
52 void moneybag::Load (inputfile
&saveFile
) {
54 saveFile
>> moneyAmount
;