1 /*
2 This file is part of "Avanor, the Land of Mystery" roguelike game
3 Home page: http://www.avanor.com/
4 Copyright (C) 2000-2003 Vadim Gaidukevich
5 
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #include "other_misc.h"
22 #include "xgen.h"
23 #include "unique.h"
24 #include "game.h"
25 
26 
27 class XMagicMCPlace : public XAnyPlace
28 {
29 public:
30 	DECLARE_CREATOR(XMagicMCPlace, XAnyPlace);
XMagicMCPlace(XRect * _area,XLocation * _loc)31 	XMagicMCPlace(XRect * _area, XLocation * _loc) : XAnyPlace(_area, _loc) {}
onCreatureMove(XCreature * cr)32 	int onCreatureMove(XCreature * cr)
33 	{
34 		if (cr->isHero() && vRand(15) == 0)
35 		{
36 			msgwin.Add("You feel power swirling in the air...");
37 		}
38 		if (vRand(30) == 0)
39 		{
40 			STATS st = (STATS)vRand(S_EOF); //random stats;
41 			if (cr->GetStats(st) > 5)
42 				cr->GainAttr(st, -1);
43 		}
44 		return 1;
45 	}
46 };
47 
48 REGISTER_CLASS(XMagicMCPlace);
49 
50 //           000  entr cave(1)
51 //            |
52 //           000  demon cave (2)
53 //          / |
54 // misc(3)000 |
55 //         | 000 mushroom cave (5)
56 //         |
57 //        000 kobold cave (4)
58 
59 
XMushroomsCaveLocation(LOCATION loc)60 XMushroomsCaveLocation::XMushroomsCaveLocation(LOCATION loc) : XLocation(loc)
61 {
62 	BuildCave();
63 
64 	if (loc == 	L_MUSHROOMS_CAVE1)
65 	{
66 		strcpy(brief_name, "MC:1");
67 		strcpy(full_name, "Mushroom Caves Level 1");
68 
69 		NewWay(L_MAIN, STW_UP);
70 		NewWay(L_MUSHROOMS_CAVE2, STW_DOWN);
71 
72 //		Game.Scheduler.Add(new XUniversalGen(this, (CREATURE_CLASS)(CR_INSECT | CR_REPTILE), CRL_VERY_LOW, 10, 15000));
73 	}
74 	if (loc == L_MUSHROOMS_CAVE2)
75 	{
76 		strcpy(brief_name, "MC:2");
77 		strcpy(full_name, "Mushroom Cave Level 2");
78 		NewWay(L_MUSHROOMS_CAVE1, STW_UP);
79 		NewWay(L_MUSHROOMS_CAVE3, STW_DOWN);
80 		NewWay(L_MUSHROOMS_CAVE5, STW_DOWN);
81 		NewCreature(CN_BEELZEVILE, NULL);
82 	}
83 	if (loc == L_MUSHROOMS_CAVE3)
84 	{
85 		strcpy(brief_name, "KC:1");
86 		strcpy(full_name, "Kobold Cavern Level 1");
87 		NewWay(L_MUSHROOMS_CAVE2, STW_UP);
88 		NewWay(L_MUSHROOMS_CAVE4, STW_DOWN);
89 		Game.Scheduler.Add(new XUniversalGen(this, (CREATURE_CLASS)(CR_KOBOLD), (CREATURE_LEVEL)(CRL_LOW | CRL_VERY_LOW), 10, 25000));
90 	}
91 	if (loc == L_MUSHROOMS_CAVE4)
92 	{
93 		strcpy(brief_name, "KC:2");
94 		strcpy(full_name, "Kobold Cavern Level 2");
95 		NewWay(L_MUSHROOMS_CAVE3, STW_UP);
96 
97 		Game.Scheduler.Add(new XUniversalGen(this, (CREATURE_CLASS)(CR_KOBOLD), (CREATURE_LEVEL)(CRL_LOW | CRL_VERY_LOW), 10, 25000));
98 	}
99 	if (loc == L_MUSHROOMS_CAVE5)
100 	{
101 		strcpy(brief_name, "MC:3");
102 		strcpy(full_name, "Mushroom Cave Level 3");
103 		NewWay(L_MUSHROOMS_CAVE2, STW_UP);
104 		XRect t_area(0, 0, 80, 20);
105 		XAnyPlace * place = new XMagicMCPlace(&t_area, this);
106 		AddPlace(place);
107 		ttmb = 1000;
108 		ttm = 1000;
109 		Game.Scheduler.Add(Game.locations[L_MUSHROOMS_CAVE5].get());
110 
111 	}
112 }
113 
Run()114 int XMushroomsCaveLocation::Run()
115 {
116 	ttm = 45000;
117 	XPoint pt;
118 	GetFreeXY(&pt);
119 	new XMushSpawn(pt.x, pt.y, this);
120 	return 1;
121 }
122 
123