item classes moved to separate files
[k8-i-v-a-n.git] / src / game / items / scroll_scrollofdetectmaterial.cpp
blob102983520defdf4580a6a0ba98808968a159311d
1 #ifdef HEADER_PHASE
2 ITEM(scrollofdetectmaterial, scroll)
4 public:
5 virtual void FinishReading(character*);
6 };
9 #else
13 void scrollofdetectmaterial::FinishReading(character* Reader)
15 material* TempMaterial;
17 for(;;)
19 festring Temp = game::DefaultQuestion(CONST_S("What material do you want to detect?"),
20 game::GetDefaultDetectMaterial());
21 TempMaterial = protosystem::CreateMaterial(Temp);
23 if(TempMaterial)
24 break;
25 else
26 game::DrawEverythingNoBlit();
29 level* Level = GetLevel();
30 int Squares = Level->DetectMaterial(TempMaterial);
31 RemoveFromSlot();
32 SendToHell();
34 if(Squares > Reader->GetAttribute(INTELLIGENCE) * (25 + RAND() % 51))
36 ADD_MESSAGE("An enormous burst of geographical information overwhelms your consciousness. Your mind cannot cope with it and your memories blur.");
37 Level->BlurMemory();
38 Reader->BeginTemporaryState(CONFUSED, 1000 + RAND() % 1000);
39 Reader->EditExperience(INTELLIGENCE, -100, 1 << 12);
41 else if(!Squares)
43 ADD_MESSAGE("You feel a sudden urge to imagine the dark void of a starless night sky.");
44 Reader->EditExperience(INTELLIGENCE, 200, 1 << 12);
46 else
48 ADD_MESSAGE("You feel attracted to all things made of %s.", TempMaterial->GetName(false, false).CStr());
49 game::PositionQuestion(CONST_S("Detecting material [direction keys move cursor, space exits]"), Reader->GetPos(), 0, 0, false);
50 Reader->EditExperience(INTELLIGENCE, 300, 1 << 12);
53 delete TempMaterial;
54 Level->CalculateLuminances();
55 game::SendLOSUpdateRequest();
57 #endif