1 /**********************************************************************************
2 * Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC
3 * Copyright (c) 2018, Ketmar Dark
5 * This file is part of Spelunky.
7 * You can redistribute and/or modify Spelunky, including its source code, under
8 * the terms of the Spelunky User License.
10 * Spelunky is distributed in the hope that it will be entertaining and useful,
11 * but WITHOUT WARRANTY. Please see the Spelunky User License for more details.
13 * The Spelunky User License should be available in "Game Information", which
14 * can be found in the Resource Explorer, or as an external file called COPYING.
15 * If not, please obtain a new copy of Spelunky from <http://spelunkyworld.com/>
17 **********************************************************************************/
18 class ObjTikiCurse : MapObject abstract;
21 bool monkey; // if trap was triggered by a monkey
24 // if not stolen, then it is activated by monkey
25 void activate (bool stolen) {
37 // ////////////////////////////////////////////////////////////////////////// //
38 class ObjTikiCurseBoulder['oTikiCurseTriggerBoulder'] : ObjTikiCurse;
44 override bool initialize () {
45 if (!::initialize()) return false;
50 override void activate (bool stolen) {
51 if (activated) return;
56 writeln("*** Boulder Trap Activated ***");
60 override void thinkFrame () {
62 if (--boulderSpawnTime == 0) {
63 auto headTile = MapTileGiantTikiHead(level.findNearestTile(ix, iy, delegate bool (MapTile t) { return (t isa MapTileGiantTikiHead); }));
66 auto obj = ObjBoulder(level.MakeMapTile(headTile.ix/16, headTile.iy/16, 'oBoulder'));
67 if (obj) obj.monkey = monkey;
68 playSound('sndThump');
75 override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) {
80 boulderSpawnTime = 100;
84 // ////////////////////////////////////////////////////////////////////////// //
85 class ObjTikiCurseRemoveBricks['oTikiCurseRemoveBricks'] : ObjTikiCurse;
88 override bool initialize () {
89 if (!::initialize()) return false;
94 override void activate (bool stolen) {
95 if (activated) return;
103 override void thinkFrame () {
104 if (!monkey && global.cemetary && !level.ghostSpawned) {
108 //FIXME: rewrite this for several idols (???)
109 level.forEachTile(delegate bool (MapTile t) {
110 auto tt = MapTileLushTrapBlock(t);
111 if (tt) tt.activate();
113 }, castClass:MapTileLushTrapBlock);
115 // it has no reason to live anymore
120 override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) {
128 // ////////////////////////////////////////////////////////////////////////// //
129 class ObjTikiCurseCilingTrap['oTikiCurseCeilingTrap'] : ObjTikiCurse;
132 override bool initialize () {
133 if (!::initialize()) return false;
138 override void activate (bool stolen) {
139 if (activated) return;
147 override void thinkFrame () {
148 //FIXME: rewrite this for several idols (???)
149 level.forEachTile(delegate bool (MapTile t) {
150 auto tt = MapTileCeilingTrap(t);
151 if (!tt) return false;
153 if (tt.distanceToEntityCenter(level.player) < 90) {
161 }, castClass:MapTileCeilingTrap);
165 // it has no reason to live anymore
170 override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) {