2 ITEM(scrollofgolemcreation
, scroll
)
5 virtual void FinishReading(character
*);
13 void scrollofgolemcreation::FinishReading(character
* Reader
)
19 if(!Reader
->SelectFromPossessions(Item
, CONST_S("Which item do you wish to use for golem creation?"), NO_MULTI_SELECT
, &item::IsDestroyable
))
21 ADD_MESSAGE("You notice you haven't got anything to change into a golem.");
27 material
* Main
= Item
[0]->GetMainMaterial();
28 material
* Sec
= Item
[0]->GetSecondaryMaterial();
29 truth MainPossible
= Main
->GetCategoryFlags() & IS_GOLEM_MATERIAL
;
30 truth SecPossible
= Sec
&& Sec
->GetVolume()
31 && Sec
->GetCategoryFlags() & IS_GOLEM_MATERIAL
32 && !Sec
->IsSameAs(Main
);
34 if(!MainPossible
&& !SecPossible
)
36 ADD_MESSAGE("You can't use that for golem creation.");
40 if (MainPossible
&& SecPossible
) {
41 if (game::TruthQuestion(CONST_S("Use main material? [Y/n]"), YES
)) SecPossible
= false; else MainPossible
= false;
44 int MaterialConfig
= MainPossible
? Main
->GetConfig() : Sec
->GetConfig();
45 golem
* Golem
= golem::Spawn(MaterialConfig
);
46 sLong Volume
= MainPossible
? Sec
&& Sec
->IsSameAs(Main
)
47 ? Main
->GetVolume() + Sec
->GetVolume()
48 : Main
->GetVolume() : Sec
->GetVolume();
49 Golem
->SetItemVolume(Volume
);
50 v2 Where
= GetLevel()->GetNearestFreeSquare(Golem
, Reader
->GetPos());
51 Item
[0]->RemoveFromSlot();
52 Item
[0]->SendToHell();
56 ADD_MESSAGE("You cast the spell and %s is sucked into a rainbow-coled magical vortex, but nothing happens.", Item
[0]->CHAR_NAME(DEFINITE
));
61 ADD_MESSAGE("You cast the spell and %s is sucked into a rainbow-coled magical vortex.", Item
[0]->CHAR_NAME(DEFINITE
));
62 Golem
->SetTeam(Reader
->GetTeam());
65 if(Golem
->CanBeSeenByPlayer())
66 ADD_MESSAGE("Suddenly %s materializes!", Golem
->CHAR_NAME(INDEFINITE
));
68 Golem
->GetLSquareUnder()->DrawParticles(RED
);
73 else if(game::TruthQuestion(CONST_S("Really cancel read? [y/N]")))
79 Reader
->EditExperience(INTELLIGENCE
, 300, 1 << 12);